aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-07-18 03:10:03 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commitec1a48e7b86fcd00127dd5a88d56c42083af1d78 (patch)
tree7e6423f20fa795bbba8cbc5ead8bc8a3f7289d2e /tests
parent84e65c63e7482590d535e86f7660a00ae8a0cecb (diff)
Setup structure for program execute
Diffstat (limited to 'tests')
-rw-r--r--tests/main.c14
1 files changed, 9 insertions, 5 deletions
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);
}