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
cd7a4652
Commit
cd7a4652
authored
9 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
CodegenEvaluatorSuite was doing nothing. Now it does something.
parent
fd33cc09
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/scala/leon/integration/evaluators/CodegenEvaluatorSuite.scala
+11
-15
11 additions, 15 deletions
...a/leon/integration/evaluators/CodegenEvaluatorSuite.scala
with
11 additions
and
15 deletions
src/test/scala/leon/integration/evaluators/CodegenEvaluatorSuite.scala
+
11
−
15
View file @
cd7a4652
...
@@ -9,7 +9,7 @@ import leon.purescala.Expressions._
...
@@ -9,7 +9,7 @@ import leon.purescala.Expressions._
import
leon.purescala.Types._
import
leon.purescala.Types._
import
leon.codegen._
import
leon.codegen._
class
CodegenEvaluatorSuite
extends
LeonTestSuiteWithProgram
{
class
CodegenEvaluatorSuite
extends
LeonTestSuiteWithProgram
with
helpers
.
ExpressionsDSL
{
val
sources
=
List
(
"""
val
sources
=
List
(
"""
import leon.lang._
import leon.lang._
...
@@ -316,7 +316,7 @@ class CodegenEvaluatorSuite extends LeonTestSuiteWithProgram {
...
@@ -316,7 +316,7 @@ class CodegenEvaluatorSuite extends LeonTestSuiteWithProgram {
"Overrides1"
->
Tuple
(
Seq
(
BooleanLiteral
(
false
),
BooleanLiteral
(
true
))),
"Overrides1"
->
Tuple
(
Seq
(
BooleanLiteral
(
false
),
BooleanLiteral
(
true
))),
"Overrides2"
->
Tuple
(
Seq
(
BooleanLiteral
(
false
),
BooleanLiteral
(
true
))),
"Overrides2"
->
Tuple
(
Seq
(
BooleanLiteral
(
false
),
BooleanLiteral
(
true
))),
"Arrays1"
->
IntLiteral
(
2
),
"Arrays1"
->
IntLiteral
(
2
),
"Arrays2"
->
IntLiteral
(
6
)
"Arrays2"
->
IntLiteral
(
10
)
)
)
for
{
for
{
...
@@ -324,29 +324,25 @@ class CodegenEvaluatorSuite extends LeonTestSuiteWithProgram {
...
@@ -324,29 +324,25 @@ class CodegenEvaluatorSuite extends LeonTestSuiteWithProgram {
requireMonitor
<-
Seq
(
false
,
true
)
requireMonitor
<-
Seq
(
false
,
true
)
doInstrument
<-
Seq
(
false
,
true
)
doInstrument
<-
Seq
(
false
,
true
)
}
{
}
{
val
opts
=
(
(
if
(
requireMonitor
)
Some
(
"monitor"
)
else
None
)
+
+
val
opts
=
(
if
(
requireMonitor
)
"monitor
"
else
""
)
+
(
if
(
doInstrument
)
Some
(
"instrument"
)
else
None
)).
mkString
(
"+
"
)
(
if
(
doInstrument
)
"instrument"
else
"
"
)
val
testName
=
f
"$name%-20s $opts%-18s"
val
testName
=
f
"$name%-20s $opts%-18s"
test
(
"Evaluation of "
+
testName
)
{
case
(
ctx
,
pgm
)
=>
test
(
"Evaluation of "
+
testName
)
{
implicit
fix
=>
val
eval
=
new
CodeGenEvaluator
(
ctx
,
pgm
,
CodeGenParams
(
val
eval
=
new
CodeGenEvaluator
(
fix
.
_1
,
fix
.
_2
,
CodeGenParams
(
maxFunctionInvocations
=
if
(
requireMonitor
)
1000
else
-
1
,
// Monitor calls and abort execution if more than X calls
maxFunctionInvocations
=
if
(
requireMonitor
)
1000
else
-
1
,
// Monitor calls and abort execution if more than X calls
checkContracts
=
true
,
// Generate calls that checks pre/postconditions
checkContracts
=
true
,
// Generate calls that checks pre/postconditions
doInstrument
=
doInstrument
// Instrument reads to case classes (mainly for vanuatoo)
doInstrument
=
doInstrument
// Instrument reads to case classes (mainly for vanuatoo)
))
))
val
fun
=
pgm
.
lookup
(
name
+
".test"
).
collect
{
(
eval
.
eval
(
fcall
(
name
+
".test"
)()).
result
,
exp
)
match
{
case
fd
:
FunDef
=>
fd
}.
getOrElse
{
fail
(
"Failed to lookup '"
+
name
+
".test'"
)
}
(
eval
.
eval
(
FunctionInvocation
(
fun
.
typed
(
Seq
()),
Seq
())).
result
,
exp
)
match
{
case
(
Some
(
res
),
exp
)
=>
case
(
Some
(
res
),
exp
)
=>
assert
(
res
===
exp
)
case
(
None
,
Error
(
_
,
_
))
=>
case
(
None
,
Error
(
_
,
_
))
=>
case
(
None
,
_
)
=>
// OK
case
(
_
,
Error
(
_
,
_
))
=>
case
_
=>
fail
(
""
)
}
}
}
}
}
}
...
...
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