aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/binary.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/data/binary.lux')
-rw-r--r--stdlib/source/test/lux/data/binary.lux24
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux
index 4b1ff0c54..9889fa0ae 100644
--- a/stdlib/source/test/lux/data/binary.lux
+++ b/stdlib/source/test/lux/data/binary.lux
@@ -13,7 +13,7 @@
[data
[number
["." i64]
- ["." nat]]
+ ["n" nat]]
[collection
["." list]]]]
{1
@@ -32,7 +32,7 @@
(-> Nat (Random Binary))
(let [output (/.create size)]
(loop [idx 0]
- (if (n/< size idx)
+ (if (n.< size idx)
(do r.monad
[byte r.nat]
(exec (try.assume (/.write/8 idx byte output))
@@ -44,29 +44,29 @@
(let [binary (/.create bytes)
cap (case bytes
8 (dec 0)
- _ (|> 1 (i64.left-shift (n/* 8 bytes)) dec))
+ _ (|> 1 (i64.left-shift (n.* 8 bytes)) dec))
capped-value (i64.and cap value)]
(succeed
(do try.monad
[_ (write 0 value binary)
output (read 0 binary)]
- (wrap (n/= capped-value output))))))
+ (wrap (n.= capped-value output))))))
(def: #export test
Test
(<| (_.context (%.name (name-of /._)))
(do r.monad
- [#let [gen-size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 8))))]
+ [#let [gen-size (|> r.nat (:: @ map (|>> (n.% 100) (n.max 8))))]
binary-size gen-size
random-binary (binary binary-size)
value r.nat
- #let [gen-idx (|> r.nat (:: @ map (n/% binary-size)))]
+ #let [gen-idx (|> r.nat (:: @ map (n.% binary-size)))]
[from to] (r.and gen-idx gen-idx)
- #let [[from to] [(n/min from to) (n/max from to)]]]
+ #let [[from to] [(n.min from to) (n.max from to)]]]
($_ _.and
($equivalence.spec /.equivalence (binary binary-size))
(_.test "Can get size of binary."
- (|> random-binary /.size (n/= binary-size)))
+ (|> random-binary /.size (n.= binary-size)))
(_.test "Can read/write 8-bit values."
(bits-io 1 /.read/8 /.write/8 value))
(_.test "Can read/write 16-bit values."
@@ -76,15 +76,15 @@
(_.test "Can read/write 64-bit values."
(bits-io 8 /.read/64 /.write/64 value))
(_.test "Can slice binaries."
- (let [slice-size (|> to (n/- from) inc)
+ (let [slice-size (|> to (n.- from) inc)
random-slice (try.assume (/.slice from to random-binary))
idxs (list.n/range 0 (dec slice-size))
reader (function (_ binary idx) (/.read/8 idx binary))]
- (and (n/= slice-size (/.size random-slice))
+ (and (n.= slice-size (/.size random-slice))
(case [(monad.map try.monad (reader random-slice) idxs)
- (monad.map try.monad (|>> (n/+ from) (reader random-binary)) idxs)]
+ (monad.map try.monad (|>> (n.+ from) (reader random-binary)) idxs)]
[(#try.Success slice-vals) (#try.Success binary-vals)]
- (:: (list.equivalence nat.equivalence) = slice-vals binary-vals)
+ (:: (list.equivalence n.equivalence) = slice-vals binary-vals)
_
#0))))