Browse Source

Fixed OBOB in found in "cleaning" unit tests.

master
Craig Oates 6 years ago
parent
commit
a2ad9b28e2
  1. 22
      TestCentre/UnitTests.fs
  2. 5
      WetPancake/DataServices.fs

22
TestCentre/UnitTests.fs

@ -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)

5
WetPancake/DataServices.fs

@ -87,10 +87,9 @@
SplitText splits the text and adds a space at the split.
This leads to the text having double-spaces when concatenated back together.
*)
// NOT QUITE RIGHT. PRODUCING RANDOM OBOBS.
let RemoveArtifactSentences noOfSentences text =
text
|> SplitText @"(?<=[\.\!\?]\s)"
|> Array.take noOfSentences
|> Array.take (noOfSentences - 1)
|> ConcatToString
|> ReplaceArtifact " " // <- MY MONEY IS HERE...
|> ReplaceArtifact " "
Loading…
Cancel
Save