urbit-hob

Haskell utilities for phonemic base wrangling.
git clone git://git.jtobin.io/urbit-hob.git
Log | Files | Refs | README | LICENSE

Unit.hs (944B)


      1 
      2 module Ob.Tests.Unit (
      3   tests
      4   ) where
      5 
      6 import Data.Word (Word32)
      7 import Test.Hspec
      8 import qualified Urbit.Ob.Ob as Ob
      9 
     10 tests :: Spec
     11 tests = do
     12   describe "fein" $
     13     it "matches reference values" $ do
     14       Ob.fein 123456789 `shouldBe` (1897766331 :: Int)
     15       Ob.fein 15663360 `shouldBe` (1208402137 :: Int)
     16       Ob.fein 0x10000000000000000 `shouldBe` (0x10000000000000000 :: Integer)
     17 
     18   describe "fynd" $
     19     it "matches reference values" $ do
     20       Ob.fynd 1208402137 `shouldBe` (15663360 :: Int)
     21       Ob.fynd 1897766331 `shouldBe` (123456789 :: Int)
     22       Ob.fynd 0x10000000000000000 `shouldBe` (0x10000000000000000 :: Integer)
     23 
     24   describe "feis" $
     25     it "matches reference values" $ do
     26       Ob.feis 123456789 `shouldBe` 2060458291
     27       Ob.feis 15663360 `shouldBe` 1195593620
     28 
     29   describe "tail" $
     30     it "matches reference values" $ do
     31       Ob.tail 123456789 `shouldBe` 1107963580
     32       Ob.tail 1195593620 `shouldBe` 15663360
     33