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
4eb403c8
Commit
4eb403c8
authored
14 years ago
by
Viktor Kuncak
Browse files
Options
Downloads
Patches
Plain Diff
ground property in ExprComp
parent
37a24609
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
testcases/ExprComp.scala
+10
-2
10 additions, 2 deletions
testcases/ExprComp.scala
with
10 additions
and
2 deletions
testcases/ExprComp.scala
+
10
−
2
View file @
4eb403c8
object
ExprComp
{
object
ExprComp
{
// Values
// Values
case
class
Value
(
v
:
Int
)
sealed
abstract
class
Whatever
case
class
Value
(
v
:
Int
)
extends
Whatever
// Operations
// Operations
sealed
abstract
class
BinOp
sealed
abstract
class
BinOp
...
@@ -76,6 +77,13 @@ object ExprComp {
...
@@ -76,6 +77,13 @@ object ExprComp {
def
property
(
e
:
Expr
,
acc
:
Program
,
vs
:
ValueStack
)
:
Boolean
=
{
def
property
(
e
:
Expr
,
acc
:
Program
,
vs
:
ValueStack
)
:
Boolean
=
{
run
(
compile
(
e
,
acc
),
vs
)
==
Ok
(
NStack
(
eval
(
e
),
vs
))
run
(
compile
(
e
,
acc
),
vs
)
==
Ok
(
NStack
(
eval
(
e
),
vs
))
}
// ensuring (res => res)
def
property0
()
:
Boolean
=
{
val
e
=
Binary
(
Constant
(
Value
(
3
)),
Plus
(),
Constant
(
Value
(
5
)))
val
vs
=
EStack
()
val
acc
=
EProgram
()
run
(
compile
(
e
,
acc
),
vs
)
==
Ok
(
NStack
(
eval
(
e
),
vs
))
}
ensuring
(
res
=>
res
)
}
ensuring
(
res
=>
res
)
def
main
(
args
:
Array
[
String
])
=
{
def
main
(
args
:
Array
[
String
])
=
{
...
@@ -84,6 +92,6 @@ object ExprComp {
...
@@ -84,6 +92,6 @@ object ExprComp {
val
acc
=
EProgram
()
val
acc
=
EProgram
()
println
(
run
(
compile
(
e
,
acc
),
vs
))
println
(
run
(
compile
(
e
,
acc
),
vs
))
println
(
Ok
(
NStack
(
eval
(
e
),
vs
)))
println
(
Ok
(
NStack
(
eval
(
e
),
vs
)))
println
(
property
(
e
,
acc
,
vs
))
assert
(
property
(
e
,
acc
,
vs
))
}
}
}
}
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