aboutsummaryrefslogtreecommitdiff
path: root/src/test.c
diff options
context:
space:
mode:
authorLibravatar Comrade Martin Miroslavovich Michalec <martin@michalec.dev>2023-11-26 21:34:11 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-11-07 02:13:38 +0000
commit252df6c74c7be9b82aa89cdb4972f91c87b06184 (patch)
tree988497c67eb3d8d8789aa9bdea47bafd300e25b2 /src/test.c
downloadcoursework-252df6c74c7be9b82aa89cdb4972f91c87b06184.tar.gz
publishHEADmaster
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}