Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cduce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
19
Issues
19
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cduce
cduce
Commits
f2f4c46b
Commit
f2f4c46b
authored
Nov 21, 2013
by
Pietro Abate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests for BoolVar
parent
eb3233e4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
42 additions
and
27 deletions
+42
-27
_tags
_tags
+2
-1
cduce_boolvar.mlpack
cduce_boolvar.mlpack
+0
-2
tests/libtest/tests-boolvar.ml
tests/libtest/tests-boolvar.ml
+4
-4
types/atoms.ml
types/atoms.ml
+4
-2
types/atoms.mli
types/atoms.mli
+3
-0
types/boolVar.ml
types/boolVar.ml
+16
-17
types/chars.ml
types/chars.ml
+4
-0
types/chars.mli
types/chars.mli
+2
-0
types/intervals.ml
types/intervals.ml
+4
-1
types/intervals.mli
types/intervals.mli
+3
-0
No files found.
_tags
View file @
f2f4c46b
...
...
@@ -9,8 +9,9 @@ true: -traverse
<schema>: include
<runtime>: include
<{misc,types,typing,schema,compile,runtime}/*.cmx>: for-pack(Cduce_test)
<{misc,types}/*.cmx>: for-pack(Cduce_boolvar)
<parser/**>: package(ulex), package(netstring), syntax(camlp4o)
<schema/**>: package(pcre), package(netstring)
<runtime/**>: package(pcre), package(netstring)
<tests/libtest/tests
.*>:
package(netstring), package(pcre), package(oUnit), package(ulex), package(num), package(camlp4.lib), use_cduce_lib
<tests/libtest/tests
*>: pp(camlp4orf.opt),
package(netstring), package(pcre), package(oUnit), package(ulex), package(num), package(camlp4.lib), use_cduce_lib
cduce_boolvar.mlpack
View file @
f2f4c46b
...
...
@@ -17,5 +17,3 @@ Normal
Pretty
Stats
BoolVar
BoolAtoms
tests/libtest/tests-boolvar.ml
View file @
f2f4c46b
...
...
@@ -73,12 +73,12 @@ let boolvar_tests_atoms = [
"associativity union"
,
BAP
.
os
"(atm foo v atm bar) v atm baz"
,
BAP
.
os
"atm foo v (atm bar v atm baz)"
;
"difference"
,
BAP
.
os
"(atm foo ^ atm bar) v var alpha"
,
BAP
.
os
"var alpha"
;
"difference empty"
,
BAP
.
os
"atm foo ^ atm bar"
,
BAP
.
os
"Empty"
;
(* vars = Any -> no variables in the tree *)
"splitvar vars empty"
,
fst
(
BoolAtoms
.
splitvars
(
BAP
.
os
"atm foo"
))
,
BAP
.
os
"Any"
;
"splitvar vars empty"
,
fst
(
BoolAtoms
.
splitvars
(
BAP
.
os
"atm foo"
))
,
BAP
.
os
"Empty"
;
"splitvar atm empty"
,
snd
(
BoolAtoms
.
splitvars
(
BAP
.
os
"var alpha"
))
,
BAP
.
os
"Empty"
;
"splitvar vars 1 "
,
fst
(
BoolAtoms
.
splitvars
(
BAP
.
os
"var alpha
^ (atm foo v var beta) ^ var gamma"
))
,
BAP
.
os
"var alpha ^
var gamma"
;
"splitvar atm 1"
,
snd
(
BoolAtoms
.
splitvars
(
BAP
.
os
"var alpha v (atm foo ^ var beta) v var gamma"
))
,
BAP
.
os
"
var gamma v var alpha v ( atm foo ^ var beta)
"
;
"splitvar vars 1 "
,
fst
(
BoolAtoms
.
splitvars
(
BAP
.
os
"var alpha
v (atm foo ^ var beta) v var gamma"
))
,
BAP
.
os
"var alpha v
var gamma"
;
"splitvar atm 1"
,
snd
(
BoolAtoms
.
splitvars
(
BAP
.
os
"var alpha v (atm foo ^ var beta) v var gamma"
))
,
BAP
.
os
"
atm foo ^ var beta
"
;
"splitvar atm 2"
,
snd
(
BoolAtoms
.
splitvars
(
BAP
.
os
"var alpha v atm foo"
))
,
BAP
.
os
"atm foo"
;
"splitvar vars 2"
,
fst
(
BoolAtoms
.
splitvars
(
BAP
.
os
"var alpha v atm foo"
))
,
BAP
.
os
"var alpha"
;
];;
...
...
types/atoms.ml
View file @
f2f4c46b
...
...
@@ -8,7 +8,6 @@ module V = struct
let
to_string
=
string_of_tag
end
module
SymbolSet
=
SortedList
.
FiniteCofinite
(
V
)
let
rec
iter_sep
sep
f
=
function
...
...
@@ -31,6 +30,10 @@ include SortedList.FiniteCofiniteMap(Ns.Uri)(SymbolSet)
let
atom
l
=
atom
(
fst
(
V
.
value
l
)
,
l
)
(* this is to have a uniform signature of all basic types *)
type
elem
=
V
.
t
let
full
=
any
let
contains
l
t
=
contains
(
fst
(
V
.
value
l
)
,
l
)
t
...
...
@@ -76,7 +79,6 @@ let get_map q (mtags,mns,def) =
|
None
->
assert
false
|
Some
x
->
x
let
mk_map
l
=
let
all_ns
=
ref
[]
in
let
all_tags
=
ref
[]
in
...
...
types/atoms.mli
View file @
f2f4c46b
...
...
@@ -16,8 +16,11 @@ end
include
Custom
.
T
val
print
:
t
->
(
Format
.
formatter
->
unit
)
list
type
elem
=
V
.
t
val
empty
:
t
val
any
:
t
val
full
:
t
(* same as any *)
val
cup
:
t
->
t
->
t
val
cap
:
t
->
t
->
t
...
...
types/boolVar.ml
View file @
f2f4c46b
...
...
@@ -5,7 +5,6 @@ let (=) : int -> int -> bool = (=)
module
type
E
=
sig
(* module V : sig type t end *)
type
elem
include
Custom
.
T
...
...
@@ -28,6 +27,9 @@ sig
val
empty
:
t
val
full
:
t
(* same as full, but we keep it for the moment to avoid chaging
* the code everywhere *)
val
any
:
t
val
cup
:
t
->
t
->
t
val
cap
:
t
->
t
->
t
val
diff
:
t
->
t
->
t
...
...
@@ -66,7 +68,7 @@ end
*
* *)
module
type
MAKE
=
functor
(
T
:
E
)
->
S
with
type
elem
=
T
.
t
Custom
.
pairvar
(* module type MAKE = functor (T : E) -> S with type elem = T.t Custom.pairvar *)
module
Make
(
T
:
E
)
=
struct
...
...
@@ -244,6 +246,7 @@ struct
let
empty
=
False
let
full
=
True
let
any
=
True
let
is_empty
t
=
(
t
==
empty
)
...
...
@@ -261,7 +264,7 @@ struct
|
b
::
l
->
(
equal
a
b
)
||
(
has_same
a
l
)
let
rec
split
x
p
i
n
=
if
X
.
equal
x
(
Custom
.
Atm
T
.
empty
)
then
False
if
X
.
equal
x
(
Custom
.
Atm
T
.
empty
)
then
False
else
if
i
==
True
then
True
else
if
equal
p
n
then
p
++
i
else
let
p
=
simplify
p
[
i
]
and
n
=
simplify
n
[
i
]
in
...
...
@@ -272,7 +275,6 @@ struct
match
a
with
|
False
->
False
|
True
->
if
has_true
l
then
False
else
True
|
Split
(
_
,
Custom
.
Atm
x
,
True
,
False
,
False
)
->
split
(
Custom
.
Atm
(
T
.
diff
T
.
full
x
))
True
False
False
|
Split
(
_
,
Custom
.
Atm
x
,
False
,
False
,
True
)
->
split
(
Custom
.
Atm
(
T
.
diff
T
.
full
x
))
True
False
False
|
Split
(
_
,
x
,
p
,
i
,
n
)
->
if
(
has_true
l
)
||
(
has_same
a
l
)
then
False
...
...
@@ -420,18 +422,15 @@ struct
* a = only atoms as leaves
*)
let
rec
splitvars
=
function
|
True
->
True
,
True
(* True or False can only be under a variable *)
|
True
->
True
,
False
|
False
->
False
,
False
|
Split
(
_
,
Custom
.
Var
_
,
True
,
False
,
False
)
as
x
->
x
,
False
|
Split
(
_
,
Custom
.
Atm
_
,
True
,
False
,
False
)
as
x
->
True
,
x
|
Split
(
_
,
x
,
p
,
i
,
n
)
->
let
l
,
p'
=
splitvars
p
in
let
c
,
i'
=
splitvars
i
in
let
r
,
n'
=
splitvars
n
in
match
split
x
l
c
r
,
split
x
p'
i'
n'
with
|
t
,
Split
(
_
,
Custom
.
Var
_
,
True
,
False
,
False
)
->
t
,
False
|
(
_
,_
)
as
t
->
t
let
splitvars
t
=
splitvars
t
|
Split
(
_
,
Custom
.
Atm
_
,
True
,
False
,
False
)
as
x
->
False
,
x
|
Split
(
_
,
Custom
.
Atm
_
,
_
,_,_
)
->
assert
false
|
Split
(
_
,
((
Custom
.
Var
_
)
as
x
)
,
p
,
i
,
n
)
->
let
p1
,
p2
=
splitvars
p
in
let
i1
,
i2
=
splitvars
i
in
let
n1
,
n2
=
splitvars
n
in
split
x
p1
i1
n1
,
split
x
p2
i2
n2
end
types/chars.ml
View file @
f2f4c46b
...
...
@@ -53,6 +53,10 @@ let to_int c = c
let
empty
=
[]
let
any
=
[
0
,
V
.
max_char
]
(* this is to have a uniform signature of all basic types *)
type
elem
=
V
.
t
let
full
=
any
let
char_class
a
b
=
if
a
<=
b
then
[
a
,
b
]
else
empty
let
atom
a
=
[
a
,
a
]
...
...
types/chars.mli
View file @
f2f4c46b
...
...
@@ -13,9 +13,11 @@ include Custom.T
val
print
:
t
->
(
Format
.
formatter
->
unit
)
list
val
dump
:
Format
.
formatter
->
t
->
unit
type
elem
=
V
.
t
val
empty
:
t
val
any
:
t
val
full
:
t
(* same as any *)
val
cup
:
t
->
t
->
t
val
cap
:
t
->
t
->
t
val
diff
:
t
->
t
->
t
...
...
types/intervals.ml
View file @
f2f4c46b
...
...
@@ -18,7 +18,6 @@ let check i = ()
let
from_int
i
=
big_int_of_int
i
let
from_bigint
i
=
i
let
mk
=
big_int_of_string
let
to_string
=
string_of_big_int
let
get_int
=
int_of_big_int
...
...
@@ -124,6 +123,10 @@ let hash = hash 0
let
empty
=
[]
let
any
=
[
Any
]
(* this is to have a uniform signature of all basic types *)
type
elem
=
V
.
t
let
full
=
any
let
bounded
a
b
=
if
le_big_int
a
b
then
[
Bounded
(
a
,
b
)]
else
empty
...
...
types/intervals.mli
View file @
f2f4c46b
...
...
@@ -37,8 +37,11 @@ end
include
Custom
.
T
val
print
:
t
->
(
Format
.
formatter
->
unit
)
list
type
elem
=
V
.
t
val
empty
:
t
val
any
:
t
val
full
:
t
(* same as any *)
val
cup
:
t
->
t
->
t
val
cap
:
t
->
t
->
t
val
diff
:
t
->
t
->
t
...
...
Write
Preview
Markdown
is supported
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