aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-12-11 16:30:01 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-12-11 16:30:01 -0500
commit9b17c0ff7fa7a3981697f4239afb5c66c609cd42 (patch)
tree96c2ae36609632900b8342387b181cecec31a6e1 /test
parent3429639e848a9ffa9ff9fbd940d3fc2d348e10e7 (diff)
downloadzig-9b17c0ff7fa7a3981697f4239afb5c66c609cd42.tar.gz
zig-9b17c0ff7fa7a3981697f4239afb5c66c609cd42.zip
IR: implement intType builtin
and int type field access and fix compile time bool not
Diffstat (limited to 'test')
-rw-r--r--test/self_hosted2.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/self_hosted2.zig b/test/self_hosted2.zig
index 8f80e07f1c..83665f6d27 100644
--- a/test/self_hosted2.zig
+++ b/test/self_hosted2.zig
@@ -299,6 +299,35 @@ fn testTruncate(x: u32) -> u8 {
@truncate(u8, x)
}
+fn intTypeBuiltin() {
+ assert(@intType(true, 8) == i8);
+ assert(@intType(true, 16) == i16);
+ assert(@intType(true, 32) == i32);
+ assert(@intType(true, 64) == i64);
+
+ assert(@intType(false, 8) == u8);
+ assert(@intType(false, 16) == u16);
+ assert(@intType(false, 32) == u32);
+ assert(@intType(false, 64) == u64);
+
+ assert(i8.bit_count == 8);
+ assert(i16.bit_count == 16);
+ assert(i32.bit_count == 32);
+ assert(i64.bit_count == 64);
+
+ assert(i8.is_signed);
+ assert(i16.is_signed);
+ assert(i32.is_signed);
+ assert(i64.is_signed);
+ assert(isize.is_signed);
+
+ assert(!u8.is_signed);
+ assert(!u16.is_signed);
+ assert(!u32.is_signed);
+ assert(!u64.is_signed);
+ assert(!usize.is_signed);
+
+}
fn assert(ok: bool) {
if (!ok)
@@ -331,6 +360,7 @@ fn runAllTests() {
fence();
exactDivision();
truncate();
+ intTypeBuiltin();
}
export nakedcc fn _start() -> unreachable {