Browse Source

Wrote content test in property tests.

RequestCleanTextFromFile ends with correct end-token.
Includes console-waterworks, desktop-clock, test-post and word-generator.
master
Craig Oates 6 years ago
parent
commit
3dcb9aaf30
  1. 10
      TestCentre/Helpers.fs
  2. 46
      TestCentre/PropertyTests.fs

10
TestCentre/Helpers.fs

@ -1,6 +1,7 @@
module Helpers
open System.Text.RegularExpressions
open System
// The main aim of these functions is to reduce code in the unit and property tests.
// You will most-likely find them in the "contents" tests (for unit and property).
@ -17,4 +18,11 @@
| '!' -> true
| '?' -> true
| _ -> false
let RandomBool () =
let x = Random().Next(100)
match x with
| x when x % 2 <> 0 -> false
| x when x % 2 = 0 -> true
| _ -> failwith "Unable to generate a random bool."

46
TestCentre/PropertyTests.fs

@ -140,6 +140,52 @@
let results = Assert.Equal(desiredSentencesCount, test())
Check.Quick results
// clean text from file ends with correct end-token
[<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
let results () = Assert.True(test())
Check.Quick (results())
[<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
let results () = Assert.True(test())
Check.Quick (results())
[<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
let results () = Assert.True(test())
Check.Quick (results())
[<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
let results () = Assert.True(test())
Check.Quick (results())
// end of correct end-token tests
// ==========================================================================================================
// clean text from file returns intended sent.
// end of intended sent. tests
[<Property>]
let ``RequestRandomText returns a string which ends with the correct end-token`` () =
let test () =

Loading…
Cancel
Save