Skip to content

Commit

Permalink
Tweak pangram tests per canonical-data
Browse files Browse the repository at this point in the history
This removes an include=false from the tests.toml, as the
exclusion seems to have been unintentional (the new test
passes with no changes to the example solution).

It also switches to use the should.be_false / should.be_true style
that other tests use, rather than assert False / assert True.
  • Loading branch information
kytrinyx committed Jan 23, 2023
1 parent babe1e6 commit d896ddf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
3 changes: 3 additions & 0 deletions exercises/practice/pangram/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"authors": [
"lpil"
],
"contributors": [
"kytrinyx"
],
"files": {
"solution": [
"src/pangram.gleam"
Expand Down
1 change: 0 additions & 1 deletion exercises/practice/pangram/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ description = "mixed case and punctuation"

[2577bf54-83c8-402d-a64b-a2c0f7bb213a]
description = "case insensitive"
include = false

[7138e389-83e4-4c6e-8413-1e40a0076951]
description = "a-m and A-M are 26 different characters but not a pangram"
Expand Down
38 changes: 25 additions & 13 deletions exercises/practice/pangram/test/pangram_test.gleam
Original file line number Diff line number Diff line change
@@ -1,61 +1,73 @@
import pangram.{is_pangram}
import gleeunit
import gleeunit/should

pub fn main() {
gleeunit.main()
}

pub fn empty_sentence_test() {
let sentence = ""
assert False = is_pangram(sentence)
is_pangram(sentence)
|> should.be_false
}

pub fn perfect_lower_case_test() {
let sentence = "abcdefghijklmnopqrstuvwxyz"
assert True = is_pangram(sentence)
is_pangram(sentence)
|> should.be_true
}

pub fn only_lower_case_test() {
let sentence = "the quick brown fox jumps over the lazy dog"
assert True = is_pangram(sentence)
is_pangram(sentence)
|> should.be_true
}

pub fn missing_the_letter_x_test() {
let sentence = "a quick movement of the enemy will jeopardize five gunboats"
assert False = is_pangram(sentence)
is_pangram(sentence)
|> should.be_false
}

pub fn missing_the_letter_h_test() {
let sentence = "five boxing wizards jump quickly at it"
assert False = is_pangram(sentence)
is_pangram(sentence)
|> should.be_false
}

pub fn with_underscores_test() {
let sentence = "the_quick_brown_fox_jumps_over_the_lazy_dog"
assert True = is_pangram(sentence)
is_pangram(sentence)
|> should.be_true
}

pub fn with_numbers_test() {
let sentence = "the 1 quick brown fox jumps over the 2 lazy dogs"
assert True = is_pangram(sentence)
is_pangram(sentence)
|> should.be_true
}

pub fn missing_letters_replaced_by_numbers_test() {
let sentence = "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"
assert False = is_pangram(sentence)
is_pangram(sentence)
|> should.be_false
}

pub fn mixed_case_and_punctuation_test() {
let sentence = "Five quacking Zephyrs jolt my wax bed."
assert True = is_pangram(sentence)
let sentence = "\"Five quacking Zephyrs jolt my wax bed.\""
is_pangram(sentence)
|> should.be_true
}

pub fn case_insensitive_test() {
let sentence = "the quick brown fox jumps over with lazy FX"
assert False = is_pangram(sentence)
is_pangram(sentence)
|> should.be_false
}

pub fn a_m_and_upper_a_m_are_26_different_characters_but_not_a_pangram_test() {
pub fn a_m_and_a_m_are_26_different_characters_but_not_a_pangram_test() {
let sentence = "abcdefghijklm ABCDEFGHIJKLM"
assert False = is_pangram(sentence)
is_pangram(sentence)
|> should.be_false
}

0 comments on commit d896ddf

Please sign in to comment.