From ec1a48e7b86fcd00127dd5a88d56c42083af1d78 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 18 Jul 2019 03:10:03 +0200 Subject: Setup structure for program execute --- tests/main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/main.c b/tests/main.c index 9b1e40a..1394860 100644 --- a/tests/main.c +++ b/tests/main.c @@ -142,7 +142,10 @@ static void test_load(const char *filepath) { ++num_tests_run; full_path = get_full_path(filepath); - amal_program_init(&program); + if(amal_program_init(&program) != 0) { + fprintf(stderr, "Failed to initialize amal program\n"); + FAIL_TEST(full_path); + } result = amal_compiler_load_file(&options, &program, filepath); if(result != AMAL_COMPILER_OK) { fprintf(stderr, "Failed to load file %s, result: %d\n", full_path, result); @@ -165,7 +168,6 @@ static void test_load_error(const char *filepath, const char *expected_error) { amal_compiler_options options; amal_program program; ErrorExpectedData expected_data; - int result; amal_compiler_options_init(&options); options.num_threads = num_threads; @@ -177,9 +179,11 @@ static void test_load_error(const char *filepath, const char *expected_error) { expected_data.got_expected_error = bool_false; options.error_callback_userdata = &expected_data; - amal_program_init(&program); - result = amal_compiler_load_file(&options, &program, filepath); - if(result == AMAL_COMPILER_OK) { + if(amal_program_init(&program) != 0) { + fprintf(stderr, "Failed to initialize amal program\n"); + FAIL_TEST(expected_data.filepath); + } + if(amal_compiler_load_file(&options, &program, filepath) == AMAL_COMPILER_OK) { fprintf(stderr, "Expected to fail loading file\n"); FAIL_TEST(expected_data.filepath); } -- cgit v1.2.3