|
|
|
@ -125,7 +125,7 @@
|
|
|
|
|
let count = |
|
|
|
|
Regex.Split(text, @"(?<=[\.\!\?]\s)") |
|
|
|
|
|> Array.length |
|
|
|
|
(count - 1) // Split creates an extra (empty) item at end. |
|
|
|
|
count |
|
|
|
|
|
|
|
|
|
let private endsAsIntended (text: string) = |
|
|
|
|
match text.Chars (text.Length - 1) with |
|
|
|
@ -212,29 +212,33 @@
|
|
|
|
|
Assert.True(result) |
|
|
|
|
|
|
|
|
|
[<Fact>] |
|
|
|
|
let ``RequestTextFromFile returns a string which ends with a full stop when using console-waterworks-announcement`` () = |
|
|
|
|
let ``RequestTextFromFile returns a string which ends with the correct end-token when using console-waterworks-announcement`` () = |
|
|
|
|
let result = |
|
|
|
|
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) ConsoleWaterworks |
|
|
|
|
|> Async.RunSynchronously |
|
|
|
|
Assert.EndsWith(".", result) |
|
|
|
|
|> endsAsIntended |
|
|
|
|
Assert.True(result) |
|
|
|
|
|
|
|
|
|
[<Fact>] |
|
|
|
|
let ``RequestTextFromFile returns a sting which ends with a full stop when using desktop-clock-info`` () = |
|
|
|
|
let ``RequestTextFromFile returns a sting which ends with the correct end-token when using desktop-clock-info`` () = |
|
|
|
|
let result = |
|
|
|
|
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) DesktopClock |
|
|
|
|
|> Async.RunSynchronously |
|
|
|
|
Assert.EndsWith(".", result) |
|
|
|
|
|> endsAsIntended |
|
|
|
|
Assert.True(result) |
|
|
|
|
|
|
|
|
|
[<Fact>] |
|
|
|
|
let ``RequestTextFromFile returns a sting which ends with a full stop when using test-post`` () = |
|
|
|
|
let ``RequestTextFromFile returns a sting which ends with the correct end-token when using test-post`` () = |
|
|
|
|
let result = |
|
|
|
|
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) TestPost |
|
|
|
|
|> Async.RunSynchronously |
|
|
|
|
Assert.EndsWith(".", result) |
|
|
|
|
|> endsAsIntended |
|
|
|
|
Assert.True(result) |
|
|
|
|
|
|
|
|
|
[<Fact>] |
|
|
|
|
let ``RequestTextFromFile returns a sting which ends with a full stop when using word-generator`` () = |
|
|
|
|
let ``RequestTextFromFile returns a sting which ends with the correct end-token when using word-generator`` () = |
|
|
|
|
let result = |
|
|
|
|
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) WordGenerator |
|
|
|
|
|> Async.RunSynchronously |
|
|
|
|
Assert.EndsWith(".", result) |
|
|
|
|
|> endsAsIntended |
|
|
|
|
Assert.True(result) |