Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
Shader_Minifier
Commits
281ef2ef
Commit
281ef2ef
authored
Apr 25, 2017
by
Eldritch Conundrum
Browse files
added a way to run the tests
parent
374593ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/tests.fs
0 → 100644
View file @
281ef2ef
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
])
p
.
WaitForExit
()
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
()
test.bash
0 → 100755
View file @
281ef2ef
#! /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."
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment