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