mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
29 lines
704 B
Haskell
29 lines
704 B
Haskell
module ClayTests (tests) where
|
|
|
|
import Urbit.Noun.Conversions
|
|
import Urbit.Prelude
|
|
|
|
import Test.QuickCheck hiding ((.&.))
|
|
import Test.Tasty
|
|
import Test.Tasty.QuickCheck
|
|
import Test.Tasty.TH
|
|
|
|
instance Arbitrary Knot where
|
|
arbitrary = (MkKnot . pack) <$> sublistOf ['a'..'z']
|
|
|
|
nonEmptyList :: (Arbitrary a) => Gen [a]
|
|
nonEmptyList = sized $ \n ->
|
|
do k <- choose (1, max 1 n)
|
|
vector k
|
|
|
|
instance Arbitrary Path where
|
|
arbitrary = Path <$> nonEmptyList
|
|
|
|
testPathRoundTrip :: Path -> Property
|
|
testPathRoundTrip p =
|
|
classify (1 == (length $ unPath p)) "singleton" $
|
|
(filePathToPath (pathToFilePath p)) === p
|
|
|
|
tests = testGroup "Clay"
|
|
[ testProperty "Path round trip" $ testPathRoundTrip ]
|