aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/types.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/types.c b/tests/types.c
new file mode 100644
index 0000000..4320e8d
--- /dev/null
+++ b/tests/types.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include "../include/rstypes.h"
+
+i32 main() {
+ u8 a = 215;
+ i8 b = -127;
+ u16 c = 65535;
+ i16 d = -32000;
+ u32 e = 0xFFFFFFF;
+ i32 f = -1;
+ u64 g = 0xFAFAFAFAFAFAFAFA;
+ i64 h = -4000000000000000000;
+ u128 i = 0xFFFFFFFFFFFFFFFF;
+ i128 j = 0;
+ i <<= 64; i |= 0xFFFFFFFFFFFFFFFF;
+ j = i;
+
+ f32 k = 5e-23;
+ f64 l = -2e300;
+ f128 m = 3e300;
+ m *= 1e100;
+
+ printf( "a: %hhu, b: %hhi\n"
+ "c: %hu, d: %hi\n"
+ "e: %u, f: %d\n"
+ "g: %lu, h: %li\n",
+ a, b, c, d, e, f, g, h);
+ printf("i: %lX%.16lX, jL %lx%.16lx\n",
+ (unsigned long) (i >> 64), (unsigned long) i,
+ (long) (j >> 64), (long) j );
+
+ printf("k: %.2E\nl: %.2lE\nm: %.2LE\n", k, l, m);
+
+ return (j == -1 && i+1 == 0 ? 0 : 1);
+}