Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
6005d61f
Commit
6005d61f
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
Fix tests with new rules API
parent
6a5b1b67
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/scala/leon/benchmark/SynthesisBenchmarks.scala
+5
-5
5 additions, 5 deletions
src/test/scala/leon/benchmark/SynthesisBenchmarks.scala
src/test/scala/leon/test/synthesis/RuleApplicationSuite.scala
+10
-13
10 additions, 13 deletions
...test/scala/leon/test/synthesis/RuleApplicationSuite.scala
with
15 additions
and
18 deletions
src/test/scala/leon/benchmark/SynthesisBenchmarks.scala
+
5
−
5
View file @
6005d61f
...
@@ -60,19 +60,19 @@ object SynthesisBenchmarks extends App {
...
@@ -60,19 +60,19 @@ object SynthesisBenchmarks extends App {
val
(
results
,
solver
)
=
pipeline
.
run
(
ctx
)(
file
.
getPath
::
Nil
)
val
(
results
,
solver
)
=
pipeline
.
run
(
ctx
)(
file
.
getPath
::
Nil
)
val
sctx
=
SynthesisContext
(
solver
,
new
SilentReporter
)
val
sctx
=
SynthesisContext
(
solver
,
new
SilentReporter
,
new
java
.
util
.
concurrent
.
atomic
.
AtomicBoolean
)
for
((
f
,
ps
)
<-
results
;
p
<-
ps
)
{
for
((
f
,
ps
)
<-
results
;
p
<-
ps
)
{
val
ts
=
System
.
currentTimeMillis
val
ts
=
System
.
currentTimeMillis
val
rr
=
rules
.
CEGIS
.
attemptToApply
On
(
sctx
,
p
)
val
rr
=
rules
.
CEGIS
.
instantiate
On
(
sctx
,
p
)
val
nAlt
=
rr
.
alternatives
.
size
val
nAlt
=
rr
.
size
var
nSuccess
,
nInnap
,
nDecomp
=
0
var
nSuccess
,
nInnap
,
nDecomp
=
0
for
(
alt
<-
rr
.
alternatives
)
{
for
(
alt
<-
rr
)
{
alt
.
apply
()
match
{
alt
.
apply
(
sctx
)
match
{
case
RuleApplicationImpossible
=>
case
RuleApplicationImpossible
=>
nInnap
+=
1
nInnap
+=
1
case
s
:
RuleDecomposed
=>
case
s
:
RuleDecomposed
=>
...
...
This diff is collapsed.
Click to expand it.
src/test/scala/leon/test/synthesis/RuleApplicationSuite.scala
+
10
−
13
View file @
6005d61f
...
@@ -104,22 +104,17 @@ class SynthesisSuite extends FunSuite {
...
@@ -104,22 +104,17 @@ class SynthesisSuite extends FunSuite {
}
}
}
}
def
synthesisStep
(
s
:
Solver
,
r
:
Rule
,
p
:
Problem
)
:
RuleResult
=
{
def
assertRuleSuccess
(
sctx
:
SynthesisContext
,
rr
:
Traversable
[
RuleInstantiation
])
{
val
sctx
=
SynthesisContext
(
s
,
new
SilentReporter
)
assert
(
rr
.
isEmpty
===
false
,
"No rule alternative while the rule should have succeeded"
)
r
.
attemptToApplyOn
(
sctx
,
p
)
assert
(
rr
.
exists
(
alt
=>
alt
.
apply
(
sctx
).
isInstanceOf
[
RuleSuccess
])
===
true
,
"Rule did not succeed"
)
}
def
assertRuleSuccess
(
rr
:
RuleResult
)
{
assert
(
rr
.
alternatives
.
isEmpty
===
false
,
"No rule alternative while the rule should have succeeded"
)
assert
(
rr
.
alternatives
.
exists
(
alt
=>
alt
.
apply
().
isInstanceOf
[
RuleSuccess
])
===
true
,
"Rule did not succeed"
)
}
}
def
assertFastEnough
(
rr
:
RuleResult
,
timeoutMs
:
Long
)
{
def
assertFastEnough
(
sctx
:
SynthesisContext
,
rr
:
Traversable
[
RuleInstantiation
]
,
timeoutMs
:
Long
)
{
for
(
alt
<-
rr
.
alternatives
)
{
for
(
alt
<-
rr
)
{
val
ts
=
System
.
currentTimeMillis
val
ts
=
System
.
currentTimeMillis
val
res
=
alt
.
apply
()
val
res
=
alt
.
apply
(
sctx
)
val
t
=
System
.
currentTimeMillis
-
ts
val
t
=
System
.
currentTimeMillis
-
ts
...
@@ -130,7 +125,9 @@ class SynthesisSuite extends FunSuite {
...
@@ -130,7 +125,9 @@ class SynthesisSuite extends FunSuite {
testFile
(
"synthesis/Cegis1.scala"
)
{
testFile
(
"synthesis/Cegis1.scala"
)
{
case
(
solver
,
fd
,
p
)
=>
case
(
solver
,
fd
,
p
)
=>
assertRuleSuccess
(
synthesisStep
(
solver
,
rules
.
CEGIS
,
p
))
val
sctx
=
SynthesisContext
(
solver
,
new
SilentReporter
,
new
java
.
util
.
concurrent
.
atomic
.
AtomicBoolean
)
assertFastEnough
(
synthesisStep
(
solver
,
rules
.
CEGIS
,
p
),
100
)
assertRuleSuccess
(
sctx
,
rules
.
CEGIS
.
instantiateOn
(
sctx
,
p
))
assertFastEnough
(
sctx
,
rules
.
CEGIS
.
instantiateOn
(
sctx
,
p
),
100
)
}
}
}
}
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