learning F#, it seems pretty cool, favourite functional language so far.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

BobTests.fs 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // This file was auto-generated based on version 1.6.0 of the canonical data.
  2. module BobTests
  3. open FsUnit.Xunit
  4. open Xunit
  5. open Bob
  6. [<Fact>]
  7. let ``Stating something`` () =
  8. response "Tom-ay-to, tom-aaaah-to." |> should equal "Whatever."
  9. [<Fact>]
  10. let ``Shouting`` () =
  11. response "WATCH OUT!" |> should equal "Whoa, chill out!"
  12. [<Fact>]
  13. let ``Shouting gibberish`` () =
  14. response "FCECDFCAAB" |> should equal "Whoa, chill out!"
  15. [<Fact>]
  16. let ``Asking a question`` () =
  17. response "Does this cryogenic chamber make me look fat?" |> should equal "Sure."
  18. [<Fact>]
  19. let ``Asking a numeric question`` () =
  20. response "You are, what, like 15?" |> should equal "Sure."
  21. [<Fact>]
  22. let ``Asking gibberish`` () =
  23. response "fffbbcbeab?" |> should equal "Sure."
  24. [<Fact>]
  25. let ``Talking forcefully`` () =
  26. response "Hi there!" |> should equal "Whatever."
  27. [<Fact>]
  28. let ``Using acronyms in regular speech`` () =
  29. response "It's OK if you don't want to go work for NASA." |> should equal "Whatever."
  30. [<Fact>]
  31. let ``Forceful question`` () =
  32. response "WHAT'S GOING ON?" |> should equal "Calm down, I know what I'm doing!"
  33. [<Fact>]
  34. let ``Shouting numbers`` () =
  35. response "1, 2, 3 GO!" |> should equal "Whoa, chill out!"
  36. [<Fact>]
  37. let ``No letters`` () =
  38. response "1, 2, 3" |> should equal "Whatever."
  39. [<Fact>]
  40. let ``Question with no letters`` () =
  41. response "4?" |> should equal "Sure."
  42. [<Fact>]
  43. let ``Shouting with special characters`` () =
  44. response "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!" |> should equal "Whoa, chill out!"
  45. [<Fact>]
  46. let ``Shouting with no exclamation mark`` () =
  47. response "I HATE THE DENTIST" |> should equal "Whoa, chill out!"
  48. [<Fact>]
  49. let ``Statement containing question mark`` () =
  50. response "Ending with ? means a question." |> should equal "Whatever."
  51. [<Fact>]
  52. let ``Non-letters with question`` () =
  53. response ":) ?" |> should equal "Sure."
  54. [<Fact>]
  55. let ``Prattling on`` () =
  56. response "Wait! Hang on. Are you going to be OK?" |> should equal "Sure."
  57. [<Fact>]
  58. let ``Silence`` () =
  59. response "" |> should equal "Fine. Be that way!"
  60. [<Fact>]
  61. let ``Prolonged silence`` () =
  62. response " " |> should equal "Fine. Be that way!"
  63. [<Fact>]
  64. let ``Alternate silence`` () =
  65. response "\t\t\t\t\t\t\t\t\t\t" |> should equal "Fine. Be that way!"
  66. [<Fact>]
  67. let ``Multiple line question`` () =
  68. response "\nDoes this cryogenic chamber make me look fat?\nNo." |> should equal "Whatever."
  69. [<Fact>]
  70. let ``Starting with whitespace`` () =
  71. response " hmmmmmmm..." |> should equal "Whatever."
  72. [<Fact>]
  73. let ``Ending with whitespace`` () =
  74. response "Okay if like my spacebar quite a bit? " |> should equal "Sure."
  75. [<Fact>]
  76. let ``Other whitespace`` () =
  77. response "\n\r \t" |> should equal "Fine. Be that way!"
  78. [<Fact>]
  79. let ``Non-question ending with whitespace`` () =
  80. response "This is a statement ending with whitespace " |> should equal "Whatever."