Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions exercises/practice/perfect-numbers/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ description = "Abundant numbers -> Medium abundant number is classified correctl
[ec7792e6-8786-449c-b005-ce6dd89a772b]
description = "Abundant numbers -> Large abundant number is classified correctly"

[05f15b93-849c-45e9-9c7d-1ea131ef7d10]
description = "Abundant numbers -> Perfect square abundant number is classified correctly"

[e610fdc7-2b6e-43c3-a51c-b70fb37413ba]
description = "Deficient numbers -> Smallest prime deficient number is classified correctly"

Expand Down
9 changes: 6 additions & 3 deletions exercises/practice/perfect-numbers/test.sml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ val testsuite =
(fn _ => classify 30 |> Expect.equalTo (SOME Abundant)),

test "Large abundant number is classified correctly"
(fn _ => classify 33550335 |> Expect.equalTo (SOME Abundant))
(fn _ => classify 33550335 |> Expect.equalTo (SOME Abundant)),

test "Perfect square abundant number is classified correctly"
(fn _ => classify 196 |> Expect.equalTo (SOME Abundant))
],

describe "Deficient numbers" [
Expand All @@ -48,10 +51,10 @@ val testsuite =
],

describe "Invalid inputs" [
test "Zero is rejected (not a natural number)"
test "Zero is rejected (as it is not a positive integer)"
(fn _ => classify 0 |> Expect.equalTo NONE),

test "Negative integer is rejected (not a natural number)"
test "Negative integer is rejected (as it is not a positive integer)"
(fn _ => classify ~1 |> Expect.equalTo NONE)
]
]
Expand Down