int main(void) { plan_tests(3); ok1(some_test(5000, true)); ok1(some_test(1, true)); ok1(some_test(33, false)); return exit_status(); }
void main() { int i = 0; int x, y; if (i = ret_one()) i = 888; assert(i == 888); if (ret_one()) i = 2; assert(i == 2); if ( ! ret_one()) i = 3; assert(i == 2); x = 1; y = 2; if (ret_one() == x) y = 3; assert(y == 3); if (x == ret_one()) y = 4; assert(y == 4); x = -1; if ((x = ret_one()) == 1) y = 5; assert(y == 5); x = -1; y = -1; if (1 == (x = ret_one())) y = 5; assert(y == 5); /* /\* x = y = -1; // FBR: handled by memcad ??? NO !!!!!!! *\/ */ /* x = -1; */ /* y = -1; */ /* if ((x = ret_one()) == (y = ret_one())) */ /* y = 6; */ /* assert(y == 6); */ i = 2; i = ret_one2(); assert(i == 1); i = 2; i = ret_one3(); assert(i == 1); i = 3; // transform ReplaceFunCall imposes an evaluation order // from left to right (and warns about it) some_test(set(&i), reset(&i)); assert(i == 0); }
int main( ) { int rc = 0; int original_count = heap_count( ); try { if( !some_test( ) || !heap_ok( "t01" ) ) rc = 1; } catch( ... ) { std::cout << "Unexpected exception of unexpected type.\n"; rc = 1; } if( heap_count( ) != original_count ) { std::cout << "Possible memory leak!\n"; rc = 1; } return( rc ); }