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.
38 lines
1.5 KiB
38 lines
1.5 KiB
module InputGeneration |
|
|
|
open System |
|
open TestingConstants |
|
open Helpers |
|
|
|
let ValidGibberishLevelInput () = |
|
let testInputs = [|2 .. 20|] |
|
let index = Random().Next(0, testInputs.Length) |
|
testInputs.[index] |
|
|
|
let ValidSentencesInput () = System.Random().Next(2, 10) |
|
|
|
let InvalidGibberishLevelInput () = |
|
let testInputs = Array.concat [ [|0; 1|] ; [|21 .. 100|] ] |
|
let index = System.Random().Next(0, testInputs.Length) |
|
testInputs.[index] |
|
|
|
let InvalidSentencesInput () = System.Random().Next(-5, 1) |
|
|
|
let ValidFileInput () = |
|
let testInputs = [|ConsoleWaterworks; DesktopClock; TestPost; WordGenerator|] |
|
let index = Random().Next(0, testInputs.Length) |
|
testInputs.[index] |
|
|
|
(* Note: Code-Smell for "Defaults" |
|
================================================================================================================== |
|
DefaultTestSentence & DefaultSentenceCount should be used in tandem. |
|
Treat is as a code-smell in the (unit and property) tests when they are not. |
|
The main use for these expressions should be the "clean" functions. |
|
If you change the DefaultTestSentence, remember to change the random-range for DefaultSentencsCount. |
|
*) |
|
[<Literal>] |
|
let DefaultTestSentence = "This is a sentence. And, so is this. This shouldn't be here! How about this? No!" |
|
|
|
let private testSentCount = CountSentences DefaultTestSentence |
|
|
|
let DefaultSentenceCount () = Random().Next(1, testSentCount) |