mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-11-17 05:06:10 +00:00
6ead1d4caf
These are currently only run by the new DOIT3 test-running script. Note that these tests are designed to be applicable to most implementations of C95/C99/C11, not just ORCA/C. They do make certain assumptions not guaranteed by the standards (e.g. power of 2 types and some properties of IEEE-like FP), but in general those assumptions should be true for most 'normal' systems.
26 lines
479 B
C
26 lines
479 B
C
/*
|
|
* Test that integer division involving negative numbers follows C99 rules.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
if ((-7) / 3 != -2)
|
|
goto Fail;
|
|
|
|
if ((-7) % 3 != -1)
|
|
goto Fail;
|
|
|
|
if (7 / -3 != -2)
|
|
goto Fail;
|
|
|
|
if (7 % -3 != 1)
|
|
goto Fail;
|
|
|
|
printf ("Passed Conformance Test c99intdiv\n");
|
|
return 0;
|
|
|
|
Fail:
|
|
printf ("Failed Conformance Test c99intdiv\n");
|
|
}
|