diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/check | bin | 1261584 -> 1269672 bytes | |||
| -rw-r--r-- | tests/check.c | 41 |
2 files changed, 39 insertions, 2 deletions
diff --git a/tests/check b/tests/check Binary files differindex b079a57..a904b37 100755 --- a/tests/check +++ b/tests/check diff --git a/tests/check.c b/tests/check.c index 8f4c6de..f6e775c 100644 --- a/tests/check.c +++ b/tests/check.c @@ -138,8 +138,45 @@ static void check_add() static void check_branch() { - /* oh yeah, I don't support forward references (yet), so this is a bit - * tricky */ + for (size_t i = 0; i < 2; ++i) { + ctx_t ctx; + compile_start(&ctx); + + compile_fast_lia(&ctx, i); + reloc_t r = compile_placeholder(&ctx, compile_lio); + compile_ban(&ctx); + + compile_lix(&ctx, 0); + compile_end(&ctx); + + void *skip = compile_lix(&ctx, 1); + compile_end(&ctx); + compile_patch(r, skip); + + compile_finish(&ctx); + + assert(run(&ctx) == (i != 0)); + } + + for (size_t i = 0; i < 2; ++i) { + ctx_t ctx; + compile_start(&ctx); + + compile_fast_lia(&ctx, i); + reloc_t r = compile_placeholder(&ctx, compile_lio); + compile_baz(&ctx); + + compile_lix(&ctx, 0); + compile_end(&ctx); + + void *skip = compile_lix(&ctx, 1); + compile_end(&ctx); + compile_patch(r, skip); + + compile_finish(&ctx); + + assert(run(&ctx) == (i == 0)); + } } int main() |
