diff options
author | Eduardo Julian | 2017-05-03 19:53:32 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-05-03 19:53:32 -0400 |
commit | 0decfd4edd7483f2bb8d5bb489af5a74f1bf097a (patch) | |
tree | 8b8f7e4bf59e44be6a5518b8041f722bd2123487 /stdlib/test | |
parent | c907d178d89dde5ad03b799b973b4ad0d360ffe3 (diff) |
- Small refactorings.
- Added the width of bit-patterns.
Diffstat (limited to 'stdlib/test')
-rw-r--r-- | stdlib/test/test/lux/data/bit.lux | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/stdlib/test/test/lux/data/bit.lux b/stdlib/test/test/lux/data/bit.lux index 2ba2c8e57..fe04806cd 100644 --- a/stdlib/test/test/lux/data/bit.lux +++ b/stdlib/test/test/lux/data/bit.lux @@ -7,11 +7,9 @@ ["R" math/random]) lux/test) -(def: width Nat +64) - (test: "Bitwise operations." [pattern R;nat - idx (:: @ map (n.% width) R;nat)] + idx (:: @ map (n.% &;width) R;nat)] ($_ seq (assert "Clearing and settings bits should alter the count." (and (n.< (&;count (&;set idx pattern)) @@ -31,7 +29,7 @@ (and (not (&;set? idx pattern)) (&;set? idx (&;flip idx pattern)))))) (assert "The negation of a bit pattern should have a complementary bit count." - (n.= width + (n.= &;width (n.+ (&;count pattern) (&;count (&;not pattern))))) (assert "Can do simple binary boolean logic." @@ -58,10 +56,10 @@ (n.= pattern)))) (assert "Rotate as many spaces as the bit-pattern's width leaves the pattern unchanged." (and (|> pattern - (&;rotate-left width) + (&;rotate-left &;width) (n.= pattern)) (|> pattern - (&;rotate-right width) + (&;rotate-right &;width) (n.= pattern)))) (assert "Shift right respect the sign of ints." (let [value (nat-to-int pattern)] |