The purpose of this repository is to provide a way for people to generate random "placeholder text" -- with a Markov Chain.
https://www.craigoates.net/Software/project/12
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.
181 lines
8.0 KiB
181 lines
8.0 KiB
module PropertyTests |
|
|
|
open FsCheck |
|
open global.Xunit |
|
open FsCheck.Xunit |
|
open WetPancake |
|
open TestingConstants |
|
open System.Diagnostics |
|
open Helpers |
|
open InputGeneration |
|
|
|
module ``Contents Test`` = |
|
|
|
[<Property>] |
|
let ``CleanResult returns a string which ends with the correct end-token`` () = |
|
let test () = |
|
Pancake.CleanResultAsync (DefaultSentenceCount()) DefaultTestSentence |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``CleanResult returns intended number of sentences`` () = |
|
let desiredSentencesCount = (DefaultSentenceCount()) |
|
let test () = |
|
Pancake.CleanResultAsync desiredSentencesCount DefaultTestSentence |
|
|> Async.RunSynchronously |
|
|> CountSentences |
|
test () = desiredSentencesCount |
|
|
|
[<Property>] |
|
let ``RequestAllTemplateFiles does not return an empty list`` () = |
|
let test () = Pancake.RequestAllTemplateFiles () |
|
List.isEmpty (test ()) = false |
|
|
|
[<Property>] |
|
let ``RequestCleanText returns a string which ends with the correct end-token`` () = |
|
let test () = |
|
Pancake.RequestCleanTextAsync (ValidGibberishLevelInput()) 4 |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
|
|
[<Property>] |
|
let ``RequestCleanText returns intended number of sentences`` () = |
|
let desiredSentencesCount = (ValidSentencesInput()) |
|
let test () = |
|
Pancake.RequestCleanTextAsync (ValidGibberishLevelInput()) desiredSentencesCount |
|
|> Async.RunSynchronously |
|
|> CountSentences |
|
test () = desiredSentencesCount |
|
|
|
[<Property>] |
|
let ``RequestCleanTextFromFile returns a string which ends with the correct end-token when using console-waterworks-announcement`` () = |
|
let test () = |
|
Pancake.RequestCleanTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) ConsoleWaterworks |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``RequestCleanTextFromFile returns a string which ends with the correct end-token when using desktop-clock-info`` () = |
|
let test () = |
|
Pancake.RequestCleanTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) DesktopClock |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``RequestCleanTextFromFile returns a string which ends with the correct end-token when using test-post`` () = |
|
let test () = |
|
Pancake.RequestCleanTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) TestPost |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``RequestCleanTextFromFile returns a string which ends with the correct end-token when using word-generator`` () = |
|
let test () = |
|
Pancake.RequestCleanTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) WordGenerator |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``RequestCleanTextFromFile returns intended number of strings when using console-waterworks-announcement`` () = |
|
let desiredSentencesCount = (ValidSentencesInput()) |
|
let test () = |
|
Pancake.RequestCleanTextFromFileAsync (ValidGibberishLevelInput()) desiredSentencesCount ConsoleWaterworks |
|
|> Async.RunSynchronously |
|
|> CountSentences |
|
test () = desiredSentencesCount |
|
|
|
[<Property>] |
|
let ``RequestCleanTextFromFile returns intended number of strings when using desktop-clock-info`` () = |
|
let desiredSentencesCount = (ValidSentencesInput()) |
|
let test () = |
|
Pancake.RequestCleanTextFromFileAsync (ValidGibberishLevelInput()) desiredSentencesCount DesktopClock |
|
|> Async.RunSynchronously |
|
|> CountSentences |
|
test () = desiredSentencesCount |
|
|
|
[<Property>] |
|
let ``RequestCleanTextFromFile returns intended number of strings when using test-post`` () = |
|
let desiredSentencesCount = (ValidSentencesInput()) |
|
let test () = |
|
Pancake.RequestCleanTextFromFileAsync (ValidGibberishLevelInput()) desiredSentencesCount TestPost |
|
|> Async.RunSynchronously |
|
|> CountSentences |
|
test () = desiredSentencesCount |
|
|
|
[<Property>] |
|
let ``RequestCleanTextFromFile returns intended number of strings when using word-generator`` () = |
|
let desiredSentencesCount = (ValidSentencesInput()) |
|
let test () = |
|
Pancake.RequestCleanTextFromFileAsync (ValidGibberishLevelInput()) desiredSentencesCount WordGenerator |
|
|> Async.RunSynchronously |
|
|> CountSentences |
|
test () = desiredSentencesCount |
|
|
|
[<Property>] |
|
let ``RequestRandomText returns a string which ends with the correct end-token`` () = |
|
let test () = |
|
Pancake.RequestRandomTextAsync () |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``RequestText returns a string which ends with the correct end-token`` () = |
|
let test () = |
|
Pancake.RequestTextAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
|
|
[<Property>] |
|
let ``RequestTextFromFile returns a string which ends with with the correct end-token when using console-waterwork-announcement`` () = |
|
let test () = |
|
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) ConsoleWaterworks |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``RequestTextFromFile returns a string which ends with with the correct end-token when using desktop-clock-info`` () = |
|
let test () = |
|
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) DesktopClock |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
|
|
[<Property>] |
|
let ``RequestTextFromFile returns a string which ends with with the correct end-token when using test-post`` () = |
|
let test () = |
|
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) TestPost |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``RequestTextFromFile returns a string which ends withwith the correct end-token when using word-generator`` () = |
|
let test () = |
|
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) WordGenerator |
|
|> Async.RunSynchronously |
|
|> EndsAsIntended |
|
test () = true |
|
|
|
[<Property>] |
|
let ``TextInFileIsValid returns true when processing the text in the template files`` () = |
|
(* The template .txt files validity have been tested above. |
|
This test is to for the function, not the .txt files. |
|
Something has gone wrong if there are not quite a lot of explicit template file tests above. |
|
This is why the .txt files are called at random and not broken down into seperate tests. *) |
|
let test () = |
|
Pancake.TextInFileIsValidAsync (ValidFileInput()) |
|
|> Async.RunSynchronously |
|
test () = true |