-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMain.hs
More file actions
29 lines (25 loc) · 1.07 KB
/
Main.hs
File metadata and controls
29 lines (25 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import Data.API.API
import Data.API.API.Gen
import Data.API.Test.JSON
import Data.API.Test.Migration
import Data.API.Test.Time
import Data.API.Test.UnionMigration
import Test.Tasty
import Test.Tasty.QuickCheck
main :: IO ()
main = defaultMain tests
tests :: TestTree
tests = testGroup "api-tools" [ migrationTests
, unionMigrationTests
, jsonTests
, timeTests
, testProperty "Convert/unconvert" convertUncovertTest
]
-- | Test that converting an 'API' into a self-hosted 'APISpec' and
-- back does not change it. We have 'Arbitrary' instances only for
-- 'APISpec', but we compare 'API' because it is slightly more precise
-- (e.g. 'APISpec' contains bogus read-only fields for unions).
convertUncovertTest :: APISpec -> Bool
convertUncovertTest api = unconvertAPI (convertAPI unconverted_api) == unconverted_api
where
unconverted_api = unconvertAPI api