From 4024d7f87d77fe9e1686fc3ebe021fd07ddd13bb Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 5 Apr 2017 18:53:59 -0400 Subject: - 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. --- stdlib/test/test/lux/data/number.lux | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'stdlib/test') 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 @@ -109,25 +109,6 @@ ["Deg/Max" R;deg Number Order Max@Monoid (d.% .125) (lambda [_] true)] ) -(do-template [ ] - [(test: (format "[" "] " "Codec") - [x ] - (assert "Can encode/decode values." - (|> x - (:: encode) - (:: decode) - (case> (#;Right x') - (:: = x x') - - (#;Left _) - false))))] - - ["Nat" R;nat Eq Codec] - ["Int" R;int Eq Codec] - ["Real" R;real Eq Codec] - ["Deg" R;deg Eq Codec] - ) - (do-template [ ] [(test: (format "[" "] " "Alternative formats") [x ] @@ -143,5 +124,15 @@ ["Nat/Binary" R;nat Eq Binary@Codec] ["Nat/Octal" R;nat Eq Octal@Codec] + ["Nat" R;nat Eq Codec] ["Nat/Hex" R;nat Eq Hex@Codec] + + ["Int/Binary" R;int Eq Binary@Codec] + ["Int/Octal" R;int Eq Octal@Codec] + ["Int" R;int Eq Codec] + ["Int/Hex" R;int Eq Hex@Codec] + + ["Deg" R;deg Eq Codec] + + ["Real" R;real Eq Codec] ) -- cgit v1.2.3