@@ -3,22 +3,19 @@ module Test.Main where
33import Prelude
44
55import Control.Monad.Eff (Eff )
6+ import Control.Monad.Eff.Console (CONSOLE )
67import Control.Monad.Eff.Exception (EXCEPTION )
78import Control.Monad.Eff.Random (RANDOM )
8- import Control.Monad.Eff.Console (CONSOLE )
9-
109import Data.Either as E
11- import Data.Maybe (Maybe (..))
12- import Data.StrMap as SM
13- import Data.Tuple (Tuple (..))
1410import Data.Json.Extended (EJson , arbitraryEJsonOfSize , renderEJson , parseEJson , decodeEJson , encodeEJson )
1511import Data.Json.Extended as EJ
1612import Data.Json.Extended.Cursor as EJC
17-
18- import Test.StrongCheck ((<?>))
19- import Test.StrongCheck as SC
20- import Test.StrongCheck.Arbitrary as SCA
21-
13+ import Data.Maybe (Maybe (..))
14+ import Data.StrMap as SM
15+ import Data.Tuple (Tuple (..))
16+ import Test.QuickCheck ((<?>))
17+ import Test.QuickCheck as QC
18+ import Test.QuickCheck.Arbitrary as QCA
2219import Text.Parsing.Parser as P
2320
2421type TestEffects =
@@ -29,25 +26,25 @@ type TestEffects =
2926
3027newtype ArbEJson = ArbEJson EJson
3128
32- instance arbitraryArbEJson ∷ SCA .Arbitrary ArbEJson where
29+ instance arbitraryArbEJson ∷ QCA .Arbitrary ArbEJson where
3330 arbitrary = map ArbEJson $ arbitraryEJsonOfSize 3
3431
3532testJsonSerialization ∷ Eff TestEffects Unit
3633testJsonSerialization =
37- SC .quickCheck' 1000 \(ArbEJson x) → case decodeEJson (encodeEJson x) of
34+ QC .quickCheck' 1000 \(ArbEJson x) → case decodeEJson (encodeEJson x) of
3835 E.Right y →
3936 x == y
4037 <?> " Mismatch:\n " <> renderEJson x <> " \n " <> renderEJson y
4138 E.Left err →
42- SC .Failed $ " Parse error: " <> err
39+ QC .Failed $ " Parse error: " <> err
4340
4441testRenderParse ∷ Eff TestEffects Unit
4542testRenderParse =
46- SC .quickCheck' 1000 \(ArbEJson x) → case P .runParser (renderEJson x) parseEJson of
43+ QC .quickCheck' 1000 \(ArbEJson x) → case P .runParser (renderEJson x) parseEJson of
4744 E.Right y →
4845 x == y <?> " Mismatch:\n " <> renderEJson x <> " \n " <> renderEJson y
4946 E.Left err →
50- SC .Failed $ " Parse error: " <> show err <> " when parsing:\n\n " <> renderEJson x <> " \n\n "
47+ QC .Failed $ " Parse error: " <> show err <> " when parsing:\n\n " <> renderEJson x <> " \n\n "
5148
5249testCursorExamples ∷ Eff TestEffects Unit
5350testCursorExamples = do
@@ -104,16 +101,16 @@ testCursorExamples = do
104101 → Maybe (Tuple EJC.Cursor EJC.Cursor )
105102 → Eff TestEffects Unit
106103 assertMbTplEq x y =
107- SC .assert
108- $ SC .assertEq
104+ QC .quickCheck' 1 $
105+ QC .assertEquals
109106 (map (\(Tuple a b) → " Tuple " <> EJC .renderEJsonCursor a <> " " <> EJC .renderEJsonCursor b) x)
110107 (map (\(Tuple a b) → " Tuple " <> EJC .renderEJsonCursor a <> " " <> EJC .renderEJsonCursor b) y)
111108
112109 assertMbEq ∷ Maybe EJson → Maybe EJson → Eff TestEffects Unit
113- assertMbEq x y = SC .assert $ SC .assertEq (map renderEJson x) (map renderEJson y)
110+ assertMbEq x y = QC .quickCheck' 1 $ QC .assertEquals (map renderEJson x) (map renderEJson y)
114111
115112 assertEq ∷ EJson → EJson → Eff TestEffects Unit
116- assertEq x y = SC .assert $ x == y <?> msg
113+ assertEq x y = QC .quickCheck' 1 $ x == y <?> msg
117114 where
118115 msg = renderEJson x <> " /= " <> renderEJson y
119116
0 commit comments