Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cool
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hans-Peter Deifel
cool
Commits
ab2d3adc
Commit
ab2d3adc
authored
10 years ago
by
Thorsten Wißmann
Browse files
Options
Downloads
Patches
Plain Diff
Add basic testcase checking
parent
b33c1f3f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/testsuite/Testsuite.ml
+50
-4
50 additions, 4 deletions
src/testsuite/Testsuite.ml
src/testsuite/Testsuite.mli
+6
-2
6 additions, 2 deletions
src/testsuite/Testsuite.mli
src/testsuite/cool-testsuite.ml
+12
-2
12 additions, 2 deletions
src/testsuite/cool-testsuite.ml
with
68 additions
and
8 deletions
src/testsuite/Testsuite.ml
+
50
−
4
View file @
ab2d3adc
module
CM
=
CoAlgMisc
module
PF
=
Printf
module
CR
=
CoAlgReasoner
...
...
@@ -8,9 +9,54 @@ module CR = CoAlgReasoner
sorts = [| (parseFunctor Sys.argv.(2), [0]) |]
*)
type
satCheck
=
bool
*
(
CoAlgMisc
.
sortTable
)
*
string
(* sat * functors * formula *)
type
testResult
=
|
Sat
|
Unsat
|
ParseError
type
satCheck
=
testResult
*
(
CoAlgMisc
.
sortTable
)
*
string
(* sat * functors * formula *)
let
colored_string_of_testResult
tr
=
match
tr
with
|
Sat
->
(
"1;33"
,
"sat"
)
|
Unsat
->
(
"1;34"
,
"unsat"
)
|
ParseError
->
(
"31"
,
"unparseable"
)
let
colored_string
col
str
=
"
\027
["
^
col
^
"m"
^
str
^
"
\027
[0m"
let
terminal_string_of_testResult
tr
=
let
(
col
,
str
)
=
colored_string_of_testResult
tr
in
colored_string
col
str
let
runSatCheck
(
_
,
logic
,
input
)
=
try
let
nomTable
name
=
assert
(
CoAlgFormula
.
isNominal
name
);
Some
0
in
let
(
tbox
,
f
)
=
CoAlgFormula
.
importQuery
input
in
let
res
=
CoAlgReasoner
.
isSat
logic
nomTable
tbox
f
in
if
res
then
Sat
else
Unsat
with
|
Stream
.
Error
_
->
ParseError
|
CoAlgFormula
.
CoAlgException
_
->
ParseError
let
runSatCheckVerbose
(
sc
:
satCheck
)
=
let
cs
=
colored_string
in
let
sotr
=
terminal_string_of_testResult
in
let
(
expectation
,_,
title
)
=
sc
in
PF
.
printf
"Is %-50s "
(
cs
"1"
title
);
PF
.
printf
"%s?… "
(
sotr
expectation
);
let
res
=
runSatCheck
sc
in
if
(
res
=
expectation
)
then
PF
.
printf
"%s
\n
"
(
cs
"1;32"
"Yes"
)
else
PF
.
printf
"%s
\n
-> %s: Expected %s but got %s!
\n
"
(
cs
"1;31"
"No"
)
(
cs
"1;31"
"Failure"
)
(
sotr
expectation
)
(
sotr
res
)
type
testResult
=
|
Correct
|
WrongAnswer
|
ParseError
let
runSatCheck
sc
=
WrongAnswer
This diff is collapsed.
Click to expand it.
src/testsuite/Testsuite.mli
+
6
−
2
View file @
ab2d3adc
...
...
@@ -4,9 +4,13 @@
sorts = [| (parseFunctor Sys.argv.(2), [0]) |]
*)
type
satCheck
=
bool
*
(
CoAlgMisc
.
sortTable
)
*
string
(* sat * functors * formula *)
type
testResult
=
|
Correct
|
WrongAnswer
|
ParseError
type
testResult
=
|
Sat
|
Unsat
|
ParseError
type
satCheck
=
testResult
*
(
CoAlgMisc
.
sortTable
)
*
string
(* expected * functors * formula *)
val
runSatCheck
:
satCheck
->
testResult
val
runSatCheckVerbose
:
satCheck
->
unit
This diff is collapsed.
Click to expand it.
src/testsuite/cool-testsuite.ml
+
12
−
2
View file @
ab2d3adc
...
...
@@ -10,9 +10,19 @@ let kd = [| (CM.MultiModalKD, [0]) |]
let
cl
=
[
|
(
CM
.
CoalitionLogic
,
[
0
])
|
]
let
gml
=
[
|
(
CM
.
GML
,
[
0
])
|
]
let
main
=
print_endline
"todo"
(* ============ multi modal K ============ *)
let
k_testcases
:
satCheck
list
=
let
c
a
b
=
(
a
,
k
,
b
)
in
[
c
Sat
"True"
;
c
Unsat
"False"
;
c
ParseError
"{Fsdf"
(*; c ParseError "Fsdf}" *)
]
let
main
=
foreach_l
k_testcases
(
fun
tc
->
runSatCheckVerbose
tc
)
let
_
=
main
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment