Skip to content

Commit

Permalink
Adopted an extra test from the Scala port
Browse files Browse the repository at this point in the history
  • Loading branch information
fosskers committed Jul 25, 2016
1 parent acc802f commit ccdb1a3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/Test.hs
Expand Up @@ -63,8 +63,9 @@ suite op ls pl rd = testGroup "Unit Tests"
, testCase "[Word32] <-> [Command]" commandIso
, testCase "[Word32] <-> V.Vector Point" pointIso
, testCase "[Word32] <-> V.Vector LineString" linestringIso
, testCase "[Word32] <-> V.Vector Polygon (2 ex)" polygonIso
, testCase "[Word32] <-> V.Vector Polygon (1 ex, 1 in)" polygonIso2
, testCase "[Word32] <-> V.Vector Polygon (2 solid)" polygonIso
, testCase "[Word32] <-> V.Vector Polygon (1 holed)" polygonIso2
, testCase "[Word32] <-> V.Vector Polygon (1 holed, 1 solid)" polygonIso3
]
]

Expand Down Expand Up @@ -224,18 +225,25 @@ linestringIso = cs' @?= cs
where cs = [9,4,4,18,6,4,5,4,9,4,4,18,6,4,5,4]
cs' = fromRight $ R.uncommands . R.toCommands <$> (R.commands cs >>= R.fromCommands @LineString)

-- | Two external rings
-- | Two solids
polygonIso :: Assertion
polygonIso = cs' @?= cs
where cs = [9,4,4,18,6,4,5,4,15,9,4,4,18,6,4,5,4,15]
cs' = fromRight $ R.uncommands . R.toCommands <$> (R.commands cs >>= R.fromCommands @Polygon)

-- | One external, one internal
-- | One holed
polygonIso2 :: Assertion
polygonIso2 = cs' @?= cs
where cs = [9,4,4,26,6,0,0,6,5,0,15,9,2,3,26,0,2,2,0,0,1,15]
cs' = fromRight $ R.uncommands . R.toCommands <$> (R.commands cs >>= R.fromCommands @Polygon)

-- | One Holed, one solid
polygonIso3 :: Assertion
polygonIso3 = cs' @?= cs
where cs = [ 9, 4, 4, 26, 6, 0, 0, 6, 5, 0, 15, 9, 2, 3, 26, 0, 2, 2, 0, 0, 1, 15
, 9, 4, 4, 26, 6, 0, 0, 6, 5, 0, 15 ]
cs' = fromRight $ R.uncommands . R.toCommands <$> (R.commands cs >>= R.fromCommands @Polygon)

{-}
foo :: FilePath -> IO (Either Text VectorTile)
foo bs = do
Expand Down

0 comments on commit ccdb1a3

Please sign in to comment.