Skip to content

Commit

Permalink
[#500] Trails-tests: Add more test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-stacey committed Aug 19, 2019
1 parent f2cbcb4 commit 0c3a143
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion projects/trails/test/Mirza/Trails/Tests/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,31 @@ clientSpec = do
-- * :
-- \--*---*
-- Note: ':' Denotes matching eventId (but otherwise distinct trail entries).

let buildCommonEventIdJoinedStart = do
root <- buildEntry
topNext <- joinEntries (trailEntrySignature root) <$> buildSingleEntryTrail
bottomNext <- updateFirstEventId (trailEntryEventID $ head topNext) <$> (joinEntries (trailEntrySignature root) <$> buildSingleEntryTrail)
topBoth <- addNextEntry $ topNext
bottomBoth <- addNextEntry $ bottomNext
pure $ bottomBoth <> topBoth <> [root]
commonEventIdJoinedStart <- buildCommonEventIdJoinedStart
--traceM $ prettyTrail commonEventIdJoinedStart
checkTrailWithContext "Common EventId Joined Start Trail" commonEventIdJoinedStart

-- Trail: /--*--\
-- * : *
-- \--*--/
-- Note: ':' Denotes matching eventId (but otherwise distinct trail entries).
let buildCommonEventIdJoinedStartEnd = do
root <- buildEntry
topNext <- joinEntries (trailEntrySignature root) <$> buildSingleEntryTrail
bottomNext <- updateFirstEventId (trailEntryEventID $ head topNext) <$> (joinEntries (trailEntrySignature root) <$> buildSingleEntryTrail)
topEnd <- joinEntries (trailEntrySignature $ head bottomNext) <$> (addNextEntry $ topNext)
pure $ topEnd <> bottomNext <> [root]
commonEventIdJoinedStartEnd <- buildCommonEventIdJoinedStartEnd
--traceM $ prettyTrail commonEventIdJoinedStartEnd
checkTrailWithContext "Common EventId Joined Start and End of Trail" commonEventIdJoinedStartEnd



-- Test that invalid signature fails.
Expand Down

0 comments on commit 0c3a143

Please sign in to comment.