Skip to content

Commit

Permalink
Sync allergies exercise (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
keiravillekode authored Dec 23, 2023
1 parent af718dc commit 0f7466f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion exercises/practice/allergies/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Now, given just that score of 34, your program should be able to say:
- Whether Tom is allergic to any one of those allergens listed above.
- All the allergens Tom is allergic to.

Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.).
Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.).
Your program should ignore those components of the score.
For example, if the allergy score is 257, your program should only report the eggs (1) allergy.
3 changes: 3 additions & 0 deletions exercises/practice/allergies/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,6 @@ description = "list when: -> everything"

[12ce86de-b347-42a0-ab7c-2e0570f0c65b]
description = "list when: -> no allergen score parts"

[93c2df3e-4f55-4fed-8116-7513092819cd]
description = "list when: -> no allergen score parts without highest valid score"
7 changes: 5 additions & 2 deletions exercises/practice/allergies/test.sml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* version 1.0.0 *)
(* version 1.1.0 *)

use "testlib.sml";
use "allergies.sml";
Expand Down Expand Up @@ -61,7 +61,10 @@ val testsuite =
(fn _ => allergies (255) |> Expect.equalTo [Eggs, Peanuts, Shellfish, Strawberries, Tomatoes, Chocolate, Pollen, Cats]),

test "ignore non allergen score parts"
(fn _ => allergies (509) |> Expect.equalTo [Eggs, Shellfish, Strawberries, Tomatoes, Chocolate, Pollen, Cats])
(fn _ => allergies (509) |> Expect.equalTo [Eggs, Shellfish, Strawberries, Tomatoes, Chocolate, Pollen, Cats]),

test "no allergen score parts without highest valid score"
(fn _ => allergies (257) |> Expect.equalTo [Eggs])
]
]

Expand Down

0 comments on commit 0f7466f

Please sign in to comment.