diff options
author | Eduardo Julian | 2017-04-05 18:53:59 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-04-05 18:53:59 -0400 |
commit | 4024d7f87d77fe9e1686fc3ebe021fd07ddd13bb (patch) | |
tree | ca32fa9dcec7d8a04ba0841ea591d1e53986c81a /stdlib/test | |
parent | adf8aeaa2a52760e294e08618e7aca5fc371fc0f (diff) |
- Added binary, octal and hexadecimal codecs for ints.
- Generalized the bin, oct and hex macros so they also work with ints (in the future, they will also work with degs and reals).
- Binary, octal and hexadecimal nats now have a + sign in front, like normal nats.
Diffstat (limited to 'stdlib/test')
-rw-r--r-- | stdlib/test/test/lux/data/number.lux | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index eefbd584b..8e959cf6f 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -110,25 +110,6 @@ ) (do-template [<category> <rand-gen> <Eq> <Codec>] - [(test: (format "[" <category> "] " "Codec") - [x <rand-gen>] - (assert "Can encode/decode values." - (|> x - (:: <Codec> encode) - (:: <Codec> decode) - (case> (#;Right x') - (:: <Eq> = x x') - - (#;Left _) - false))))] - - ["Nat" R;nat Eq<Nat> Codec<Text,Nat>] - ["Int" R;int Eq<Int> Codec<Text,Int>] - ["Real" R;real Eq<Real> Codec<Text,Real>] - ["Deg" R;deg Eq<Deg> Codec<Text,Deg>] - ) - -(do-template [<category> <rand-gen> <Eq> <Codec>] [(test: (format "[" <category> "] " "Alternative formats") [x <rand-gen>] (assert "Can encode/decode values." @@ -143,5 +124,15 @@ ["Nat/Binary" R;nat Eq<Nat> Binary@Codec<Text,Nat>] ["Nat/Octal" R;nat Eq<Nat> Octal@Codec<Text,Nat>] + ["Nat" R;nat Eq<Nat> Codec<Text,Nat>] ["Nat/Hex" R;nat Eq<Nat> Hex@Codec<Text,Nat>] + + ["Int/Binary" R;int Eq<Int> Binary@Codec<Text,Int>] + ["Int/Octal" R;int Eq<Int> Octal@Codec<Text,Int>] + ["Int" R;int Eq<Int> Codec<Text,Int>] + ["Int/Hex" R;int Eq<Int> Hex@Codec<Text,Int>] + + ["Deg" R;deg Eq<Deg> Codec<Text,Deg>] + + ["Real" R;real Eq<Real> Codec<Text,Real>] ) |