Browse Source

leave comments in testing files, noting the script.fs file and role.

master
Craig Oates 6 years ago
parent
commit
703de8b8cd
  1. 9
      TestCentre/ConsoleTests.fs
  2. 27
      TestCentre/LibraryTests.fs

9
TestCentre/ConsoleTests.fs

@ -1,5 +1,14 @@
namespace ConsoleTests namespace ConsoleTests
(* Initial Setup -- Populating the Test Folders.
===========================================================================
If you have just cloned this repository or have not run any of the tests
before, please head over to script.fs (in Test Centre) and populate the
LoadingTestArea and SavingTestArea folders. More information will be
provided there about what the scripts do. It is worth pointing out here,
though, the .gitignore file ignores any .png files in them.
This is why you must populate them before running any tests. *)
module TestingHelpers = module TestingHelpers =
(* When you are writing tests, please keep all helper functions in this module. (* When you are writing tests, please keep all helper functions in this module.

27
TestCentre/LibraryTests.fs

@ -1,7 +1,20 @@
namespace LibraryTests namespace LibraryTests
(* Initial Setup -- Populating the Test Folders.
===========================================================================
If you have just cloned this repository or have not run any of the tests
before, please head over to script.fs (in Test Centre) and populate the
LoadingTestArea and SavingTestArea folders. More information will be
provided there about what the scripts do. It is worth pointing out here,
though, the .gitignore file ignores any .png files in them.
This is why you must populate them before running any tests. *)
module TestingHelpers = module TestingHelpers =
(* When you are writing tests, please keep all helper functions in this
module. If this module grows to a point where it hinders the actual
testing modules, consider moving it then. *)
open System open System
open System.Drawing open System.Drawing
open System.Reflection open System.Reflection
@ -20,7 +33,8 @@
let item = allColours.[Random().Next(allColours.Length)] let item = allColours.[Random().Next(allColours.Length)]
item.GetValue(null, null) item.GetValue(null, null)
let imagesInLoadingTestArea = Directory.GetFileSystemEntries (loadLocation, "*.png") let imagesInLoadingTestArea =
Directory.GetFileSystemEntries (loadLocation, "*.png")
let generateLoadPath () = let generateLoadPath () =
let rand = Random () let rand = Random ()
@ -31,8 +45,6 @@
let fileName = Path.GetFileName originalFilePath let fileName = Path.GetFileName originalFilePath
saveLocation + "/" + fileName saveLocation + "/" + fileName
let fileSaved path = File.Exists path
module PropertyTests = module PropertyTests =
open FsCheck.Xunit open FsCheck.Xunit
@ -50,7 +62,7 @@
{ originalPath = oPath { originalPath = oPath
savePath = sPath savePath = sPath
colour = randomBrush () :?> Brush colour = randomBrush () :?> Brush
penWidth = float32 0.1 penWidth = float32 1
rows = 10 rows = 10
columns = 10 } columns = 10 }
applyGrid spec applyGrid spec
@ -59,11 +71,14 @@
module UnitTests = module UnitTests =
open System.IO
open TestingHelpers open TestingHelpers
open Xunit open Xunit
// This test is just a check to make sure the property tests have what they need to run. (* This test is a precaution (a test for the tests if you will...).
It is here to make sure the property test has what it needs to run.
If the property test fails, here is a good place to start.
See script.fs (in Test Centre) for information on populating the
LoadingTestArea folder. *)
[<Fact>] [<Fact>]
let ``LoadingTestArea contains at least 100 test images`` () = let ``LoadingTestArea contains at least 100 test images`` () =
let length = imagesInLoadingTestArea.Length let length = imagesInLoadingTestArea.Length

Loading…
Cancel
Save