Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

series: Make test cases more consistent #1048

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions exercises/practice/series/test/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ specs = do
]

it "slices of zero" $ do
slices 0 "" `shouldHaveSlices` [[]]
slices 0 "012" `shouldHaveSlices` [[],[],[],[]]
slices 0 "" `shouldHaveSlices` []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For series n xs, you would expect that length (series n xs) == min 0 (length xs - n + 1)

If n == 0 and length xs == 0, then length (series n xs) should be 0 - 0 + 1 == 1. This tells us that there is one way to make a series of length 0 from the empty series: the empty series. Therefore, the result should remain [[]] here.

slices 0 "012" `shouldHaveSlices` [[],[],[]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For series n xs, you would expect that length (series n xs) == min 0 (length xs - n + 1)

If n == 0 and length xs == 3, then length (series n xs) should be 3 - 0 + 1 == 4. Therefore, the result should remain [[],[],[],[]] here.


-- 88ebba640962f31187dc1ac2cd672044afba4b35