2016-08-17 11:14:17 +00:00
|
|
|
port module Main exposing (..)
|
2016-03-14 00:15:06 +00:00
|
|
|
|
2016-12-17 19:28:59 +00:00
|
|
|
import Test.Runner.Node exposing (run, TestProgram)
|
2016-08-17 11:14:17 +00:00
|
|
|
import Json.Encode exposing (Value)
|
|
|
|
import Test exposing (..)
|
|
|
|
import Expect
|
2016-03-14 00:15:06 +00:00
|
|
|
import Pangram exposing (isPangram)
|
|
|
|
|
|
|
|
|
|
|
|
tests : Test
|
|
|
|
tests =
|
2016-08-17 11:14:17 +00:00
|
|
|
describe "Pangram"
|
|
|
|
[ test "sentence empty" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal False
|
|
|
|
(isPangram "")
|
|
|
|
, test "pangram with only lower case" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal True
|
|
|
|
(isPangram "the quick brown fox jumps over the lazy dog")
|
|
|
|
, test "missing character 'x'" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal False
|
|
|
|
(isPangram "a quick movement of the enemy will jeopardize five gunboats")
|
2016-12-27 08:47:11 +00:00
|
|
|
, test "missing character 'z'" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal False
|
|
|
|
(isPangram "a quick movement of the enemy will jeopardixe five gunboats")
|
2016-08-17 11:14:17 +00:00
|
|
|
, test "another missing character 'x'" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal False
|
|
|
|
(isPangram "the quick brown fish jumps over the lazy dog")
|
|
|
|
, test "pangram with underscores" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal True
|
|
|
|
(isPangram "the_quick_brown_fox_jumps_over_the_lazy_dog")
|
|
|
|
, 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" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal False
|
|
|
|
(isPangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog")
|
|
|
|
, test "pangram with mixed case and punctuation" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal True
|
|
|
|
(isPangram "\"Five quacking Zephyrs jolt my wax bed.\"")
|
|
|
|
, test "pangram with non ascii characters" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal True
|
|
|
|
(isPangram "Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.")
|
2016-06-19 21:46:13 +00:00
|
|
|
]
|
2016-03-14 00:15:06 +00:00
|
|
|
|
|
|
|
|
2016-12-17 19:28:59 +00:00
|
|
|
main : TestProgram
|
2016-05-13 02:26:52 +00:00
|
|
|
main =
|
2016-08-17 11:14:17 +00:00
|
|
|
run emit tests
|
|
|
|
|
|
|
|
|
|
|
|
port emit : ( String, Value ) -> Cmd msg
|