// S : tags kleetodo libc c // S : expect --result valid // S : cc -o test.bc -D_PDCLIB_BUILD -DTEST $file // S : verify -o nofail:malloc -o nofail:vfs test.bc #include #include "_PDCLIB_test.h" int main( void ) { imaxdiv_t result; result = imaxdiv( (intmax_t)5, (intmax_t)2 ); TESTCASE( result.quot == 2 && result.rem == 1 ); result = imaxdiv( (intmax_t)-5, (intmax_t)2 ); TESTCASE( result.quot == -2 && result.rem == -1 ); result = imaxdiv( (intmax_t)5, (intmax_t)-2 ); TESTCASE( result.quot == -2 && result.rem == 1 ); TESTCASE( sizeof( result.quot ) == sizeof( intmax_t ) ); TESTCASE( sizeof( result.rem ) == sizeof( intmax_t ) ); return TEST_RESULTS; }