// File: /workspace/github_c_makefile_star2_O0/codeplea[P]tinyexpr/smoke.c
// Function: test_syntax
void test_syntax() {
    test_case errors[] = {
        {"", 1},
        {"1+", 2},
        {"1)", 2},
        {"(1", 2},
        {"1**1", 3},
        {"1*2(+4", 4},
        {"1*2(1+4", 4},
        {"a+5", 1},
        {"!+5", 1},
        {"_a+5", 1},
        {"#a+5", 1},
        {"1^^5", 3},
        {"1**5", 3},
        {"sin(cos5", 8},
    };


    int i;
    for (i = 0; i < sizeof(errors) / sizeof(test_case); ++i) {
        const char *expr = errors[i].expr;
        const int e = errors[i].answer;

        int err;
        const double r = te_interp(expr, &err);
        lequal(err, e);
        lok(r != r);

        te_expr *n = te_compile(expr, 0, 0, &err);
        lequal(err, e);
        lok(!n);

        if (err != e) {
            printf("FAILED: %s\n", expr);
        }

        const double k = te_interp(expr, 0);
        lok(k != k);
    }
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
leaq 0x30(%rsp), %rdi
leaq 0xb0ad(%rip), %rsi      # 0xe510
movl $0xe0, %edx
callq 0x30e0
movl $0x0, 0x2c(%rsp)
movslq 0x2c(%rsp), %rax
cmpq $0xe, %rax
jae 0x369a
movslq 0x2c(%rsp), %rcx
leaq 0x30(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movslq 0x2c(%rsp), %rcx
leaq 0x30(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
cvttsd2si 0x8(%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x9300
movsd %xmm0, 0x10(%rsp)
movl 0xbc2a(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xbc21(%rip)      # 0xf0fc
movl 0x18(%rsp), %eax
cmpl 0x1c(%rsp), %eax
je 0x3517
movl 0xbc15(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xbc0c(%rip)      # 0xf100
movl 0x18(%rsp), %ecx
movl 0x1c(%rsp), %r8d
leaq 0x7f1d(%rip), %rdi      # 0xb421
leaq 0x7eb0(%rip), %rsi      # 0xb3bb
movl $0xc1, %edx
movb $0x0, %al
callq 0x3080
jmp 0x3519
jmp 0x351b
movl 0xbbdb(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xbbd2(%rip)      # 0xf0fc
movsd 0x10(%rsp), %xmm0
ucomisd 0x10(%rsp), %xmm0
jne 0x3563
jp 0x3563
movl 0xbbc0(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xbbb7(%rip)      # 0xf100
leaq 0x7e5d(%rip), %rdi      # 0xb3ad
leaq 0x7e64(%rip), %rsi      # 0xb3bb
movl $0xc2, %edx
movb $0x0, %al
callq 0x3080
jmp 0x3565
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
leaq 0x18(%rsp), %rcx
callq 0x8ff0
movq %rax, 0x8(%rsp)
movl 0xbb77(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xbb6e(%rip)      # 0xf0fc
movl 0x18(%rsp), %eax
cmpl 0x1c(%rsp), %eax
je 0x35ca
movl 0xbb62(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xbb59(%rip)      # 0xf100
movl 0x18(%rsp), %ecx
movl 0x1c(%rsp), %r8d
leaq 0x7e6a(%rip), %rdi      # 0xb421
leaq 0x7dfd(%rip), %rsi      # 0xb3bb
movl $0xc5, %edx
movb $0x0, %al
callq 0x3080
jmp 0x35cc
jmp 0x35ce
movl 0xbb28(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xbb1f(%rip)      # 0xf0fc
cmpq $0x0, 0x8(%rsp)
je 0x360e
movl 0xbb15(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xbb0c(%rip)      # 0xf100
leaq 0x7db2(%rip), %rdi      # 0xb3ad
leaq 0x7db9(%rip), %rsi      # 0xb3bb
movl $0xc6, %edx
movb $0x0, %al
callq 0x3080
jmp 0x3610
movl 0x18(%rsp), %eax
cmpl 0x1c(%rsp), %eax
je 0x362d
movq 0x20(%rsp), %rsi
leaq 0x7e0d(%rip), %rdi      # 0xb433
movb $0x0, %al
callq 0x3080
movq 0x20(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x9300
movsd %xmm0, (%rsp)
movl 0xbab6(%rip), %eax      # 0xf0fc
addl $0x1, %eax
movl %eax, 0xbaad(%rip)      # 0xf0fc
movsd (%rsp), %xmm0
ucomisd (%rsp), %xmm0
jne 0x3686
jp 0x3686
movl 0xba9d(%rip), %eax      # 0xf100
addl $0x1, %eax
movl %eax, 0xba94(%rip)      # 0xf100
leaq 0x7d3a(%rip), %rdi      # 0xb3ad
leaq 0x7d41(%rip), %rsi      # 0xb3bb
movl $0xcd, %edx
movb $0x0, %al
callq 0x3080
jmp 0x3688
jmp 0x368a
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x3475
addq $0x118, %rsp            # imm = 0x118
retq
nopw %cs:(%rax,%rax)