projects
/
fw
/
sdcc
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Commented the test cases
[fw/sdcc]
/
support
/
regression
/
tests
/
muldiv.c
1
/** Simple test for the mul/div/mod operations.
2
3
type: int
4
storage: , static
5
*/
6
#include <testfwk.h>
7
8
static void
9
testMul(void)
10
{
11
#if SDCC
12
// Disabled as the z80 port is broken
13
#else
14
volatile {storage} {type} i;
15
16
i = 5;
17
ASSERT(i*5 == 25);
18
ASSERT(i*-4 == -20);
19
20
i = -10;
21
ASSERT(i*12 == -120);
22
ASSERT(i*-3 == 30);
23
#endif
24
}
25
26
static void
27
testDiv(void)
28
{
29
#if SDCC
30
// Disabled as the z80 port is broken
31
#else
32
volatile {storage} {type} i;
33
34
i = 100;
35
ASSERT(i/5 == 20);
36
ASSERT(i/-4 == -25);
37
38
i = -50;
39
ASSERT(i/25 == -2);
40
ASSERT(i/-12 == 4);
41
#endif
42
}