int main(int argc, char** argv) { ull a = 2; ull b = 5; int c = a + b; cba_print_code(); cba_expect_eq_int(a, 2); cba_expect_eq_int(b, 5); cba_expect_eq_int(c, 7); cba_expect_eq_int(a+b, 7); return 0; }
int main(int argc, char** argv) { cba_print_code(); // check whether ticks are properly analyzed cba_expect_eq_int(1,s()); cba_expect_eq_int(2,s()); cba_expect_eq_int(3,s()); cba_expect_eq_int(5,d()); // cba_dump_equations(); return 0; }
int main(int argc, char** argv) { // test the initial value cba_expect_eq_int(A::instances, 0); A a; cba_expect_eq_int(A::instances, 1); new A(); cba_expect_eq_int(A::instances, 2); // cba_dump_solution(); // cba_print_code(); // cba_dump_json(); return 0; }
int main(int argc, char** argv) { // let's start with something simple cba_expect_eq_int(1,1); // a little more challenging int a = 10; int b = 12; cba_expect_ne_int(a,b); cba_expect_eq_int(a+2, b); // with some unknown value cba_expect_ne_int(a+argc,b+argc); cba_expect_eq_int(a+2+argc, b+argc); // including function calls cba_expect_eq_int(a,min(a,b)); cba_expect_eq_int(b,max(a,b)); // even more tricky cba_expect_eq_int(a+argc,min(a+argc,b+argc)); // and after an update a = 14; cba_expect_eq_int(b+argc,min(a+argc,b+argc)); return 0; }
int main(int argc, char** argv) { // two values int a = 12; int b = 14; cba_expect_eq_int(26, sum(a,b)); // test a function pointer int (*f)(int,int); f = ∑ cba_expect_eq_int(3, f(1,2)); f = &diff; cba_expect_eq_int(1, f(3,2)); }
int main(int argc, char** argv) { cba_print_code(); // create an image Image i = create_image(20,40); cba_print_int(i.data); i.data[2][4] = 5; cba_print_int(i.data); cba_print_int(i.data[2]); cba_print_int(i.data[2][4]); cba_expect_eq_int(i.data[2][4], 5); cba_dump_equations(); return 0; }
int main(int argc, char** argv) { // check the proper handling of the global initialization cba_expect_eq_int(g,10); cba_expect_eq_int(p,3); // but they can be changed g++; cba_expect_eq_int(g,11); cba_expect_eq_int(p,3); p--; cba_expect_eq_int(g,11); cba_expect_eq_int(p,2); // cba_dump_solution(); // cba_print_code(); // cba_dump_json(); return 0; }
int main(int argc, char** argv) { // simple stuff point a = { 10, 12 }; point* b = &a; cba_expect_eq_int(a.x, 10); cba_expect_eq_int(a.y, 12); cba_expect_eq_int(b->x, 10); cba_expect_eq_int(b->y, 12); a.x = a.x + a.y * 2; cba_expect_eq_int(a.x, 34); cba_expect_eq_int(a.y, 12); cba_expect_eq_int(b->x, 34); cba_expect_eq_int(b->y, 12); b->y = argc; cba_expect_eq_int(a.x, 34); cba_expect_eq_int(a.y, argc); cba_expect_eq_int(b->x, 34); cba_expect_eq_int(b->y, argc); }