f37d0f75c0
Implement ToJSON and FromJSON for all of the various pieces of the game state, and add a pair of functions saveGame/loadGame implementing a prism to save the game as zlib-compressed JSON. To test this, there's now Arbitrary, CoArbitrary, and Function instances for all the parts of the game state - to get around circular imports with the concrete entities this unfortunately is happening via orphan instances, plus an hs-boot file to break a circular import that was just a little too hard to remove by moving things around. Ugh.
19 lines
544 B
Haskell
19 lines
544 B
Haskell
module Test.Prelude
|
|
( module Xanthous.Prelude
|
|
, module Test.Tasty
|
|
, module Test.Tasty.HUnit
|
|
, module Test.Tasty.QuickCheck
|
|
, module Test.QuickCheck.Classes
|
|
, testBatch
|
|
) where
|
|
|
|
import Xanthous.Prelude hiding (assert, elements)
|
|
import Test.Tasty
|
|
import Test.Tasty.QuickCheck
|
|
import Test.Tasty.HUnit
|
|
import Test.QuickCheck.Classes
|
|
import Test.QuickCheck.Checkers (TestBatch)
|
|
import Test.QuickCheck.Instances.ByteString ()
|
|
|
|
testBatch :: TestBatch -> TestTree
|
|
testBatch (name, tests) = testGroup name $ uncurry testProperty <$> tests
|