mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +03:00
31 lines
683 B
Haskell
31 lines
683 B
Haskell
|
module NounConversionTests (tests) where
|
||
|
|
||
|
import Noun.Conversions
|
||
|
import UrbitPrelude
|
||
|
|
||
|
import Test.QuickCheck hiding ((.&.))
|
||
|
import Test.Tasty
|
||
|
import Test.Tasty.QuickCheck
|
||
|
import Test.Tasty.TH
|
||
|
|
||
|
instance Arbitrary UV where
|
||
|
arbitrary = UV <$> arbitrarySizedNatural
|
||
|
|
||
|
instance Arbitrary UW where
|
||
|
arbitrary = UW <$> arbitrarySizedNatural
|
||
|
|
||
|
|
||
|
vRoundTrip :: UV -> Bool
|
||
|
vRoundTrip uv = Just uv == (fromNoun $ toNoun $ uv)
|
||
|
|
||
|
wRoundTrip :: UW -> Bool
|
||
|
wRoundTrip uw = Just uw == (fromNoun $ toNoun uw)
|
||
|
|
||
|
|
||
|
tests :: TestTree
|
||
|
tests =
|
||
|
testGroup "Noun"
|
||
|
[ testProperty "0v0 printing/parsing round trip" $ vRoundTrip
|
||
|
, testProperty "0w0 printing/parsing round trip" $ wRoundTrip
|
||
|
]
|