Skip to content

Commit

Permalink
Merge pull request #103 from ErikSchierboom/pangram
Browse files Browse the repository at this point in the history
Add pangram exercise
  • Loading branch information
ErikSchierboom committed Apr 12, 2016
2 parents 3acb8d5 + d5234d8 commit badc427
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"clock",
"series",
"strain",
"pangram",
"atbash-cipher",
"grade-school",
"raindrops",
Expand Down
6 changes: 6 additions & 0 deletions exercises/pangram/Example.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Pangram

let isPangram (input: string) =
let normalized = input.ToLowerInvariant()

['a'..'z'] |> List.forall (fun l -> normalized.Contains(l.ToString()))
34 changes: 34 additions & 0 deletions exercises/pangram/PangramTest.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module PangramTest

open NUnit.Framework

open Pangram

[<Test>]
let ``Empty sentence`` () =
let input = ""
Assert.That(isPangram input, Is.False)

[<Test>]
[<Ignore("Remove to run test")>]
let ``Pangram with only lower case`` () =
let input = "the quick brown fox jumps over the lazy dog"
Assert.That(isPangram input, Is.True)

[<Test>]
[<Ignore("Remove to run test")>]
let ``Missing character 'x'`` () =
let input = "a quick movement of the enemy will jeopardize five gunboats"
Assert.That(isPangram input, Is.False)

[<Test>]
[<Ignore("Remove to run test")>]
let ``Pangram with mixed case and punctuation`` () =
let input = "\"Five quacking Zephyrs jolt my wax bed.\""
Assert.That(isPangram input, Is.True)

[<Test>]
[<Ignore("Remove to run test")>]
let ``Pangram with non ascii characters`` () =
let input = "Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich."
Assert.That(isPangram input, Is.True)

0 comments on commit badc427

Please sign in to comment.