tresure-chest
This commit is contained in:
27
treasure-chest/test/treasure_chest_test.gleam
Normal file
27
treasure-chest/test/treasure_chest_test.gleam
Normal file
@@ -0,0 +1,27 @@
|
||||
import exercism/should
|
||||
import exercism/test_runner
|
||||
import treasure_chest.{TreasureChest, Unlocked, WrongPassword}
|
||||
|
||||
pub fn main() {
|
||||
test_runner.main()
|
||||
}
|
||||
|
||||
pub fn treasure_can_be_a_string_test() {
|
||||
TreasureChest("password", "treasure")
|
||||
}
|
||||
|
||||
pub fn treasure_can_be_an_int_test() {
|
||||
TreasureChest("password", 5)
|
||||
}
|
||||
|
||||
pub fn treasure_is_returned_if_correct_password_test() {
|
||||
TreasureChest("password", "treasure")
|
||||
|> treasure_chest.get_treasure("password")
|
||||
|> should.equal(Unlocked("treasure"))
|
||||
}
|
||||
|
||||
pub fn wrong_password_is_returned_if_an_incorrect_password_is_used_test() {
|
||||
TreasureChest("password", "treasure")
|
||||
|> treasure_chest.get_treasure("wrong-password")
|
||||
|> should.equal(WrongPassword)
|
||||
}
|
||||
Reference in New Issue
Block a user