X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdlib%2Fdiv.c;fp=functions%2Fstdlib%2Fdiv.c;h=3e32638e11ee09608a56b5ce7f7619992f57d52e;hp=bf82beda56bf295b9246f16b6af1fc2520886ab3;hb=d02f38605b53cdff5460cc6b9e1b2a80c3a2ba4c;hpb=3f6094115e79a45413f08361b68b71eb08da306e diff --git a/functions/stdlib/div.c b/functions/stdlib/div.c index bf82bed..3e32638 100644 --- a/functions/stdlib/div.c +++ b/functions/stdlib/div.c @@ -30,18 +30,17 @@ div_t div( int numer, int denom ) #include <_PDCLIB_config.h> #endif -int main() +int main( void ) { - div_t idiv; - BEGIN_TESTS; - idiv = div( 5, 2 ); - TESTCASE( idiv.quot == 2 && idiv.rem == 1 ); - idiv = div( -5, 2 ); - TESTCASE( idiv.quot == -2 && idiv.rem == -1 ); - idiv = div( 5, -2 ); - TESTCASE( idiv.quot == -2 && idiv.rem == 1 ); - TESTCASE( sizeof( idiv.quot ) == _PDCLIB_INT_BYTES ); - TESTCASE( sizeof( idiv.rem ) == _PDCLIB_INT_BYTES ); + div_t result; + result = div( 5, 2 ); + TESTCASE( result.quot == 2 && result.rem == 1 ); + result = div( -5, 2 ); + TESTCASE( result.quot == -2 && result.rem == -1 ); + result = div( 5, -2 ); + TESTCASE( result.quot == -2 && result.rem == 1 ); + TESTCASE( sizeof( result.quot ) == _PDCLIB_INT_BYTES ); + TESTCASE( sizeof( result.rem ) == _PDCLIB_INT_BYTES ); return TEST_RESULTS; }