|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
open System |
|
|
|
|
open System.IO |
|
|
|
|
open InputGeneration |
|
|
|
|
open System.Text.RegularExpressions |
|
|
|
|
|
|
|
|
|
module ``File Access Tests`` = |
|
|
|
|
|
|
|
|
@ -111,14 +112,28 @@
|
|
|
|
|
|
|
|
|
|
module ``Contents Tests`` = |
|
|
|
|
|
|
|
|
|
// This function is mostly for the "cleaning" functions, hence placement. |
|
|
|
|
// Feel free to use through this module if needed. |
|
|
|
|
let private countSentences text = |
|
|
|
|
Regex.Split(text, @"(?<=[\.\!\?]\s)") |
|
|
|
|
|> Array.length |
|
|
|
|
|
|
|
|
|
[<Fact>] |
|
|
|
|
let ``CleanResult returns a string with a full stop`` () = |
|
|
|
|
let text = "This is a sentence. And, so is this. This shouldn't be here! How about this? No!" |
|
|
|
|
let result = |
|
|
|
|
Pancake.CleanResult (Random().Next(1, 6)) text |
|
|
|
|
Pancake.CleanResult (Random().Next(1, 5)) DefaultTestSentence |
|
|
|
|
|> Async.RunSynchronously |
|
|
|
|
Assert.Contains(".", result) |
|
|
|
|
|
|
|
|
|
[<Fact>] |
|
|
|
|
let ``CleanResult returns intended number of sentences`` () = |
|
|
|
|
let desiredSentencesCount = (Random().Next(1,5)) |
|
|
|
|
let result = |
|
|
|
|
Pancake.CleanResult desiredSentencesCount DefaultTestSentence |
|
|
|
|
|> Async.RunSynchronously |
|
|
|
|
|> countSentences |
|
|
|
|
Assert.Equal(desiredSentencesCount, (result - 1)) |
|
|
|
|
|
|
|
|
|
// YOU ARE HERE... |
|
|
|
|
// - ADD TESTS FOR "CLEANING" FUNCTIONS |
|
|
|
|
|
|
|
|
|