urbit-hob

Haskell utilities for phonetic base wrangling.
Log | Files | Refs | README | LICENSE

commit 62b5179313302a77052a6cda42881983c2a6abf0
parent 1f9978c336c20ecb6398818c09c80687da591fc9
Author: Jared Tobin <jared@jtobin.io>
Date:   Tue, 17 Sep 2019 09:40:44 -0230

tests: add 64 and 128 bit unit tests for Co

Diffstat:
Mtest/Co/Tests/Unit.hs | 20+++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/test/Co/Tests/Unit.hs b/test/Co/Tests/Unit.hs @@ -10,7 +10,7 @@ import qualified Urbit.Ob.Co as Co tests :: Spec tests = - describe "render" $ + describe "render" $ do it "matches 32-bit reference values" $ do Co.render (Co.patp 0) `shouldBe` "~zod" Co.render (Co.patp 255) `shouldBe` "~fes" @@ -20,3 +20,21 @@ tests = Co.render (Co.patp 15663360) `shouldBe` "~nidsut-tomdun" Co.render (Co.patp 0xFFFFFFFF) `shouldBe` "~dostec-risfen" + it "matches 64-bit reference values" $ do + let big_64_01 = 0x0000000100000000 + Co.render (Co.patp big_64_01) `shouldBe` "~doznec-dozzod-dozzod" + + let big_64_02 = 0xFFFFFFFFFFFFFFFF + Co.render (Co.patp big_64_02) `shouldBe` "~fipfes-fipfes-dostec-risfen" + + it "matches 128-bit reference values" $ do + let big_128_01 = 0x00000000000000010000000000000000 + patp_128_01 = "~doznec--fipfes-fipfes-fipfes-fipfes" + Co.render (Co.patp big_128_01) `shouldBe` patp_128_01 + + let big_128_02 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + patp_128_02 = + "~fipfes-fipfes-fipfes-fipfes--fipfes-fipfes-fipfes-fipfes" + + Co.render (Co.patp big_128_02) `shouldBe` patp_128_02 +