learning F#, it seems pretty cool, favourite functional language so far.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProverbTests.fs 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // This file was auto-generated based on version 1.1.0 of the canonical data.
  2. module ProverbTests
  3. open FsUnit.Xunit
  4. open Xunit
  5. open Proverb
  6. [<Fact>]
  7. let ``Zero pieces`` () =
  8. let strings: string list = []
  9. let expected: string list = []
  10. recite strings |> should equal expected
  11. [<Fact>]
  12. let ``One piece`` () =
  13. let strings = ["nail"]
  14. let expected = ["And all for the want of a nail."]
  15. recite strings |> should equal expected
  16. [<Fact>]
  17. let ``Two pieces`` () =
  18. let strings = ["nail"; "shoe"]
  19. let expected =
  20. [ "For want of a nail the shoe was lost.";
  21. "And all for the want of a nail." ]
  22. recite strings |> should equal expected
  23. [<Fact>]
  24. let ``Three pieces`` () =
  25. let strings = ["nail"; "shoe"; "horse"]
  26. let expected =
  27. [ "For want of a nail the shoe was lost.";
  28. "For want of a shoe the horse was lost.";
  29. "And all for the want of a nail." ]
  30. recite strings |> should equal expected
  31. [<Fact>]
  32. let ``Full proverb`` () =
  33. let strings = ["nail"; "shoe"; "horse"; "rider"; "message"; "battle"; "kingdom"]
  34. let expected =
  35. [ "For want of a nail the shoe was lost.";
  36. "For want of a shoe the horse was lost.";
  37. "For want of a horse the rider was lost.";
  38. "For want of a rider the message was lost.";
  39. "For want of a message the battle was lost.";
  40. "For want of a battle the kingdom was lost.";
  41. "And all for the want of a nail." ]
  42. recite strings |> should equal expected
  43. [<Fact>]
  44. let ``Four pieces modernized`` () =
  45. let strings = ["pin"; "gun"; "soldier"; "battle"]
  46. let expected =
  47. [ "For want of a pin the gun was lost.";
  48. "For want of a gun the soldier was lost.";
  49. "For want of a soldier the battle was lost.";
  50. "And all for the want of a pin." ]
  51. recite strings |> should equal expected