aboutsummaryrefslogtreecommitdiff
path: root/src/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test.c')
-rw-r--r--src/test.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test.c b/src/test.c
new file mode 100644
index 0000000..77ae5fb
--- /dev/null
+++ b/src/test.c
@@ -0,0 +1,30 @@
1#include <stdlib.h>
2#include "utils.h"
3#include "arith.h"
4
5void ops_test (void);
6
7void
8print_number (u32 num)
9{
10 char sign = num & MASK_NEG ? '-' : ' ';
11 num &= ~MASK_FLAGS;
12 u8 offset;
13 for (offset = 7*BPD; offset; offset -= BPD) {
14 if (num >> offset & DIGIT_MASK)
15 break;
16 putchar (' ');
17 }
18 printf ("%c", sign);
19 for (; offset; offset -= BPD)
20 printf ("%c", I2C (num >> offset & DIGIT_MASK));
21 printf ("%c\n", I2C (num & DIGIT_MASK));
22}
23
24int
25main (void)
26{
27 ops_test ();
28
29 return EXIT_SUCCESS;
30}