diff options
Diffstat (limited to 'stdlib/source/test/lux/data/number.lux')
-rw-r--r-- | stdlib/source/test/lux/data/number.lux | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/stdlib/source/test/lux/data/number.lux b/stdlib/source/test/lux/data/number.lux deleted file mode 100644 index d8e769369..000000000 --- a/stdlib/source/test/lux/data/number.lux +++ /dev/null @@ -1,110 +0,0 @@ -(.module: - [lux #* - ["_" test (#+ Test)] - [control - ["." try]] - [data - ["." text - ["%" format (#+ format)]] - [number - ["n" nat] - ["i" int] - ["r" rev] - ["f" frac]]]] - {1 - ["." /]} - ["." / #_ - ["#." i8] - ["#." i16] - ["#." i32] - ["#." i64] - ["#." nat] - ["#." int] - ["#." rev] - ["#." frac] - ["#." ratio] - ["#." complex]]) - -(def: clean_commas - (-> Text Text) - (text.replace_all "," "")) - -(def: #export test - Test - (<| (_.covering /._) - ($_ _.and - (_.cover [/.bin] - (`` (and (~~ (template [<=> <codec> <number>] - [(case (\ <codec> decode (..clean_commas <number>)) - (#try.Success actual) - (<=> (/.bin <number>) actual) - - (#try.Failure error) - false)] - - [n.= n.binary "11001001"] - [n.= n.binary "11,00,10,01"] - - [i.= i.binary "+11001001"] - [i.= i.binary "-11,00,10,01"] - - [r.= r.binary ".11001001"] - [r.= r.binary ".11,00,10,01"] - - [f.= f.binary "+1100.1001"] - [f.= f.binary "-11,00.10,01"] - ))))) - (_.cover [/.oct] - (`` (and (~~ (template [<=> <codec> <number>] - [(case (\ <codec> decode (..clean_commas <number>)) - (#try.Success actual) - (<=> (/.oct <number>) actual) - - (#try.Failure error) - false)] - - [n.= n.octal "615243"] - [n.= n.octal "615,243"] - - [i.= i.octal "+615243"] - [i.= i.octal "-615,243"] - - [r.= r.octal ".615243"] - [r.= r.octal ".615,243"] - - [f.= f.octal "+6152.43"] - [f.= f.octal "-61,52.43"] - ))))) - (_.cover [/.hex] - (`` (and (~~ (template [<=> <codec> <number>] - [(case (\ <codec> decode (..clean_commas <number>)) - (#try.Success actual) - (<=> (/.hex <number>) actual) - - (#try.Failure error) - false)] - - [n.= n.hex "deadBEEF"] - [n.= n.hex "dead,BEEF"] - - [i.= i.hex "+deadBEEF"] - [i.= i.hex "-dead,BEEF"] - - [r.= r.hex ".deadBEEF"] - [r.= r.hex ".dead,BEEF"] - - [f.= f.hex "+dead.BEEF"] - [f.= f.hex "-dead,BE.EF"] - ))))) - - /i8.test - /i16.test - /i32.test - /i64.test - /nat.test - /int.test - /rev.test - /frac.test - /ratio.test - /complex.test - ))) |