7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
15 div_t div( int numer, int denom )
18 rc.quot = numer / denom;
19 rc.rem = numer % denom;
20 /* TODO: pre-C99 compilers might require modulus corrections */
27 #include <_PDCLIB_test.h>
29 #ifndef _PDCLIB_CONFIG_H
30 #include <_PDCLIB_config.h>
38 TESTCASE( idiv.quot == 2 && idiv.rem == 1 );
40 TESTCASE( idiv.quot == -2 && idiv.rem == -1 );
42 TESTCASE( idiv.quot == -2 && idiv.rem == 1 );
43 TESTCASE( sizeof( idiv.quot ) == _PDCLIB_INT_BYTES );
44 TESTCASE( sizeof( idiv.rem ) == _PDCLIB_INT_BYTES );