Commit 281ef2ef authored by Eldritch Conundrum's avatar Eldritch Conundrum
Browse files

added a way to run the tests

parent 374593ad
module tests
open System
open System.IO
open System.Diagnostics
let outFilename = Path.Combine(Path.GetTempPath(), "shader_code.h")
let testFiles = Directory.GetFiles("tests/", "*.*", SearchOption.AllDirectories)
let () =
let stopwatch = Stopwatch.StartNew()
printfn "Running %i tests..." (testFiles.Length)
let failedTestCount = ref 0
for filename in testFiles do
let p = Process.Start("./shader_minifier.exe",
String.concat " " [ filename; "-o"; outFilename ])
if p.ExitCode <> 0 then
printfn "*** error while testing %s: program returned %i" filename p.ExitCode
failedTestCount := !failedTestCount + 1
printfn "\n"
printfn "%i tests run in %i seconds, %i failed." testFiles.Length (int(stopwatch.Elapsed.TotalSeconds)) !failedTestCount
#! /bin/bash
references='-r lib/FParsec.dll -r lib/FParsecCS.dll -r lib/FSharp.PowerPack.dll'
fsharpc --standalone $references src/{ast.fs,printer.fs,cGen.fs,renamer.fs,rewriter.fs,parse.fs,main.fs,tests.fs} -o tests.exe && ./tests.exe || echo "tests.exe failed."
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment