repos / gbc

GBC - Go B Compiler
git clone https://github.com/xplshn/gbc.git

gbc / tests
xplshn  ·  2025-08-13

ternary-assign.b

B
 1// Prompted by https://github.com/tsoding/b/pull/95
 2assert_equal(actual, expected, message) {
 3    extrn printf, abort;
 4    printf("%s: ", message);
 5    if (actual != expected) {
 6        printf("FAIL\n");
 7        abort();
 8    } else {
 9        printf("OK\n");
10    }
11}
12
13main() {
14    auto a;
15    a = 1 ? 69 : 420;
16    extrn assert_equal;
17    assert_equal(a, 69, "a = 1 ? 69 : 420; a == 69");
18}