add some tests
parent
bf6d32f8cb
commit
05c1a8b3cc
|
@ -315,6 +315,28 @@ pub fn addCases(cases: &tests.ParseCContext) {
|
|||
\\pub const LUA_GLOBALSINDEX = -10002;
|
||||
);
|
||||
|
||||
cases.add("post increment",
|
||||
\\unsigned foo1(unsigned a) {
|
||||
\\ a++;
|
||||
\\ return a;
|
||||
\\}
|
||||
\\int foo2(int a) {
|
||||
\\ a++;
|
||||
\\ return a;
|
||||
\\}
|
||||
,
|
||||
\\export fn foo1(_arg_a: c_uint) -> c_uint {
|
||||
\\ var a = _arg_a;
|
||||
\\ a +%= 1;
|
||||
\\ return a;
|
||||
\\}
|
||||
\\export fn foo2(_arg_a: c_int) -> c_int {
|
||||
\\ var a = _arg_a;
|
||||
\\ a += 1;
|
||||
\\ return a;
|
||||
\\}
|
||||
);
|
||||
|
||||
cases.add("shift right assign",
|
||||
\\int log2(unsigned a) {
|
||||
\\ int i = 0;
|
||||
|
@ -334,6 +356,23 @@ pub fn addCases(cases: &tests.ParseCContext) {
|
|||
\\}
|
||||
);
|
||||
|
||||
cases.add("if statement",
|
||||
\\int max(int a, int b) {
|
||||
\\ if (a < b)
|
||||
\\ return b;
|
||||
\\
|
||||
\\ if (a < b)
|
||||
\\ return b;
|
||||
\\ else
|
||||
\\ return a;
|
||||
\\}
|
||||
,
|
||||
\\export fn max(a: c_int, b: c_int) -> c_int {
|
||||
\\ if (a < b) return b;
|
||||
\\ if (a < b) return b else return a;
|
||||
\\}
|
||||
);
|
||||
|
||||
cases.add("shift right assign with a fixed size type",
|
||||
\\#include <stdint.h>
|
||||
\\int log2(uint32_t a) {
|
||||
|
|
Loading…
Reference in New Issue