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
ce471dc1
Commit
ce471dc1
authored
9 years ago
by
Regis Blanc
Committed by
Ravi
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Test transitive transformation of classes
parent
4130daef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/scala/leon/unit/purescala/DefinitionTransformerSuite.scala
+31
-2
31 additions, 2 deletions
...cala/leon/unit/purescala/DefinitionTransformerSuite.scala
with
31 additions
and
2 deletions
src/test/scala/leon/unit/purescala/DefinitionTransformerSuite.scala
+
31
−
2
View file @
ce471dc1
...
...
@@ -17,10 +17,10 @@ class DefinitionTransformerSuite extends FunSuite with ExpressionsDSL {
private
val
fd1
=
new
FunDef
(
FreshIdentifier
(
"f1"
),
Seq
(),
Seq
(
ValDef
(
x
.
id
)),
IntegerType
)
fd1
.
body
=
Some
(
x
)
private
val
fd2
=
new
FunDef
(
FreshIdentifier
(
"f
1
"
),
Seq
(),
Seq
(
ValDef
(
x
.
id
)),
IntegerType
)
private
val
fd2
=
new
FunDef
(
FreshIdentifier
(
"f
2
"
),
Seq
(),
Seq
(
ValDef
(
x
.
id
)),
IntegerType
)
fd2
.
body
=
Some
(
Plus
(
x
,
bi
(
1
)))
private
val
fd3
=
new
FunDef
(
FreshIdentifier
(
"f
1
"
),
Seq
(),
Seq
(
ValDef
(
x
.
id
)),
IntegerType
)
private
val
fd3
=
new
FunDef
(
FreshIdentifier
(
"f
3
"
),
Seq
(),
Seq
(
ValDef
(
x
.
id
)),
IntegerType
)
fd3
.
body
=
Some
(
Times
(
x
,
bi
(
1
)))
test
(
"transformation with no rewriting should not change FunDef"
)
{
...
...
@@ -30,4 +30,33 @@ class DefinitionTransformerSuite extends FunSuite with ExpressionsDSL {
assert
(
tr1
.
transform
(
fd3
)
===
fd3
)
}
private
val
classA
=
new
CaseClassDef
(
FreshIdentifier
(
"A"
),
Seq
(),
None
,
false
)
classA
.
setFields
(
Seq
(
ValDef
(
FreshIdentifier
(
"x"
,
IntegerType
))))
private
val
classB
=
new
CaseClassDef
(
FreshIdentifier
(
"B"
),
Seq
(),
None
,
false
)
classB
.
setFields
(
Seq
(
ValDef
(
FreshIdentifier
(
"a"
,
classA
.
typed
))))
test
(
"transformating type of a nested case class change all related case classes"
)
{
val
tr1
=
new
DefinitionTransformer
{
override
def
transformType
(
t
:
TypeTree
)
:
Option
[
TypeTree
]
=
t
match
{
case
IntegerType
=>
Some
(
BooleanType
)
case
_
=>
None
}
}
val
classA2
=
tr1
.
transform
(
classA
)
assert
(
classA
.
id
!==
classA2
.
id
)
assert
(
classA
.
fields
.
head
.
id
!==
classA2
.
fields
.
head
.
id
)
assert
(
classA
.
fields
.
head
.
getType
===
IntegerType
)
assert
(
classA2
.
fields
.
head
.
getType
===
BooleanType
)
assert
(
tr1
.
transform
(
classA
)
===
classA2
)
val
classB2
=
tr1
.
transform
(
classB
)
assert
(
tr1
.
transform
(
classA
)
===
classA2
)
assert
(
classB
.
id
!==
classB2
.
id
)
assert
(
classB
.
fields
.
head
.
id
!==
classB2
.
fields
.
head
.
id
)
assert
(
classB
.
fields
.
head
.
getType
===
classA
.
typed
)
assert
(
classB2
.
fields
.
head
.
getType
===
classA2
.
typed
)
}
}
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