+-- * Groundhog database schema.
+mkPersist tsn_codegen_config [groundhog|
+- entity: Odds
+
+- entity: OddsCasino
+ dbName: odds_casinos
+ constructors:
+ - name: OddsCasino
+ uniques:
+ - name: unique_odds_casino
+ type: constraint
+ fields: [casino_client_id]
+
+- entity: OddsTeam
+ dbName: odds_teams
+ constructors:
+ - name: OddsTeam
+ uniques:
+ - name: unique_odds_team
+ type: constraint
+ fields: [db_team_id]
+
+
+- entity: OddsGame
+ dbName: odds_games
+ constructors:
+ - name: OddsGame
+ uniques:
+ - name: unique_odds_game
+ type: constraint
+ fields: [db_game_id]
+|]
+
+
+-- * Tasty Tests
+odds_tests :: TestTree
+odds_tests =
+ testGroup
+ "Odds tests"
+ [ test_pickle_of_unpickle_is_identity,
+ test_unpickle_succeeds ]
+
+
+-- | Warning, succeess of this test does not mean that unpickling
+-- succeeded.
+test_pickle_of_unpickle_is_identity :: TestTree
+test_pickle_of_unpickle_is_identity =
+ testCase "pickle composed with unpickle is the identity" $ do
+ let path = "test/xml/Odds_XML.xml"
+ (expected :: [Message], actual) <- pickle_unpickle "message" path
+ actual @?= expected
+
+
+test_unpickle_succeeds :: TestTree
+test_unpickle_succeeds =
+ testCase "unpickling succeeds" $ do
+ let path = "test/xml/Odds_XML.xml"
+ actual <- unpickleable path pickle_message
+ let expected = True
+ actual @?= expected