mirror of
https://github.com/correl/elm.git
synced 2024-12-22 19:17:27 +00:00
Skip all but first test of each example
This allows learners to gradually approach exercise. However, unlike commented tests, the Elm compiler is still able to infer type information from the skipped tests.
This commit is contained in:
parent
d76d7ecb7b
commit
4d81104a85
31 changed files with 1250 additions and 932 deletions
|
@ -16,13 +16,16 @@ tests =
|
|||
describe "Accumulate"
|
||||
[ test "[] Accumulate" <|
|
||||
\() -> Expect.equal [] (accumulate square [])
|
||||
, test "square Accumulate" <|
|
||||
, skip <|
|
||||
test "square Accumulate" <|
|
||||
\() -> Expect.equal [ 1, 4, 9 ] (accumulate square [ 1, 2, 3 ])
|
||||
, test "toUpper Accumulate" <|
|
||||
, skip <|
|
||||
test "toUpper Accumulate" <|
|
||||
\() ->
|
||||
Expect.equal [ "HELLO", "WORLD" ]
|
||||
(accumulate String.toUpper [ "hello", "world" ])
|
||||
, test "reverse Accumulate" <|
|
||||
, skip <|
|
||||
test "reverse Accumulate" <|
|
||||
\() ->
|
||||
Expect.equal [ "olleh", "dlrow" ]
|
||||
(accumulate String.reverse [ "hello", "world" ])
|
||||
|
|
|
@ -13,34 +13,45 @@ tests =
|
|||
[ describe "no allergies means not allergic"
|
||||
[ test "peanuts" <|
|
||||
\() -> Expect.equal False (isAllergicTo "peanuts" 0)
|
||||
, test "cats" <|
|
||||
, skip <|
|
||||
test "cats" <|
|
||||
\() -> Expect.equal False (isAllergicTo "cats" 0)
|
||||
, test "strawberries" <|
|
||||
, skip <|
|
||||
test "strawberries" <|
|
||||
\() -> Expect.equal False (isAllergicTo "strawberries" 0)
|
||||
]
|
||||
, test "is allergic to eggs" <|
|
||||
, skip <|
|
||||
test "is allergic to eggs" <|
|
||||
\() -> Expect.equal True (isAllergicTo "eggs" 1)
|
||||
, describe "has the right allergies"
|
||||
[ test "eggs" <|
|
||||
[ skip <|
|
||||
test "eggs" <|
|
||||
\() -> Expect.equal True (isAllergicTo "eggs" 5)
|
||||
, test "shellfish" <|
|
||||
, skip <|
|
||||
test "shellfish" <|
|
||||
\() -> Expect.equal True (isAllergicTo "shellfish" 5)
|
||||
, test "strawberries" <|
|
||||
, skip <|
|
||||
test "strawberries" <|
|
||||
\() -> Expect.equal False (isAllergicTo "strawberries" 5)
|
||||
]
|
||||
]
|
||||
, describe "toList"
|
||||
[ test "no allergies at all" <|
|
||||
[ skip <|
|
||||
test "no allergies at all" <|
|
||||
\() -> Expect.equal [] (toList (0))
|
||||
, test "allergic to just peanuts" <|
|
||||
, skip <|
|
||||
test "allergic to just peanuts" <|
|
||||
\() -> Expect.equal [ "peanuts" ] (toList (2))
|
||||
, test "allergic to everything" <|
|
||||
, skip <|
|
||||
test "allergic to everything" <|
|
||||
\() ->
|
||||
Expect.equal (List.sort [ "eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats" ])
|
||||
(255 |> toList |> List.sort)
|
||||
, test "ignore non allergen score parts" <|
|
||||
, skip <|
|
||||
test "ignore non allergen score parts" <|
|
||||
\() -> Expect.equal [ "eggs" ] (toList 257)
|
||||
, test "ignore all non allergen score parts" <|
|
||||
, skip <|
|
||||
test "ignore all non allergen score parts" <|
|
||||
\() ->
|
||||
Expect.equal (List.sort [ "eggs", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats" ])
|
||||
(509 |> toList |> List.sort)
|
||||
|
|
|
@ -12,79 +12,98 @@ tests =
|
|||
\() ->
|
||||
Expect.equal []
|
||||
(detect "diaper" [ "hello", "world", "zombies", "pants" ])
|
||||
, test "detects simple anagram" <|
|
||||
, skip <|
|
||||
test "detects simple anagram" <|
|
||||
\() ->
|
||||
Expect.equal [ "tan" ]
|
||||
(detect "ant" [ "tan", "stand", "at" ])
|
||||
, test "does not detect false positives" <|
|
||||
, skip <|
|
||||
test "does not detect false positives" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "galea" [ "eagle" ])
|
||||
, test "detects multiple anagrams" <|
|
||||
, skip <|
|
||||
test "detects multiple anagrams" <|
|
||||
\() ->
|
||||
Expect.equal [ "stream", "maters" ]
|
||||
(detect "master" [ "stream", "pigeon", "maters" ])
|
||||
, test "does not detect anagram subsets" <|
|
||||
, skip <|
|
||||
test "does not detect anagram subsets" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "good" [ "dog", "goody" ])
|
||||
, test "detects anagram" <|
|
||||
, skip <|
|
||||
test "detects anagram" <|
|
||||
\() ->
|
||||
Expect.equal [ "inlets" ]
|
||||
(detect "listen" [ "enlists", "google", "inlets", "banana" ])
|
||||
, test "detects even more anagrams" <|
|
||||
, skip <|
|
||||
test "detects even more anagrams" <|
|
||||
\() ->
|
||||
Expect.equal [ "gallery", "regally", "largely" ]
|
||||
(detect "allergy" [ "gallery", "ballerina", "regally", "clergy", "largely", "leading" ])
|
||||
, test "does not detect indentical words" <|
|
||||
, skip <|
|
||||
test "does not detect indentical words" <|
|
||||
\() ->
|
||||
Expect.equal [ "cron" ]
|
||||
(detect "corn" [ "corn", "dark", "Corn", "rank", "CORN", "cron", "park" ])
|
||||
, test "does not detect non-anagrams with identical checksum" <|
|
||||
, skip <|
|
||||
test "does not detect non-anagrams with identical checksum" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "mass" [ "last" ])
|
||||
, test "detects anagrams case-insensitively" <|
|
||||
, skip <|
|
||||
test "detects anagrams case-insensitively" <|
|
||||
\() ->
|
||||
Expect.equal [ "Carthorse" ]
|
||||
(detect "Orchestra" [ "cashregister", "Carthorse", "radishes" ])
|
||||
, test "detects anagrams using case-insensitive subject" <|
|
||||
, skip <|
|
||||
test "detects anagrams using case-insensitive subject" <|
|
||||
\() ->
|
||||
Expect.equal [ "carthorse" ]
|
||||
(detect "Orchestra" [ "cashregister", "carthorse", "radishes" ])
|
||||
, test "detects anagrams using case-insensitve possible matches" <|
|
||||
, skip <|
|
||||
test "detects anagrams using case-insensitve possible matches" <|
|
||||
\() ->
|
||||
Expect.equal [ "Carthorse" ]
|
||||
(detect "orchestra" [ "cashregister", "Carthorse", "radishes" ])
|
||||
, test "does not detect a word as its own anagram" <|
|
||||
, skip <|
|
||||
test "does not detect a word as its own anagram" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "banana" [ "Banana" ])
|
||||
, test "does not detect a anagram if the original word is repeated" <|
|
||||
, skip <|
|
||||
test "does not detect a anagram if the original word is repeated" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "go" [ "go Go GO" ])
|
||||
, test "anagrams must use all letters exactly once (go)" <|
|
||||
, skip <|
|
||||
test "anagrams must use all letters exactly once (go)" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "tapper" [ "patter" ])
|
||||
, test "eliminates anagrams with the same checksum" <|
|
||||
, skip <|
|
||||
test "eliminates anagrams with the same checksum" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "mass" [ "last" ])
|
||||
, test "detects unicode anagrams" <|
|
||||
, skip <|
|
||||
test "detects unicode anagrams" <|
|
||||
\() ->
|
||||
Expect.equal [ "ΒΓΑ", "γβα" ]
|
||||
(detect "ΑΒΓ" [ "ΒΓΑ", "ΒΓΔ", "γβα" ])
|
||||
, test "eliminates misleading unicode anagrams" <|
|
||||
, skip <|
|
||||
test "eliminates misleading unicode anagrams" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "ΑΒΓ" [ "ABΓ" ])
|
||||
, test "capital word is not own anagram" <|
|
||||
, skip <|
|
||||
test "capital word is not own anagram" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "BANANA" [ "Banana" ])
|
||||
, test "anagrams must use all letters exactly once (banana)" <|
|
||||
, skip <|
|
||||
test "anagrams must use all letters exactly once (banana)" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(detect "patter" [ "tapper" ])
|
||||
|
|
|
@ -10,25 +10,34 @@ tests =
|
|||
describe "AtbashCipher"
|
||||
[ test "encode no" <|
|
||||
\() -> Expect.equal "ml" (encode "no")
|
||||
, test "encode yes" <|
|
||||
, skip <|
|
||||
test "encode yes" <|
|
||||
\() -> Expect.equal "bvh" (encode "yes")
|
||||
, test "encode OMG" <|
|
||||
, skip <|
|
||||
test "encode OMG" <|
|
||||
\() -> Expect.equal "lnt" (encode "OMG")
|
||||
, test "encode O M G" <|
|
||||
, skip <|
|
||||
test "encode O M G" <|
|
||||
\() -> Expect.equal "lnt" (encode "O M G")
|
||||
, test "encode long word" <|
|
||||
, skip <|
|
||||
test "encode long word" <|
|
||||
\() -> Expect.equal "nrmwy oldrm tob" (encode "mindblowingly")
|
||||
, test "encode numbers" <|
|
||||
, skip <|
|
||||
test "encode numbers" <|
|
||||
\() -> Expect.equal "gvhgr mt123 gvhgr mt" (encode "Testing, 1 2 3, testing.")
|
||||
, test "encode sentence" <|
|
||||
, skip <|
|
||||
test "encode sentence" <|
|
||||
\() -> Expect.equal "gifgs rhurx grlm" (encode "Truth is fiction.")
|
||||
, test "encode all things" <|
|
||||
, skip <|
|
||||
test "encode all things" <|
|
||||
\() ->
|
||||
Expect.equal "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"
|
||||
(encode "The quick brown fox jumps over the lazy dog.")
|
||||
, test "decode word" <|
|
||||
, skip <|
|
||||
test "decode word" <|
|
||||
\() -> Expect.equal "exercism" (decode "vcvix rhn")
|
||||
, test "decode sentence" <|
|
||||
, skip <|
|
||||
test "decode sentence" <|
|
||||
\() ->
|
||||
Expect.equal "anobstacleisoftenasteppingstone"
|
||||
(decode "zmlyh gzxov rhlug vmzhg vkkrm thglm v")
|
||||
|
|
|
@ -15,97 +15,116 @@ tests =
|
|||
\() ->
|
||||
Expect.equal "Whatever."
|
||||
(Bob.hey "Tom-ay-to, tom-aaaah-to.")
|
||||
, test "shouting" <|
|
||||
, skip <|
|
||||
test "shouting" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whoa, chill out!"
|
||||
(Bob.hey "WATCH OUT!")
|
||||
, test "shouting gibberish" <|
|
||||
, skip <|
|
||||
test "shouting gibberish" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whoa, chill out!"
|
||||
(Bob.hey (uppercaseGibberish 10))
|
||||
, test "asking a question" <|
|
||||
, skip <|
|
||||
test "asking a question" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Sure."
|
||||
(Bob.hey "Does this cryogenic chamber make me look fat?")
|
||||
, test "asking a numeric question" <|
|
||||
, skip <|
|
||||
test "asking a numeric question" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Sure."
|
||||
(Bob.hey "You are, what, like 15?")
|
||||
, test "asking gibberish" <|
|
||||
, skip <|
|
||||
test "asking gibberish" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Sure."
|
||||
(Bob.hey (gibberishQuestion 20))
|
||||
, test "talking forcefully" <|
|
||||
, skip <|
|
||||
test "talking forcefully" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whatever."
|
||||
(Bob.hey "Let's go make out behind the gym!")
|
||||
, test "using acronyms in regular speech" <|
|
||||
, skip <|
|
||||
test "using acronyms in regular speech" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whatever."
|
||||
(Bob.hey "It's OK if you don't want to go to the DMV.")
|
||||
, test "forceful questions" <|
|
||||
, skip <|
|
||||
test "forceful questions" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whoa, chill out!"
|
||||
(Bob.hey "WHAT THE HELL WERE YOU THINKING?")
|
||||
, test "shouting numbers" <|
|
||||
, skip <|
|
||||
test "shouting numbers" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whoa, chill out!"
|
||||
(Bob.hey "1, 2, 3 GO!")
|
||||
, test "only numbers" <|
|
||||
, skip <|
|
||||
test "only numbers" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whatever."
|
||||
(Bob.hey "1, 2, 3")
|
||||
, test "question with only numbers" <|
|
||||
, skip <|
|
||||
test "question with only numbers" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Sure."
|
||||
(Bob.hey "4?")
|
||||
, test "shouting with special characters" <|
|
||||
, skip <|
|
||||
test "shouting with special characters" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whoa, chill out!"
|
||||
(Bob.hey "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")
|
||||
, test "shouting with no exclamation mark" <|
|
||||
, skip <|
|
||||
test "shouting with no exclamation mark" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whoa, chill out!"
|
||||
(Bob.hey "I HATE YOU")
|
||||
, test "statement containing a question mark" <|
|
||||
, skip <|
|
||||
test "statement containing a question mark" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whatever."
|
||||
(Bob.hey "Ending with ? means a question.")
|
||||
, test "prattling on" <|
|
||||
, skip <|
|
||||
test "prattling on" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Sure."
|
||||
(Bob.hey "Wait! Hang on. Are you going to be OK?")
|
||||
, test "silence" <|
|
||||
, skip <|
|
||||
test "silence" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Fine. Be that way!"
|
||||
(Bob.hey "")
|
||||
, test "prolonged silence" <|
|
||||
, skip <|
|
||||
test "prolonged silence" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Fine. Be that way!"
|
||||
(Bob.hey " ")
|
||||
, test "alternate silences" <|
|
||||
, skip <|
|
||||
test "alternate silences" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Fine. Be that way!"
|
||||
(Bob.hey "\t \n \t ")
|
||||
, test "on multiple line questions" <|
|
||||
, skip <|
|
||||
test "on multiple line questions" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
"Whatever."
|
||||
|
|
|
@ -11,27 +11,36 @@ tests =
|
|||
[ describe "square the sum of the numbers up to the given number"
|
||||
[ test "square of sum 5" <|
|
||||
\() -> Expect.equal 225 (squareOfSum 5)
|
||||
, test "square of sum 10" <|
|
||||
, skip <|
|
||||
test "square of sum 10" <|
|
||||
\() -> Expect.equal 3025 (squareOfSum 10)
|
||||
, test "square of sum 100" <|
|
||||
, skip <|
|
||||
test "square of sum 100" <|
|
||||
\() -> Expect.equal 25502500 (squareOfSum 100)
|
||||
]
|
||||
, describe "sum the squares of the numbers up to the given number"
|
||||
[ test "sum of squares 5" <|
|
||||
[ skip <|
|
||||
test "sum of squares 5" <|
|
||||
\() -> Expect.equal 55 (sumOfSquares 5)
|
||||
, test "sum of squares 10" <|
|
||||
, skip <|
|
||||
test "sum of squares 10" <|
|
||||
\() -> Expect.equal 385 (sumOfSquares 10)
|
||||
, test "sum of squares 100" <|
|
||||
, skip <|
|
||||
test "sum of squares 100" <|
|
||||
\() -> Expect.equal 338350 (sumOfSquares 100)
|
||||
]
|
||||
, describe "subtract sum of squares from square of sums"
|
||||
[ test "difference of squares 0" <|
|
||||
[ skip <|
|
||||
test "difference of squares 0" <|
|
||||
\() -> Expect.equal 0 (difference 0)
|
||||
, test "difference of squares 5" <|
|
||||
, skip <|
|
||||
test "difference of squares 5" <|
|
||||
\() -> Expect.equal 170 (difference 5)
|
||||
, test "difference of squares 10" <|
|
||||
, skip <|
|
||||
test "difference of squares 10" <|
|
||||
\() -> Expect.equal 2640 (difference 10)
|
||||
, test "difference of squares 100" <|
|
||||
, skip <|
|
||||
test "difference of squares 100" <|
|
||||
\() -> Expect.equal 25164150 (difference 100)
|
||||
]
|
||||
]
|
||||
|
|
|
@ -13,16 +13,20 @@ tests =
|
|||
[ test "2011-04-25" <|
|
||||
\() ->
|
||||
Expect.equal (date "2043-01-01T01:46:40") (Gigasecond.add (date "2011-04-25"))
|
||||
, test "1977-06-13" <|
|
||||
, skip <|
|
||||
test "1977-06-13" <|
|
||||
\() ->
|
||||
Expect.equal (date "2009-02-19T01:46:40") (Gigasecond.add (date "1977-06-13"))
|
||||
, test "1959-07-19" <|
|
||||
, skip <|
|
||||
test "1959-07-19" <|
|
||||
\() ->
|
||||
Expect.equal (date "1991-03-27T01:46:40") (Gigasecond.add (date "1959-07-19"))
|
||||
, test "full time specified" <|
|
||||
, skip <|
|
||||
test "full time specified" <|
|
||||
\() ->
|
||||
Expect.equal (date "2046-10-02T23:46:40") (Gigasecond.add (date "2015-01-24T22:00:00"))
|
||||
, test "full time with day roll-over" <|
|
||||
, skip <|
|
||||
test "full time with day roll-over" <|
|
||||
\() ->
|
||||
Expect.equal (date "2046-10-03T01:46:39") (Gigasecond.add (date "2015-01-24T23:59:59"))
|
||||
]
|
||||
|
|
|
@ -15,7 +15,8 @@ tests =
|
|||
|> addStudent 2 "Aimee"
|
||||
|> studentsInGrade 2
|
||||
)
|
||||
, test "add more students in same class" <|
|
||||
, skip <|
|
||||
test "add more students in same class" <|
|
||||
\() ->
|
||||
Expect.equal [ "Blair", "James", "Paul" ]
|
||||
(GradeSchool.empty
|
||||
|
@ -24,7 +25,8 @@ tests =
|
|||
|> addStudent 2 "Paul"
|
||||
|> studentsInGrade 2
|
||||
)
|
||||
, test "add students to different grades" <|
|
||||
, skip <|
|
||||
test "add students to different grades" <|
|
||||
\() ->
|
||||
Expect.equal [ [ "Chelsea" ], [ "Logan" ] ]
|
||||
(let
|
||||
|
@ -35,7 +37,8 @@ tests =
|
|||
in
|
||||
[ studentsInGrade 3 school, studentsInGrade 7 school ]
|
||||
)
|
||||
, test "get students in a grade" <|
|
||||
, skip <|
|
||||
test "get students in a grade" <|
|
||||
\() ->
|
||||
Expect.equal [ "Bradley", "Franklin" ]
|
||||
(GradeSchool.empty
|
||||
|
@ -44,7 +47,8 @@ tests =
|
|||
|> addStudent 1 "Jeff"
|
||||
|> studentsInGrade 5
|
||||
)
|
||||
, test "get all students in the school" <|
|
||||
, skip <|
|
||||
test "get all students in the school" <|
|
||||
\() ->
|
||||
Expect.equal [ ( 3, [ "Kyle" ] ), ( 4, [ "Christopher", "Jennifer" ] ), ( 6, [ "Kareem" ] ) ]
|
||||
(GradeSchool.empty
|
||||
|
@ -54,6 +58,7 @@ tests =
|
|||
|> addStudent 3 "Kyle"
|
||||
|> allStudents
|
||||
)
|
||||
, test "get students in a non-existent grade" <|
|
||||
, skip <|
|
||||
test "get students in a non-existent grade" <|
|
||||
\() -> Expect.equal [] (studentsInGrade 1 GradeSchool.empty)
|
||||
]
|
||||
|
|
|
@ -12,19 +12,26 @@ tests =
|
|||
[ describe "square"
|
||||
[ test "of 1" <|
|
||||
\() -> Expect.equal (Just 1) (square 1)
|
||||
, test "of 2" <|
|
||||
, skip <|
|
||||
test "of 2" <|
|
||||
\() -> Expect.equal (Just 2) (square 2)
|
||||
, test "of 3" <|
|
||||
, skip <|
|
||||
test "of 3" <|
|
||||
\() -> Expect.equal (Just 4) (square 3)
|
||||
, test "of 4" <|
|
||||
, skip <|
|
||||
test "of 4" <|
|
||||
\() -> Expect.equal (Just 8) (square 4)
|
||||
, test "of 16" <|
|
||||
, skip <|
|
||||
test "of 16" <|
|
||||
\() -> Expect.equal (Just 32768) (square 16)
|
||||
, test "of 32" <|
|
||||
, skip <|
|
||||
test "of 32" <|
|
||||
\() -> Expect.equal (Just 2147483648) (square 32)
|
||||
, test "square 0 raises an exception" <|
|
||||
, skip <|
|
||||
test "square 0 raises an exception" <|
|
||||
\() -> Expect.equal Nothing (square 0)
|
||||
, test "negative square raises an exception" <|
|
||||
, skip <|
|
||||
test "negative square raises an exception" <|
|
||||
\() -> Expect.equal Nothing (square -1)
|
||||
|
||||
{-
|
||||
|
|
|
@ -10,30 +10,43 @@ tests =
|
|||
describe "Hamming"
|
||||
[ test "identical strands" <|
|
||||
\() -> Expect.equal (Just 0) (distance "A" "A")
|
||||
, test "long identical strands" <|
|
||||
, skip <|
|
||||
test "long identical strands" <|
|
||||
\() -> Expect.equal (Just 0) (distance "GGACTGA" "GGACTGA")
|
||||
, test "complete distance in single nucleotide strands" <|
|
||||
, skip <|
|
||||
test "complete distance in single nucleotide strands" <|
|
||||
\() -> Expect.equal (Just 1) (distance "A" "G")
|
||||
, test "complete distance in small strands" <|
|
||||
, skip <|
|
||||
test "complete distance in small strands" <|
|
||||
\() -> Expect.equal (Just 2) (distance "AG" "CT")
|
||||
, test "small distance in small strands" <|
|
||||
, skip <|
|
||||
test "small distance in small strands" <|
|
||||
\() -> Expect.equal (Just 1) (distance "AT" "CT")
|
||||
, test "small distance" <|
|
||||
, skip <|
|
||||
test "small distance" <|
|
||||
\() -> Expect.equal (Just 1) (distance "GGACG" "GGTCG")
|
||||
, test "small distance in long strands" <|
|
||||
, skip <|
|
||||
test "small distance in long strands" <|
|
||||
\() -> Expect.equal (Just 2) (distance "ACCAGGG" "ACTATGG")
|
||||
, test "non-unique character in first strand" <|
|
||||
, skip <|
|
||||
test "non-unique character in first strand" <|
|
||||
\() -> Expect.equal (Just 1) (distance "AGA" "AGG")
|
||||
, test "non-unique character in second strand" <|
|
||||
, skip <|
|
||||
test "non-unique character in second strand" <|
|
||||
\() -> Expect.equal (Just 1) (distance "AGG" "AGA")
|
||||
, test "large distance" <|
|
||||
, skip <|
|
||||
test "large distance" <|
|
||||
\() -> Expect.equal (Just 4) (distance "GATACA" "GCATAA")
|
||||
, test "large distance in off-by-one strand" <|
|
||||
, skip <|
|
||||
test "large distance in off-by-one strand" <|
|
||||
\() -> Expect.equal (Just 9) (distance "GGACGGATTCTG" "AGGACGGATTCT")
|
||||
, test "empty strands" <|
|
||||
, skip <|
|
||||
test "empty strands" <|
|
||||
\() -> Expect.equal (Just 0) (distance "" "")
|
||||
, test "disallow first strand longer" <|
|
||||
, skip <|
|
||||
test "disallow first strand longer" <|
|
||||
\() -> Expect.equal Nothing (distance "AATG" "AAA")
|
||||
, test "disallow second strand longer" <|
|
||||
, skip <|
|
||||
test "disallow second strand longer" <|
|
||||
\() -> Expect.equal Nothing (distance "ATA" "AGTG")
|
||||
]
|
||||
|
|
|
@ -11,10 +11,12 @@ tests =
|
|||
[ test "Hello with no name" <|
|
||||
\() ->
|
||||
Expect.equal "Hello, World!" (helloWorld Nothing)
|
||||
, test "Hello to a sample name" <|
|
||||
, skip <|
|
||||
test "Hello to a sample name" <|
|
||||
\() ->
|
||||
Expect.equal "Hello, Alice!" (helloWorld (Just "Alice"))
|
||||
, test "Hello to another sample name" <|
|
||||
, skip <|
|
||||
test "Hello to another sample name" <|
|
||||
\() ->
|
||||
Expect.equal "Hello, Bob!" (helloWorld (Just "Bob"))
|
||||
]
|
||||
|
|
|
@ -10,36 +10,52 @@ tests =
|
|||
describe "largestProduct"
|
||||
[ test "can find the largest product of 2 with numbers in order" <|
|
||||
\() -> Expect.equal (Just 72) (largestProduct 2 "0123456789")
|
||||
, test "can find the largest product of 2" <|
|
||||
, skip <|
|
||||
test "can find the largest product of 2" <|
|
||||
\() -> Expect.equal (Just 48) (largestProduct 2 "576802143")
|
||||
, test "finds the largest product if span equals length" <|
|
||||
, skip <|
|
||||
test "finds the largest product if span equals length" <|
|
||||
\() -> Expect.equal (Just 18) (largestProduct 2 "29")
|
||||
, test "can find the largest product of 3 with numbers in order" <|
|
||||
, skip <|
|
||||
test "can find the largest product of 3 with numbers in order" <|
|
||||
\() -> Expect.equal (Just 504) (largestProduct 3 "0123456789")
|
||||
, test "can find the largest product of 3" <|
|
||||
, skip <|
|
||||
test "can find the largest product of 3" <|
|
||||
\() -> Expect.equal (Just 270) (largestProduct 3 "1027839564")
|
||||
, test "can find the largest product of 5 with numbers in order" <|
|
||||
, skip <|
|
||||
test "can find the largest product of 5 with numbers in order" <|
|
||||
\() -> Expect.equal (Just 15120) (largestProduct 5 "0123456789")
|
||||
, test "can get the largest product of a big number" <|
|
||||
, skip <|
|
||||
test "can get the largest product of a big number" <|
|
||||
\() -> Expect.equal (Just 23520) (largestProduct 6 "73167176531330624919225119674426574742355349194934")
|
||||
, test "can get the largest product of a big number II" <|
|
||||
, skip <|
|
||||
test "can get the largest product of a big number II" <|
|
||||
\() -> Expect.equal (Just 28350) (largestProduct 6 "52677741234314237566414902593461595376319419139427")
|
||||
, test "can get the largest product of a big number (Project Euler)" <|
|
||||
, skip <|
|
||||
test "can get the largest product of a big number (Project Euler)" <|
|
||||
\() -> Expect.equal (Just 23514624000) (largestProduct 13 "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450")
|
||||
, test "reports zero if the only digits are zero" <|
|
||||
, skip <|
|
||||
test "reports zero if the only digits are zero" <|
|
||||
\() -> Expect.equal (Just 0) (largestProduct 2 "0000")
|
||||
, test "reports zero if all spans include zero" <|
|
||||
, skip <|
|
||||
test "reports zero if all spans include zero" <|
|
||||
\() -> Expect.equal (Just 0) (largestProduct 3 "99099")
|
||||
, test "rejects span longer than string length" <|
|
||||
, skip <|
|
||||
test "rejects span longer than string length" <|
|
||||
\() -> Expect.equal Nothing (largestProduct 4 "123")
|
||||
, test "reports 1 for empty string and empty product (0 span)" <|
|
||||
, skip <|
|
||||
test "reports 1 for empty string and empty product (0 span)" <|
|
||||
\() -> Expect.equal (Just 1) (largestProduct 0 "")
|
||||
, test "reports 1 for nonempty string and empty product (0 span)" <|
|
||||
, skip <|
|
||||
test "reports 1 for nonempty string and empty product (0 span)" <|
|
||||
\() -> Expect.equal (Just 1) (largestProduct 0 "123")
|
||||
, test "rejects empty string and nonzero span" <|
|
||||
, skip <|
|
||||
test "rejects empty string and nonzero span" <|
|
||||
\() -> Expect.equal Nothing (largestProduct 1 "")
|
||||
, test "rejects invalid character in digits" <|
|
||||
, skip <|
|
||||
test "rejects invalid character in digits" <|
|
||||
\() -> Expect.equal Nothing (largestProduct 2 "1234a5")
|
||||
, test "rejects negative span" <|
|
||||
, skip <|
|
||||
test "rejects negative span" <|
|
||||
\() -> Expect.equal Nothing (largestProduct -1 "12345")
|
||||
]
|
||||
|
|
|
@ -10,16 +10,22 @@ tests =
|
|||
describe "Leap"
|
||||
[ test "leap year" <|
|
||||
\() -> Expect.equal True (Leap.isLeapYear 1996)
|
||||
, test "non-leap year" <|
|
||||
, skip <|
|
||||
test "non-leap year" <|
|
||||
\() -> Expect.equal False (Leap.isLeapYear 1997)
|
||||
, test "non-leap even year" <|
|
||||
, skip <|
|
||||
test "non-leap even year" <|
|
||||
\() -> Expect.equal False (Leap.isLeapYear 1998)
|
||||
, test "century" <|
|
||||
, skip <|
|
||||
test "century" <|
|
||||
\() -> Expect.equal False (Leap.isLeapYear 1900)
|
||||
, test "second century" <|
|
||||
, skip <|
|
||||
test "second century" <|
|
||||
\() -> Expect.equal False (Leap.isLeapYear 1800)
|
||||
, test "fourth century" <|
|
||||
, skip <|
|
||||
test "fourth century" <|
|
||||
\() -> Expect.equal True (Leap.isLeapYear 2400)
|
||||
, test "y2k" <|
|
||||
, skip <|
|
||||
test "y2k" <|
|
||||
\() -> Expect.equal True (Leap.isLeapYear 2000)
|
||||
]
|
||||
|
|
|
@ -11,57 +11,76 @@ tests =
|
|||
[ describe "length"
|
||||
[ test "empty list" <|
|
||||
\() -> Expect.equal 0 (ListOps.length [])
|
||||
, test "non-empty list" <|
|
||||
, skip <|
|
||||
test "non-empty list" <|
|
||||
\() -> Expect.equal 4 (ListOps.length (List.range 1 4))
|
||||
]
|
||||
, describe "reverse"
|
||||
[ test "empty list" <|
|
||||
[ skip <|
|
||||
test "empty list" <|
|
||||
\() -> Expect.equal [] (ListOps.reverse [])
|
||||
, test "non-empty list" <|
|
||||
, skip <|
|
||||
test "non-empty list" <|
|
||||
\() -> Expect.equal [ 4, 3, 2, 1 ] (ListOps.reverse (List.range 1 4))
|
||||
]
|
||||
, describe "map"
|
||||
[ test "empty list" <|
|
||||
[ skip <|
|
||||
test "empty list" <|
|
||||
\() -> Expect.equal [] (ListOps.map ((+) 1) [])
|
||||
, test "non-empty list" <|
|
||||
, skip <|
|
||||
test "non-empty list" <|
|
||||
\() -> Expect.equal (List.range 2 5) (ListOps.map ((+) 1) (List.range 1 4))
|
||||
]
|
||||
, describe "filter"
|
||||
[ test "empty list" <|
|
||||
[ skip <|
|
||||
test "empty list" <|
|
||||
\() -> Expect.equal [] (ListOps.filter (\_ -> True) [])
|
||||
, test "non-empty list" <|
|
||||
, skip <|
|
||||
test "non-empty list" <|
|
||||
\() -> Expect.equal [ 2, 4 ] (ListOps.filter (\x -> x % 2 == 0) (List.range 1 4))
|
||||
]
|
||||
, describe "foldl"
|
||||
[ test "empty list" <|
|
||||
[ skip <|
|
||||
test "empty list" <|
|
||||
\() -> Expect.equal 0 (ListOps.foldl (+) 0 [])
|
||||
, test "non-empty list" <|
|
||||
, skip <|
|
||||
test "non-empty list" <|
|
||||
\() -> Expect.equal 10 (ListOps.foldl (+) 0 (List.range 1 4))
|
||||
, test "direction" <|
|
||||
, skip <|
|
||||
test "direction" <|
|
||||
\() -> Expect.equal [ 4, 3, 2, 1 ] (ListOps.foldl (::) [] (List.range 1 4))
|
||||
]
|
||||
, describe "foldr"
|
||||
[ test "empty list" <|
|
||||
[ skip <|
|
||||
test "empty list" <|
|
||||
\() -> Expect.equal 0 (ListOps.foldr (+) 0 [])
|
||||
, test "non-empty list" <|
|
||||
, skip <|
|
||||
test "non-empty list" <|
|
||||
\() -> Expect.equal 10 (ListOps.foldr (+) 0 (List.range 1 4))
|
||||
, test "direction" <|
|
||||
, skip <|
|
||||
test "direction" <|
|
||||
\() -> Expect.equal (List.range 1 4) (ListOps.foldr (::) [] (List.range 1 4))
|
||||
]
|
||||
, describe "append"
|
||||
[ test "empty lists" <|
|
||||
[ skip <|
|
||||
test "empty lists" <|
|
||||
\() -> Expect.equal [] (ListOps.append [] [])
|
||||
, test "empty and non-empty lists" <|
|
||||
, skip <|
|
||||
test "empty and non-empty lists" <|
|
||||
\() -> Expect.equal (List.range 1 4) (ListOps.append [] (List.range 1 4))
|
||||
, test "non-empty and empty lists" <|
|
||||
, skip <|
|
||||
test "non-empty and empty lists" <|
|
||||
\() -> Expect.equal (List.range 1 4) (ListOps.append (List.range 1 4) [])
|
||||
, test "non-empty lists" <|
|
||||
, skip <|
|
||||
test "non-empty lists" <|
|
||||
\() -> Expect.equal (List.range 1 8) (ListOps.append (List.range 1 4) (List.range 5 8))
|
||||
]
|
||||
, describe "concat"
|
||||
[ test "empty list" <|
|
||||
[ skip <|
|
||||
test "empty list" <|
|
||||
\() -> Expect.equal [] (ListOps.concat [])
|
||||
, test "list of lists" <|
|
||||
, skip <|
|
||||
test "list of lists" <|
|
||||
\() -> Expect.equal (List.range 1 10) (ListOps.concat [ List.range 1 3, [], List.range 4 7, List.range 8 10 ])
|
||||
]
|
||||
]
|
||||
|
|
|
@ -10,15 +10,18 @@ tests =
|
|||
describe "NucleotideCount"
|
||||
[ test "the solution is for the correct version of the test" <|
|
||||
\() -> Expect.equal 2 version
|
||||
, test "empty dna strand has no nucleotides" <|
|
||||
, skip <|
|
||||
test "empty dna strand has no nucleotides" <|
|
||||
\() ->
|
||||
Expect.equal { a = 0, t = 0, c = 0, g = 0 }
|
||||
(nucleotideCounts "")
|
||||
, test "repetitive sequence has only guanine" <|
|
||||
, skip <|
|
||||
test "repetitive sequence has only guanine" <|
|
||||
\() ->
|
||||
Expect.equal { a = 0, t = 0, c = 0, g = 8 }
|
||||
(nucleotideCounts "GGGGGGGG")
|
||||
, test "counts all nucleotides" <|
|
||||
, skip <|
|
||||
test "counts all nucleotides" <|
|
||||
\() ->
|
||||
Expect.equal { a = 20, t = 21, c = 12, g = 17 }
|
||||
(nucleotideCounts "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC")
|
||||
|
|
|
@ -12,39 +12,48 @@ tests =
|
|||
\() ->
|
||||
Expect.equal False
|
||||
(isPangram "")
|
||||
, test "pangram with only lower case" <|
|
||||
, skip <|
|
||||
test "pangram with only lower case" <|
|
||||
\() ->
|
||||
Expect.equal True
|
||||
(isPangram "the quick brown fox jumps over the lazy dog")
|
||||
, test "missing character 'x'" <|
|
||||
, skip <|
|
||||
test "missing character 'x'" <|
|
||||
\() ->
|
||||
Expect.equal False
|
||||
(isPangram "a quick movement of the enemy will jeopardize five gunboats")
|
||||
, test "missing character 'z'" <|
|
||||
, skip <|
|
||||
test "missing character 'z'" <|
|
||||
\() ->
|
||||
Expect.equal False
|
||||
(isPangram "a quick movement of the enemy will jeopardixe five gunboats")
|
||||
, test "another missing character 'x'" <|
|
||||
, skip <|
|
||||
test "another missing character 'x'" <|
|
||||
\() ->
|
||||
Expect.equal False
|
||||
(isPangram "the quick brown fish jumps over the lazy dog")
|
||||
, test "pangram with underscores" <|
|
||||
, skip <|
|
||||
test "pangram with underscores" <|
|
||||
\() ->
|
||||
Expect.equal True
|
||||
(isPangram "the_quick_brown_fox_jumps_over_the_lazy_dog")
|
||||
, test "pangram with numbers" <|
|
||||
, skip <|
|
||||
test "pangram with numbers" <|
|
||||
\() ->
|
||||
Expect.equal True
|
||||
(isPangram "the 1 quick brown fox jumps over the 2 lazy dogs")
|
||||
, test "missing letters replaced by numbers" <|
|
||||
, skip <|
|
||||
test "missing letters replaced by numbers" <|
|
||||
\() ->
|
||||
Expect.equal False
|
||||
(isPangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog")
|
||||
, test "pangram with mixed case and punctuation" <|
|
||||
, skip <|
|
||||
test "pangram with mixed case and punctuation" <|
|
||||
\() ->
|
||||
Expect.equal True
|
||||
(isPangram "\"Five quacking Zephyrs jolt my wax bed.\"")
|
||||
, test "pangram with non ascii characters" <|
|
||||
, skip <|
|
||||
test "pangram with non ascii characters" <|
|
||||
\() ->
|
||||
Expect.equal True
|
||||
(isPangram "Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.")
|
||||
|
|
|
@ -10,26 +10,37 @@ tests =
|
|||
describe "PhoneNumber"
|
||||
[ test "cleans number" <|
|
||||
\() -> Expect.equal (Just "1234567890") (getNumber "(123) 456-7890")
|
||||
, test "cleans number with dots" <|
|
||||
, skip <|
|
||||
test "cleans number with dots" <|
|
||||
\() -> Expect.equal (Just "1234567890") (getNumber "123.456.7890")
|
||||
, test "valid when 11 digits and first is 1" <|
|
||||
, skip <|
|
||||
test "valid when 11 digits and first is 1" <|
|
||||
\() -> Expect.equal (Just "1234567890") (getNumber "11234567890")
|
||||
, test "invalid when 11 digits" <|
|
||||
, skip <|
|
||||
test "invalid when 11 digits" <|
|
||||
\() -> Expect.equal Nothing (getNumber "21234567890")
|
||||
, test "invalid when 9 digits" <|
|
||||
, skip <|
|
||||
test "invalid when 9 digits" <|
|
||||
\() -> Expect.equal Nothing (getNumber "123456789")
|
||||
, test "invalid when 12 digits" <|
|
||||
, skip <|
|
||||
test "invalid when 12 digits" <|
|
||||
\() -> Expect.equal Nothing (getNumber "123456789012")
|
||||
, test "invalid when empty" <|
|
||||
, skip <|
|
||||
test "invalid when empty" <|
|
||||
\() -> Expect.equal Nothing (getNumber "")
|
||||
, test "invalid when no digits present" <|
|
||||
, skip <|
|
||||
test "invalid when no digits present" <|
|
||||
\() -> Expect.equal Nothing (getNumber " (-) ")
|
||||
, test "valid with leading characters" <|
|
||||
, skip <|
|
||||
test "valid with leading characters" <|
|
||||
\() -> Expect.equal (Just "1234567890") (getNumber "my number is 123 456 7890")
|
||||
, test "valid with trailing characters" <|
|
||||
, skip <|
|
||||
test "valid with trailing characters" <|
|
||||
\() -> Expect.equal (Just "1234567890") (getNumber "123 456 7890 - bob")
|
||||
, test "pretty print" <|
|
||||
, skip <|
|
||||
test "pretty print" <|
|
||||
\() -> Expect.equal (Just "(123) 456-7890") (prettyPrint "1234567890")
|
||||
, test "pretty print with full us phone number" <|
|
||||
, skip <|
|
||||
test "pretty print with full us phone number" <|
|
||||
\() -> Expect.equal (Just "(123) 456-7890") (prettyPrint "11234567890")
|
||||
]
|
||||
|
|
|
@ -10,32 +10,46 @@ tests =
|
|||
describe "Raindrops"
|
||||
[ test "1" <|
|
||||
\() -> Expect.equal "1" (raindrops 1)
|
||||
, test "3" <|
|
||||
, skip <|
|
||||
test "3" <|
|
||||
\() -> Expect.equal "Pling" (raindrops 3)
|
||||
, test "5" <|
|
||||
, skip <|
|
||||
test "5" <|
|
||||
\() -> Expect.equal "Plang" (raindrops 5)
|
||||
, test "7" <|
|
||||
, skip <|
|
||||
test "7" <|
|
||||
\() -> Expect.equal "Plong" (raindrops 7)
|
||||
, test "6" <|
|
||||
, skip <|
|
||||
test "6" <|
|
||||
\() -> Expect.equal "Pling" (raindrops 6)
|
||||
, test "9" <|
|
||||
, skip <|
|
||||
test "9" <|
|
||||
\() -> Expect.equal "Pling" (raindrops 9)
|
||||
, test "10" <|
|
||||
, skip <|
|
||||
test "10" <|
|
||||
\() -> Expect.equal "Plang" (raindrops 10)
|
||||
, test "14" <|
|
||||
, skip <|
|
||||
test "14" <|
|
||||
\() -> Expect.equal "Plong" (raindrops 14)
|
||||
, test "15" <|
|
||||
, skip <|
|
||||
test "15" <|
|
||||
\() -> Expect.equal "PlingPlang" (raindrops 15)
|
||||
, test "21" <|
|
||||
, skip <|
|
||||
test "21" <|
|
||||
\() -> Expect.equal "PlingPlong" (raindrops 21)
|
||||
, test "25" <|
|
||||
, skip <|
|
||||
test "25" <|
|
||||
\() -> Expect.equal "Plang" (raindrops 25)
|
||||
, test "35" <|
|
||||
, skip <|
|
||||
test "35" <|
|
||||
\() -> Expect.equal "PlangPlong" (raindrops 35)
|
||||
, test "49" <|
|
||||
, skip <|
|
||||
test "49" <|
|
||||
\() -> Expect.equal "Plong" (raindrops 49)
|
||||
, test "52" <|
|
||||
, skip <|
|
||||
test "52" <|
|
||||
\() -> Expect.equal "52" (raindrops 52)
|
||||
, test "105" <|
|
||||
, skip <|
|
||||
test "105" <|
|
||||
\() -> Expect.equal "PlingPlangPlong" (raindrops 105)
|
||||
]
|
||||
|
|
|
@ -10,16 +10,22 @@ tests =
|
|||
describe "RNATranscription"
|
||||
[ test "complement of cytosine is guanine" <|
|
||||
\() -> Expect.equal (Ok "G") (toRNA "C")
|
||||
, test "complement of guanine is cytosine" <|
|
||||
, skip <|
|
||||
test "complement of guanine is cytosine" <|
|
||||
\() -> Expect.equal (Ok "C") (toRNA "G")
|
||||
, test "complement of thymine is adenine" <|
|
||||
, skip <|
|
||||
test "complement of thymine is adenine" <|
|
||||
\() -> Expect.equal (Ok "A") (toRNA "T")
|
||||
, test "complement of adenine is uracil" <|
|
||||
, skip <|
|
||||
test "complement of adenine is uracil" <|
|
||||
\() -> Expect.equal (Ok "U") (toRNA "A")
|
||||
, test "complement" <|
|
||||
, skip <|
|
||||
test "complement" <|
|
||||
\() -> Expect.equal (Ok "UGCACCAGAAUU") (toRNA "ACGTGGTCTTAA")
|
||||
, test "correctly handles completely invalid input" <|
|
||||
, skip <|
|
||||
test "correctly handles completely invalid input" <|
|
||||
\() -> Expect.equal (Err 'X') (toRNA "XXX")
|
||||
, test "correctly handles partially invalid input" <|
|
||||
, skip <|
|
||||
test "correctly handles partially invalid input" <|
|
||||
\() -> Expect.equal (Err 'U') (toRNA "UGAAXXXGACAUG")
|
||||
]
|
||||
|
|
|
@ -15,7 +15,8 @@ tests =
|
|||
in
|
||||
[ test "coordinates" <|
|
||||
\() -> Expect.equal { x = 0, y = 0 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
, skip <|
|
||||
test "bearing" <|
|
||||
\() -> Expect.equal North robot.bearing
|
||||
]
|
||||
)
|
||||
|
@ -24,9 +25,11 @@ tests =
|
|||
robot =
|
||||
Robot South { x = -1, y = 1 }
|
||||
in
|
||||
[ test "coordinates" <|
|
||||
[ skip <|
|
||||
test "coordinates" <|
|
||||
\() -> Expect.equal { x = -1, y = 1 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
, skip <|
|
||||
test "bearing" <|
|
||||
\() -> Expect.equal South robot.bearing
|
||||
]
|
||||
)
|
||||
|
@ -35,7 +38,7 @@ tests =
|
|||
|> List.scanl (\_ r -> turnRight r) defaultRobot
|
||||
|> List.map .bearing
|
||||
|> assertionList [ North, East, South, West ]
|
||||
|> List.indexedMap (\i e -> test ("step " ++ toString i) (\() -> e))
|
||||
|> List.indexedMap (\i e -> skip <| test ("step " ++ toString i) (\() -> e))
|
||||
)
|
||||
, describe
|
||||
"turn left"
|
||||
|
@ -43,7 +46,7 @@ tests =
|
|||
|> List.scanl (\_ r -> turnLeft r) defaultRobot
|
||||
|> List.map .bearing
|
||||
|> assertionList [ North, West, South, East ]
|
||||
|> List.indexedMap (\i e -> test ("step " ++ toString i) (\() -> e))
|
||||
|> List.indexedMap (\i e -> skip <| test ("step " ++ toString i) (\() -> e))
|
||||
)
|
||||
, describe "advance positive north"
|
||||
(let
|
||||
|
@ -51,9 +54,11 @@ tests =
|
|||
Robot North { x = 0, y = 0 }
|
||||
|> advance
|
||||
in
|
||||
[ test "coordinates" <|
|
||||
[ skip <|
|
||||
test "coordinates" <|
|
||||
\() -> Expect.equal { x = 0, y = 1 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
, skip <|
|
||||
test "bearing" <|
|
||||
\() -> Expect.equal North robot.bearing
|
||||
]
|
||||
)
|
||||
|
@ -63,9 +68,11 @@ tests =
|
|||
Robot East { x = 0, y = 0 }
|
||||
|> advance
|
||||
in
|
||||
[ test "coordinates" <|
|
||||
[ skip <|
|
||||
test "coordinates" <|
|
||||
\() -> Expect.equal { x = 1, y = 0 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
, skip <|
|
||||
test "bearing" <|
|
||||
\() -> Expect.equal East robot.bearing
|
||||
]
|
||||
)
|
||||
|
@ -75,9 +82,11 @@ tests =
|
|||
Robot South { x = 0, y = 0 }
|
||||
|> advance
|
||||
in
|
||||
[ test "coordinates" <|
|
||||
[ skip <|
|
||||
test "coordinates" <|
|
||||
\() -> Expect.equal { x = 0, y = -1 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
, skip <|
|
||||
test "bearing" <|
|
||||
\() -> Expect.equal South robot.bearing
|
||||
]
|
||||
)
|
||||
|
@ -87,9 +96,11 @@ tests =
|
|||
Robot West { x = 0, y = 0 }
|
||||
|> advance
|
||||
in
|
||||
[ test "coordinates" <|
|
||||
[ skip <|
|
||||
test "coordinates" <|
|
||||
\() -> Expect.equal { x = -1, y = 0 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
, skip <|
|
||||
test "bearing" <|
|
||||
\() -> Expect.equal West robot.bearing
|
||||
]
|
||||
)
|
||||
|
@ -99,9 +110,11 @@ tests =
|
|||
Robot North { x = 0, y = 0 }
|
||||
|> simulate "LAAARALA"
|
||||
in
|
||||
[ test "coordinates" <|
|
||||
[ skip <|
|
||||
test "coordinates" <|
|
||||
\() -> Expect.equal { x = -4, y = 1 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
, skip <|
|
||||
test "bearing" <|
|
||||
\() -> Expect.equal West robot.bearing
|
||||
]
|
||||
)
|
||||
|
@ -111,7 +124,8 @@ tests =
|
|||
Robot East { x = 2, y = -7 }
|
||||
|> simulate "RRAAAAALA"
|
||||
in
|
||||
[ test "coordinates" <|
|
||||
[ skip <|
|
||||
test "coordinates" <|
|
||||
\() -> Expect.equal { x = -3, y = -8 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
\() -> Expect.equal South robot.bearing
|
||||
|
@ -123,9 +137,11 @@ tests =
|
|||
Robot South { x = 8, y = 4 }
|
||||
|> simulate "LAAARRRALLLL"
|
||||
in
|
||||
[ test "coordinates" <|
|
||||
[ skip <|
|
||||
test "coordinates" <|
|
||||
\() -> Expect.equal { x = 11, y = 5 } robot.coordinates
|
||||
, test "bearing" <|
|
||||
, skip <|
|
||||
test "bearing" <|
|
||||
\() -> Expect.equal North robot.bearing
|
||||
]
|
||||
)
|
||||
|
|
|
@ -12,71 +12,88 @@ tests =
|
|||
\() ->
|
||||
Expect.equal ("I")
|
||||
(toRoman 1)
|
||||
, test "2" <|
|
||||
, skip <|
|
||||
test "2" <|
|
||||
\() ->
|
||||
Expect.equal ("II")
|
||||
(toRoman 2)
|
||||
, test "3" <|
|
||||
, skip <|
|
||||
test "3" <|
|
||||
\() ->
|
||||
Expect.equal ("III")
|
||||
(toRoman 3)
|
||||
, test "4" <|
|
||||
, skip <|
|
||||
test "4" <|
|
||||
\() ->
|
||||
Expect.equal ("IV")
|
||||
(toRoman 4)
|
||||
, test "5" <|
|
||||
, skip <|
|
||||
test "5" <|
|
||||
\() ->
|
||||
Expect.equal ("V")
|
||||
(toRoman 5)
|
||||
, test "6" <|
|
||||
, skip <|
|
||||
test "6" <|
|
||||
\() ->
|
||||
Expect.equal ("VI")
|
||||
(toRoman 6)
|
||||
, test "9" <|
|
||||
, skip <|
|
||||
test "9" <|
|
||||
\() ->
|
||||
Expect.equal ("IX")
|
||||
(toRoman 9)
|
||||
, test "27" <|
|
||||
, skip <|
|
||||
test "27" <|
|
||||
\() ->
|
||||
Expect.equal ("XXVII")
|
||||
(toRoman 27)
|
||||
, test "48" <|
|
||||
, skip <|
|
||||
test "48" <|
|
||||
\() ->
|
||||
Expect.equal ("XLVIII")
|
||||
(toRoman 48)
|
||||
, test "59" <|
|
||||
, skip <|
|
||||
test "59" <|
|
||||
\() ->
|
||||
Expect.equal ("LIX")
|
||||
(toRoman 59)
|
||||
, test "93" <|
|
||||
, skip <|
|
||||
test "93" <|
|
||||
\() ->
|
||||
Expect.equal ("XCIII")
|
||||
(toRoman 93)
|
||||
, test "141" <|
|
||||
, skip <|
|
||||
test "141" <|
|
||||
\() ->
|
||||
Expect.equal ("CXLI")
|
||||
(toRoman 141)
|
||||
, test "163" <|
|
||||
, skip <|
|
||||
test "163" <|
|
||||
\() ->
|
||||
Expect.equal ("CLXIII")
|
||||
(toRoman 163)
|
||||
, test "402" <|
|
||||
, skip <|
|
||||
test "402" <|
|
||||
\() ->
|
||||
Expect.equal ("CDII")
|
||||
(toRoman 402)
|
||||
, test "575" <|
|
||||
, skip <|
|
||||
test "575" <|
|
||||
\() ->
|
||||
Expect.equal ("DLXXV")
|
||||
(toRoman 575)
|
||||
, test "911" <|
|
||||
, skip <|
|
||||
test "911" <|
|
||||
\() ->
|
||||
Expect.equal ("CMXI")
|
||||
(toRoman 911)
|
||||
, test "1024" <|
|
||||
, skip <|
|
||||
test "1024" <|
|
||||
\() ->
|
||||
Expect.equal ("MXXIV")
|
||||
(toRoman 1024)
|
||||
, test "3000" <|
|
||||
, skip <|
|
||||
test "3000" <|
|
||||
\() ->
|
||||
Expect.equal ("MMM")
|
||||
(toRoman 3000)
|
||||
|
|
|
@ -10,28 +10,36 @@ tests =
|
|||
describe "RunLengthEncoding"
|
||||
[ test "the solution is for the correct version of the test" <|
|
||||
\() -> Expect.equal 2 version
|
||||
, test "encode simple" <|
|
||||
, skip <|
|
||||
test "encode simple" <|
|
||||
\() -> Expect.equal "2A3B4C" (encode "AABBBCCCC")
|
||||
, test "decode simple" <|
|
||||
, skip <|
|
||||
test "decode simple" <|
|
||||
\() -> Expect.equal "AABBBCCCC" (decode "2A3B4C")
|
||||
, test "encode with single values" <|
|
||||
, skip <|
|
||||
test "encode with single values" <|
|
||||
\() ->
|
||||
Expect.equal "12WB12W3B24WB"
|
||||
(encode "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB")
|
||||
, test "decode with single values" <|
|
||||
, skip <|
|
||||
test "decode with single values" <|
|
||||
\() ->
|
||||
Expect.equal "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"
|
||||
(decode "12WB12W3B24WB")
|
||||
, test "(decode (encode (...)) combination" <|
|
||||
, skip <|
|
||||
test "(decode (encode (...)) combination" <|
|
||||
\() ->
|
||||
Expect.equal "zzz ZZ zZ"
|
||||
(decode (encode "zzz ZZ zZ"))
|
||||
, test "decode with a x10 value" <|
|
||||
, skip <|
|
||||
test "decode with a x10 value" <|
|
||||
\() ->
|
||||
Expect.equal "WWWWWWWWWW"
|
||||
(decode "10W")
|
||||
, test "encode unicode" <|
|
||||
, skip <|
|
||||
test "encode unicode" <|
|
||||
\() -> Expect.equal "⏰3⚽2⭐⏰" (encode "⏰⚽⚽⚽⭐⭐⏰")
|
||||
, test "decode unicode" <|
|
||||
, skip <|
|
||||
test "decode unicode" <|
|
||||
\() -> Expect.equal "⏰⚽⚽⚽⭐⭐⏰" (decode "⏰3⚽2⭐⏰")
|
||||
]
|
||||
|
|
|
@ -12,67 +12,83 @@ tests =
|
|||
\() ->
|
||||
Expect.equal (Ok "one")
|
||||
(say 1)
|
||||
, test "fourteen" <|
|
||||
, skip <|
|
||||
test "fourteen" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "fourteen")
|
||||
(say 14)
|
||||
, test "twenty" <|
|
||||
, skip <|
|
||||
test "twenty" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "twenty")
|
||||
(say 20)
|
||||
, test "twenty-two" <|
|
||||
, skip <|
|
||||
test "twenty-two" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "twenty-two")
|
||||
(say 22)
|
||||
, test "one hundred" <|
|
||||
, skip <|
|
||||
test "one hundred" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one hundred")
|
||||
(say 100)
|
||||
, test "one hundred twenty" <|
|
||||
, skip <|
|
||||
test "one hundred twenty" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one hundred and twenty")
|
||||
(say 120)
|
||||
, test "one hundred twenty-three" <|
|
||||
, skip <|
|
||||
test "one hundred twenty-three" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one hundred and twenty-three")
|
||||
(say 123)
|
||||
, test "one thousand" <|
|
||||
, skip <|
|
||||
test "one thousand" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one thousand")
|
||||
(say 1000)
|
||||
, test "one thousand two hundred thirty-four" <|
|
||||
, skip <|
|
||||
test "one thousand two hundred thirty-four" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one thousand two hundred and thirty-four")
|
||||
(say 1234)
|
||||
, test "one million" <|
|
||||
, skip <|
|
||||
test "one million" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one million")
|
||||
(say 1000000)
|
||||
, test "one million two" <|
|
||||
, skip <|
|
||||
test "one million two" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one million and two")
|
||||
(say 1000002)
|
||||
, test "1002345" <|
|
||||
, skip <|
|
||||
test "1002345" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one million two thousand three hundred and forty-five")
|
||||
(say 1002345)
|
||||
, test "one billion" <|
|
||||
, skip <|
|
||||
test "one billion" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "one billion")
|
||||
(say 1000000000)
|
||||
, test "number too large" <|
|
||||
, skip <|
|
||||
test "number too large" <|
|
||||
\() ->
|
||||
Expect.equal (Err TooLarge)
|
||||
(say 10000000000000000)
|
||||
, test "negative number" <|
|
||||
, skip <|
|
||||
test "negative number" <|
|
||||
\() ->
|
||||
Expect.equal (Err Negative)
|
||||
(say -42)
|
||||
, test "zero" <|
|
||||
, skip <|
|
||||
test "zero" <|
|
||||
\() ->
|
||||
Expect.equal (Ok "zero")
|
||||
(say 0)
|
||||
, test "987654321123" <|
|
||||
, skip <|
|
||||
test "987654321123" <|
|
||||
\() ->
|
||||
Expect.equal
|
||||
(Ok
|
||||
|
|
|
@ -10,24 +10,34 @@ tests =
|
|||
describe "Grains"
|
||||
[ test "lowercase letter" <|
|
||||
\() -> Expect.equal 1 (scoreWord "a")
|
||||
, test "uppercase letter" <|
|
||||
, skip <|
|
||||
test "uppercase letter" <|
|
||||
\() -> Expect.equal 1 (scoreWord "A")
|
||||
, test "valuable letter" <|
|
||||
, skip <|
|
||||
test "valuable letter" <|
|
||||
\() -> Expect.equal 4 (scoreWord "f")
|
||||
, test "short word" <|
|
||||
, skip <|
|
||||
test "short word" <|
|
||||
\() -> Expect.equal 2 (scoreWord "at")
|
||||
, test "short, valuable word" <|
|
||||
, skip <|
|
||||
test "short, valuable word" <|
|
||||
\() -> Expect.equal 12 (scoreWord "zoo")
|
||||
, test "medium word" <|
|
||||
, skip <|
|
||||
test "medium word" <|
|
||||
\() -> Expect.equal 6 (scoreWord "street")
|
||||
, test "medium, valuable word" <|
|
||||
, skip <|
|
||||
test "medium, valuable word" <|
|
||||
\() -> Expect.equal 22 (scoreWord "quirky")
|
||||
, test "long, mixed-case word" <|
|
||||
, skip <|
|
||||
test "long, mixed-case word" <|
|
||||
\() -> Expect.equal 41 (scoreWord "OxyphenButazone")
|
||||
, test "english-like word" <|
|
||||
, skip <|
|
||||
test "english-like word" <|
|
||||
\() -> Expect.equal 8 (scoreWord "pinata")
|
||||
, test "non-english letter is not scored" <|
|
||||
, skip <|
|
||||
test "non-english letter is not scored" <|
|
||||
\() -> Expect.equal 7 (scoreWord "piñata")
|
||||
, test "empty input" <|
|
||||
, skip <|
|
||||
test "empty input" <|
|
||||
\() -> Expect.equal 0 (scoreWord "")
|
||||
]
|
||||
|
|
|
@ -12,31 +12,38 @@ tests =
|
|||
\() ->
|
||||
Expect.equal (Ok [ [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ] ])
|
||||
(slices 1 "01234")
|
||||
, test "slices of two" <|
|
||||
, skip <|
|
||||
test "slices of two" <|
|
||||
\() ->
|
||||
Expect.equal (Ok [ [ 9, 7 ], [ 7, 8 ], [ 8, 6 ], [ 6, 7 ], [ 7, 5 ], [ 5, 6 ], [ 6, 4 ] ])
|
||||
(slices 2 "97867564")
|
||||
, test "slices of three" <|
|
||||
, skip <|
|
||||
test "slices of three" <|
|
||||
\() ->
|
||||
Expect.equal (Ok [ [ 9, 7, 8 ], [ 7, 8, 6 ], [ 8, 6, 7 ], [ 6, 7, 5 ], [ 7, 5, 6 ], [ 5, 6, 4 ] ])
|
||||
(slices 3 "97867564")
|
||||
, test "slices of four" <|
|
||||
, skip <|
|
||||
test "slices of four" <|
|
||||
\() ->
|
||||
Expect.equal (Ok [ [ 0, 1, 2, 3 ], [ 1, 2, 3, 4 ] ])
|
||||
(slices 4 "01234")
|
||||
, test "slices of five" <|
|
||||
, skip <|
|
||||
test "slices of five" <|
|
||||
\() ->
|
||||
Expect.equal (Ok [ [ 0, 1, 2, 3, 4 ] ])
|
||||
(slices 5 "01234")
|
||||
, test "overly long slice" <|
|
||||
, skip <|
|
||||
test "overly long slice" <|
|
||||
\() ->
|
||||
Expect.equal (Ok [])
|
||||
(slices 4 "012")
|
||||
, test "overly short slice" <|
|
||||
, skip <|
|
||||
test "overly short slice" <|
|
||||
\() ->
|
||||
Expect.equal (Err ("Invalid size: 0"))
|
||||
(slices 0 "01234")
|
||||
, test "input has non numbers" <|
|
||||
, skip <|
|
||||
test "input has non numbers" <|
|
||||
\() ->
|
||||
Expect.equal (Err "could not convert string 'a' to an Int")
|
||||
(slices 2 "0123abc")
|
||||
|
|
|
@ -10,18 +10,25 @@ tests =
|
|||
describe "SpaceAge"
|
||||
[ test "age in earth years" <|
|
||||
\() -> Expect.equal 32 (round (ageOn Earth 1000000000))
|
||||
, test "age in mercury years" <|
|
||||
, skip <|
|
||||
test "age in mercury years" <|
|
||||
\() -> Expect.equal 281 (round (ageOn Mercury 2134835688))
|
||||
, test "age in venus years" <|
|
||||
, skip <|
|
||||
test "age in venus years" <|
|
||||
\() -> Expect.equal 10 (round (ageOn Venus 189839836))
|
||||
, test "age on mars" <|
|
||||
, skip <|
|
||||
test "age on mars" <|
|
||||
\() -> Expect.equal 39 (round (ageOn Mars 2329871239))
|
||||
, test "age on jupiter" <|
|
||||
, skip <|
|
||||
test "age on jupiter" <|
|
||||
\() -> Expect.equal 2 (round (ageOn Jupiter 901876382))
|
||||
, test "age on saturn" <|
|
||||
, skip <|
|
||||
test "age on saturn" <|
|
||||
\() -> Expect.equal 3 (round (ageOn Saturn 3000000000))
|
||||
, test "age on uranus" <|
|
||||
, skip <|
|
||||
test "age on uranus" <|
|
||||
\() -> Expect.equal 1 (round (ageOn Uranus 3210123456))
|
||||
, test "age on neptune" <|
|
||||
, skip <|
|
||||
test "age on neptune" <|
|
||||
\() -> Expect.equal 2 (round (ageOn Neptune 8210123456))
|
||||
]
|
||||
|
|
|
@ -33,47 +33,58 @@ tests =
|
|||
\() ->
|
||||
Expect.equal []
|
||||
(keep lessThanTen [])
|
||||
, test "keep everything" <|
|
||||
, skip <|
|
||||
test "keep everything" <|
|
||||
\() ->
|
||||
Expect.equal [ 1, 2, 3 ]
|
||||
(keep lessThanTen [ 1, 2, 3 ])
|
||||
, test "keep first and last" <|
|
||||
, skip <|
|
||||
test "keep first and last" <|
|
||||
\() ->
|
||||
Expect.equal [ 1, 3 ]
|
||||
(keep odd [ 1, 2, 3 ])
|
||||
, test "keep nothing" <|
|
||||
, skip <|
|
||||
test "keep nothing" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(keep even [ 1, 3, 5, 7 ])
|
||||
, test "keep neither first nor last" <|
|
||||
, skip <|
|
||||
test "keep neither first nor last" <|
|
||||
\() ->
|
||||
Expect.equal [ 2 ]
|
||||
(keep even [ 1, 2, 3 ])
|
||||
, test "keep strings" <|
|
||||
, skip <|
|
||||
test "keep strings" <|
|
||||
\() ->
|
||||
Expect.equal [ "zebra", "zombies", "zealot" ]
|
||||
(keep (isFirstLetter "z") [ "apple", "zebra", "banana", "zombies", "cherimoya", "zealot" ])
|
||||
, test "empty discard" <|
|
||||
, skip <|
|
||||
test "empty discard" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(discard lessThanTen [])
|
||||
, test "discard everything" <|
|
||||
, skip <|
|
||||
test "discard everything" <|
|
||||
\() ->
|
||||
Expect.equal []
|
||||
(discard lessThanTen [ 1, 2, 3 ])
|
||||
, test "discard first and last" <|
|
||||
, skip <|
|
||||
test "discard first and last" <|
|
||||
\() ->
|
||||
Expect.equal [ 2 ]
|
||||
(discard odd [ 1, 2, 3 ])
|
||||
, test "discard nothing" <|
|
||||
, skip <|
|
||||
test "discard nothing" <|
|
||||
\() ->
|
||||
Expect.equal [ 1, 3, 5, 7 ]
|
||||
(discard even [ 1, 3, 5, 7 ])
|
||||
, test "discard neither first nor last" <|
|
||||
, skip <|
|
||||
test "discard neither first nor last" <|
|
||||
\() ->
|
||||
Expect.equal [ 1, 3 ]
|
||||
(discard even [ 1, 2, 3 ])
|
||||
, test "discard strings" <|
|
||||
, skip <|
|
||||
test "discard strings" <|
|
||||
\() ->
|
||||
Expect.equal [ "apple", "banana", "cherimoya" ]
|
||||
(discard (isFirstLetter "z") [ "apple", "zebra", "banana", "zombies", "cherimoya", "zealot" ])
|
||||
|
|
|
@ -10,40 +10,58 @@ tests =
|
|||
describe "Sublist"
|
||||
[ test "the solution is for the correct version of the test" <|
|
||||
\() -> Expect.equal 2 version
|
||||
, test "empty equals empty" <|
|
||||
, skip <|
|
||||
test "empty equals empty" <|
|
||||
\() -> Expect.equal Equal (sublist [] [])
|
||||
, test "empty is a sublist of anything" <|
|
||||
, skip <|
|
||||
test "empty is a sublist of anything" <|
|
||||
\() -> Expect.equal Sublist (sublist [] [ 1, 2 ])
|
||||
, test "anything is a superlist of empty" <|
|
||||
, skip <|
|
||||
test "anything is a superlist of empty" <|
|
||||
\() -> Expect.equal Superlist (sublist [ 1, 2 ] [])
|
||||
, test "1 is not 2" <|
|
||||
, skip <|
|
||||
test "1 is not 2" <|
|
||||
\() -> Expect.equal Unequal (sublist [ 1 ] [ 2 ])
|
||||
, test "compare larger equal lists" <|
|
||||
, skip <|
|
||||
test "compare larger equal lists" <|
|
||||
\() -> Expect.equal Equal (sublist [ 1, 1, 1 ] [ 1, 1, 1 ])
|
||||
, test "sublist at start" <|
|
||||
, skip <|
|
||||
test "sublist at start" <|
|
||||
\() -> Expect.equal Sublist (sublist [ 1, 2, 3 ] [ 1, 2, 3, 4, 5 ])
|
||||
, test "sublist in the middle" <|
|
||||
, skip <|
|
||||
test "sublist in the middle" <|
|
||||
\() -> Expect.equal Sublist (sublist [ 4, 3, 2 ] [ 5, 4, 3, 2, 1 ])
|
||||
, test "sublist at end" <|
|
||||
, skip <|
|
||||
test "sublist at end" <|
|
||||
\() -> Expect.equal Sublist (sublist [ 3, 4, 5 ] [ 1, 2, 3, 4, 5 ])
|
||||
, test "partially matching sublist at start" <|
|
||||
, skip <|
|
||||
test "partially matching sublist at start" <|
|
||||
\() -> Expect.equal Sublist (sublist [ 1, 1, 2 ] [ 1, 1, 1, 2 ])
|
||||
, test "sublist early in huge list" <|
|
||||
, skip <|
|
||||
test "sublist early in huge list" <|
|
||||
\() -> Expect.equal Sublist (sublist [ 3, 4, 5 ] (List.range 1 100000))
|
||||
, test "huge sublist not in list" <|
|
||||
, skip <|
|
||||
test "huge sublist not in list" <|
|
||||
\() -> Expect.equal Unequal (sublist (List.range 10 5001) (List.range 1 5000))
|
||||
, test "superlist at start" <|
|
||||
, skip <|
|
||||
test "superlist at start" <|
|
||||
\() -> Expect.equal Superlist (sublist [ 1, 2, 3, 4, 5 ] [ 1, 2, 3 ])
|
||||
, test "superlist in middle" <|
|
||||
, skip <|
|
||||
test "superlist in middle" <|
|
||||
\() -> Expect.equal Superlist (sublist [ 5, 4, 3, 2, 1 ] [ 4, 3, 2 ])
|
||||
, test "superlist at end" <|
|
||||
, skip <|
|
||||
test "superlist at end" <|
|
||||
\() -> Expect.equal Superlist (sublist [ 1, 2, 3, 4, 5 ] [ 3, 4, 5 ])
|
||||
, test "partially matching superlist at start" <|
|
||||
, skip <|
|
||||
test "partially matching superlist at start" <|
|
||||
\() -> Expect.equal Superlist (sublist [ 1, 1, 1, 2 ] [ 1, 1, 2 ])
|
||||
, test "superlist early in huge list" <|
|
||||
, skip <|
|
||||
test "superlist early in huge list" <|
|
||||
\() -> Expect.equal Superlist (sublist (List.range 1 100000) [ 3, 4, 5 ])
|
||||
, test "recurring values sublist" <|
|
||||
, skip <|
|
||||
test "recurring values sublist" <|
|
||||
\() -> Expect.equal Sublist (sublist [ 1, 2, 1, 2, 3 ] [ 1, 2, 3, 1, 2, 1, 2, 3, 2, 1 ])
|
||||
, test "recurring values unequal" <|
|
||||
, skip <|
|
||||
test "recurring values unequal" <|
|
||||
\() -> Expect.equal Unequal (sublist [ 1, 2, 1, 2, 3 ] [ 1, 2, 3, 1, 2, 3, 2, 3, 2, 1 ])
|
||||
]
|
||||
|
|
|
@ -10,14 +10,19 @@ tests =
|
|||
describe "Sum Of Multiples"
|
||||
[ test "[3, 5] 15" <|
|
||||
\() -> Expect.equal 45 (sumOfMultiples [ 3, 5 ] 15)
|
||||
, test "[7, 13, 17] 20" <|
|
||||
, skip <|
|
||||
test "[7, 13, 17] 20" <|
|
||||
\() -> Expect.equal 51 (sumOfMultiples [ 7, 13, 17 ] 20)
|
||||
, test "[4, 6] 15" <|
|
||||
, skip <|
|
||||
test "[4, 6] 15" <|
|
||||
\() -> Expect.equal 30 (sumOfMultiples [ 4, 6 ] 15)
|
||||
, test "[5, 6, 8] 150" <|
|
||||
, skip <|
|
||||
test "[5, 6, 8] 150" <|
|
||||
\() -> Expect.equal 4419 (sumOfMultiples [ 5, 6, 8 ] 150)
|
||||
, test "[43, 47] 10000" <|
|
||||
, skip <|
|
||||
test "[43, 47] 10000" <|
|
||||
\() -> Expect.equal 2203160 (sumOfMultiples [ 43, 47 ] 10000)
|
||||
, test "[5, 25] 51" <|
|
||||
, skip <|
|
||||
test "[5, 25] 51" <|
|
||||
\() -> Expect.equal 275 (sumOfMultiples [ 5, 25 ] 51)
|
||||
]
|
||||
|
|
|
@ -10,30 +10,43 @@ tests =
|
|||
describe "triangleKind"
|
||||
[ test "equilateral triangles have equal sides" <|
|
||||
\() -> Expect.equal (Ok Equilateral) (triangleKind 2 2 2)
|
||||
, test "larger equilateral triangles also have equal sides" <|
|
||||
, skip <|
|
||||
test "larger equilateral triangles also have equal sides" <|
|
||||
\() -> Expect.equal (Ok Equilateral) (triangleKind 10 10 10)
|
||||
, test "isosceles triangles have last two sides equal" <|
|
||||
, skip <|
|
||||
test "isosceles triangles have last two sides equal" <|
|
||||
\() -> Expect.equal (Ok Isosceles) (triangleKind 3 4 4)
|
||||
, test "isosceles triangles have first and last sides equal" <|
|
||||
, skip <|
|
||||
test "isosceles triangles have first and last sides equal" <|
|
||||
\() -> Expect.equal (Ok Isosceles) (triangleKind 4 3 4)
|
||||
, test "isosceles triangles have two first sides equal" <|
|
||||
, skip <|
|
||||
test "isosceles triangles have two first sides equal" <|
|
||||
\() -> Expect.equal (Ok Isosceles) (triangleKind 4 4 3)
|
||||
, test "isosceles triangles have in fact exactly two sides equal" <|
|
||||
, skip <|
|
||||
test "isosceles triangles have in fact exactly two sides equal" <|
|
||||
\() -> Expect.equal (Ok Isosceles) (triangleKind 10 10 2)
|
||||
, test "scalene triangles have no equal sides" <|
|
||||
, skip <|
|
||||
test "scalene triangles have no equal sides" <|
|
||||
\() -> Expect.equal (Ok Scalene) (triangleKind 3 4 5)
|
||||
, test "scalene triangles have no equal sides at a larger scale too" <|
|
||||
, skip <|
|
||||
test "scalene triangles have no equal sides at a larger scale too" <|
|
||||
\() -> Expect.equal (Ok Scalene) (triangleKind 10 11 12)
|
||||
, test "scalene triangles have no equal sides at a larger scale too 2" <|
|
||||
, skip <|
|
||||
test "scalene triangles have no equal sides at a larger scale too 2" <|
|
||||
\() -> Expect.equal (Ok Scalene) (triangleKind 5 4 2)
|
||||
, test "very small triangles are legal" <|
|
||||
, skip <|
|
||||
test "very small triangles are legal" <|
|
||||
\() -> Expect.equal (Ok Scalene) (triangleKind 0.4 0.6 0.3)
|
||||
, test "triangles with no size are illegal" <|
|
||||
, skip <|
|
||||
test "triangles with no size are illegal" <|
|
||||
\() -> Expect.equal (Err "Invalid lengths") (triangleKind 0 0 0)
|
||||
, test "triangles with negative sides are illegal" <|
|
||||
, skip <|
|
||||
test "triangles with negative sides are illegal" <|
|
||||
\() -> Expect.equal (Err "Invalid lengths") (triangleKind 3 4 -5)
|
||||
, test "triangles violating triangle inequality are illegal 1" <|
|
||||
, skip <|
|
||||
test "triangles violating triangle inequality are illegal 1" <|
|
||||
\() -> Expect.equal (Err "Violates inequality") (triangleKind 1 1 3)
|
||||
, test "triangles violating triangle inequality are illegal 2" <|
|
||||
, skip <|
|
||||
test "triangles violating triangle inequality are illegal 2" <|
|
||||
\() -> Expect.equal (Err "Violates inequality") (triangleKind 7 3 2)
|
||||
]
|
||||
|
|
|
@ -13,23 +13,28 @@ tests =
|
|||
\() ->
|
||||
Expect.equal [ ( "word", 1 ) ]
|
||||
(wordCount "word" |> Dict.toList)
|
||||
, test "count one of each word" <|
|
||||
, skip <|
|
||||
test "count one of each word" <|
|
||||
\() ->
|
||||
Expect.equal [ ( "each", 1 ), ( "of", 1 ), ( "one", 1 ) ]
|
||||
(wordCount "one of each" |> Dict.toList)
|
||||
, test "multiple occurrences of a word" <|
|
||||
, skip <|
|
||||
test "multiple occurrences of a word" <|
|
||||
\() ->
|
||||
Expect.equal [ ( "blue", 1 ), ( "fish", 4 ), ( "one", 1 ), ( "red", 1 ), ( "two", 1 ) ]
|
||||
(wordCount "one fish two fish red fish blue fish" |> Dict.toList)
|
||||
, test "ignore punctuation" <|
|
||||
, skip <|
|
||||
test "ignore punctuation" <|
|
||||
\() ->
|
||||
Expect.equal [ ( "as", 1 ), ( "car", 1 ), ( "carpet", 1 ), ( "java", 1 ), ( "javascript", 1 ) ]
|
||||
(wordCount "car : carpet as java : javascript!!&@$%^&" |> Dict.toList)
|
||||
, test "include numbers" <|
|
||||
, skip <|
|
||||
test "include numbers" <|
|
||||
\() ->
|
||||
Expect.equal [ ( "1", 1 ), ( "2", 1 ), ( "testing", 2 ) ]
|
||||
(wordCount "testing, 1, 2 testing" |> Dict.toList)
|
||||
, test "normalize case" <|
|
||||
, skip <|
|
||||
test "normalize case" <|
|
||||
\() ->
|
||||
Expect.equal [ ( "go", 3 ), ( "stop", 2 ) ]
|
||||
(wordCount "go Go GO Stop stop" |> Dict.toList)
|
||||
|
|
Loading…
Reference in a new issue