diff options
Diffstat (limited to 'stdlib/test')
-rw-r--r-- | stdlib/test/test/lux/data/number.lux | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index 3b4ba4909..378731fbf 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -142,3 +142,10 @@ ["Real/Decimal" R;real Eq<Real> Codec<Text,Real>] ["Real/Hex" R;real Eq<Real> Hex@Codec<Text,Real>] ) + +(test: "Can convert real values to/from their bit patterns." + [raw R;real + factor (|> R;nat (:: @ map (|>. (n.% +1000) (n.max +1)))) + #let [sample (|> factor nat-to-int int-to-real (r.* raw))]] + (assert "Can convert real values to/from their bit patterns." + (|> sample real-to-bits bits-to-real (r.= sample)))) |