aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-02-13 00:49:04 -0500
committerGraydon Hoare <[email protected]>2011-02-14 08:31:52 -0800
commit0ebfb8227c190609e80af3fb52b9813c4b282cc0 (patch)
treec5cbe15ad6f58065d2d344d1fde83728c050a2d8 /src/test
parentAdd missing case to unify. This gets hello world to codegen. (diff)
downloadrust-0ebfb8227c190609e80af3fb52b9813c4b282cc0.tar.xz
rust-0ebfb8227c190609e80af3fb52b9813c4b282cc0.zip
Add support for unsigned binops. Closes #57
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/arith-unsigned.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/run-pass/arith-unsigned.rs b/src/test/run-pass/arith-unsigned.rs
new file mode 100644
index 00000000..3fac3714
--- /dev/null
+++ b/src/test/run-pass/arith-unsigned.rs
@@ -0,0 +1,24 @@
+// Unsigned integer operations
+
+fn main() {
+ check (0u8 < 255u8);
+ check (0u8 <= 255u8);
+ check (255u8 > 0u8);
+ check (255u8 >= 0u8);
+ check (250u8 / 10u8 == 25u8);
+ check (255u8 % 10u8 == 5u8);
+ check (0u16 < 60000u16);
+ check (0u16 <= 60000u16);
+ check (60000u16 > 0u16);
+ check (60000u16 >= 0u16);
+ check (60000u16 / 10u16 == 6000u16);
+ check (60005u16 % 10u16 == 5u16);
+ check (0u32 < 4000000000u32);
+ check (0u32 <= 4000000000u32);
+ check (4000000000u32 > 0u32);
+ check (4000000000u32 >= 0u32);
+ check (4000000000u32 / 10u32 == 400000000u32);
+ check (4000000005u32 % 10u32 == 5u32);
+
+ // 64-bit numbers have some flakiness yet. Not tested
+}