1 // A test case for the LEMON parser generator. Run as follows:
3 // lemon lemon-test01.y && gcc -g lemon-test01.c && ./a.out
5 // This testcase was made obsolete by check-in 7cca80808cef192f on
6 // 2021-08-17 (associated with Forum Thread
7 // https://sqlite.org/forum/forumpost/bd91fd965c9803c4) and no longer
8 // works. It is retained for historical reference only.
14 static int nSyntaxError
= 0;
15 static int nAccept
= 0;
16 static int nFailure
= 0;
33 #include "lemon-test01.h"
36 static void testCase
(int testId
, int shouldBe
, int actual
){
38 if
( shouldBe
==actual
){
39 printf
("test %d: ok\n", testId
);
41 printf
("test %d: got %d, expected %d\n", testId
, actual
, shouldBe
);
45 int main
(int argc
, char **argv
){
52 testCase
(100, 0, nSyntaxError
);
53 testCase
(110, 1, nAccept
);
54 testCase
(120, 0, nFailure
);
55 nSyntaxError
= nAccept
= nFailure
= 0;
61 testCase
(200, 1, nSyntaxError
);
62 testCase
(210, 1, nAccept
);
63 testCase
(220, 0, nFailure
);
64 nSyntaxError
= nAccept
= nFailure
= 0;
70 testCase
(200, 1, nSyntaxError
);
71 testCase
(210, 0, nAccept
);
72 testCase
(220, 0, nFailure
);
74 printf
("%d tests pass\n", nTest
);
76 printf
("%d errors out %d tests\n", nErr
, nTest
);