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
b19c478f
Commit
b19c478f
authored
9 years ago
by
Mikaël Mayer
Browse files
Options
Downloads
Patches
Plain Diff
Added minimal string value
Added values for generating values.
parent
84e8cc8f
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/main/scala/leon/datagen/VanuatooDataGen.scala
+10
-0
10 additions, 0 deletions
src/main/scala/leon/datagen/VanuatooDataGen.scala
src/main/scala/leon/purescala/ExprOps.scala
+5
-0
5 additions, 0 deletions
src/main/scala/leon/purescala/ExprOps.scala
with
15 additions
and
0 deletions
src/main/scala/leon/datagen/VanuatooDataGen.scala
+
10
−
0
View file @
b19c478f
...
@@ -32,12 +32,19 @@ class VanuatooDataGen(ctx: LeonContext, p: Program) extends DataGenerator {
...
@@ -32,12 +32,19 @@ class VanuatooDataGen(ctx: LeonContext, p: Program) extends DataGenerator {
val
booleans
=
(
for
(
b
<-
Set
(
true
,
false
))
yield
{
val
booleans
=
(
for
(
b
<-
Set
(
true
,
false
))
yield
{
b
->
Constructor
[
Expr
,
TypeTree
](
List
(),
BooleanType
,
s
=>
BooleanLiteral
(
b
),
""
+
b
)
b
->
Constructor
[
Expr
,
TypeTree
](
List
(),
BooleanType
,
s
=>
BooleanLiteral
(
b
),
""
+
b
)
}).
toMap
}).
toMap
val
strings
=
(
for
(
b
<-
Set
(
""
,
"a"
,
"Abcd"
))
yield
{
b
->
Constructor
[
Expr
,
TypeTree
](
List
(),
StringType
,
s
=>
StringLiteral
(
b
),
b
)
}).
toMap
def
intConstructor
(
i
:
Int
)
=
ints
(
i
)
def
intConstructor
(
i
:
Int
)
=
ints
(
i
)
def
bigIntConstructor
(
i
:
Int
)
=
bigInts
(
i
)
def
bigIntConstructor
(
i
:
Int
)
=
bigInts
(
i
)
def
boolConstructor
(
b
:
Boolean
)
=
booleans
(
b
)
def
boolConstructor
(
b
:
Boolean
)
=
booleans
(
b
)
def
stringConstructor
(
s
:
String
)
=
strings
(
s
)
def
cPattern
(
c
:
Constructor
[
Expr
,
TypeTree
],
args
:
Seq
[
VPattern
[
Expr
,
TypeTree
]])
=
{
def
cPattern
(
c
:
Constructor
[
Expr
,
TypeTree
],
args
:
Seq
[
VPattern
[
Expr
,
TypeTree
]])
=
{
ConstructorPattern
[
Expr
,
TypeTree
](
c
,
args
)
ConstructorPattern
[
Expr
,
TypeTree
](
c
,
args
)
...
@@ -166,6 +173,9 @@ class VanuatooDataGen(ctx: LeonContext, p: Program) extends DataGenerator {
...
@@ -166,6 +173,9 @@ class VanuatooDataGen(ctx: LeonContext, p: Program) extends DataGenerator {
case
(
b
:
java.lang.Boolean
,
BooleanType
)
=>
case
(
b
:
java.lang.Boolean
,
BooleanType
)
=>
(
cPattern
(
boolConstructor
(
b
),
List
()),
true
)
(
cPattern
(
boolConstructor
(
b
),
List
()),
true
)
case
(
b
:
java.lang.String
,
StringType
)
=>
(
cPattern
(
stringConstructor
(
b
),
List
()),
true
)
case
(
cc
:
codegen.runtime.CaseClass
,
ct
:
ClassType
)
=>
case
(
cc
:
codegen.runtime.CaseClass
,
ct
:
ClassType
)
=>
val
r
=
cc
.
__getRead
()
val
r
=
cc
.
__getRead
()
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/purescala/ExprOps.scala
+
5
−
0
View file @
b19c478f
...
@@ -1100,6 +1100,7 @@ object ExprOps {
...
@@ -1100,6 +1100,7 @@ object ExprOps {
/** Returns simplest value of a given type */
/** Returns simplest value of a given type */
def
simplestValue
(
tpe
:
TypeTree
)
:
Expr
=
tpe
match
{
def
simplestValue
(
tpe
:
TypeTree
)
:
Expr
=
tpe
match
{
case
StringType
=>
StringLiteral
(
""
)
case
Int32Type
=>
IntLiteral
(
0
)
case
Int32Type
=>
IntLiteral
(
0
)
case
RealType
=>
FractionalLiteral
(
0
,
1
)
case
RealType
=>
FractionalLiteral
(
0
,
1
)
case
IntegerType
=>
InfiniteIntegerLiteral
(
0
)
case
IntegerType
=>
InfiniteIntegerLiteral
(
0
)
...
@@ -1735,6 +1736,10 @@ object ExprOps {
...
@@ -1735,6 +1736,10 @@ object ExprOps {
case
UnitType
=>
case
UnitType
=>
// Anything matches ()
// Anything matches ()
ps
.
nonEmpty
ps
.
nonEmpty
case
StringType
=>
// Can't possibly pattern match against all Strings one by one
ps
exists
(
_
.
isInstanceOf
[
WildcardPattern
])
case
Int32Type
=>
case
Int32Type
=>
// Can't possibly pattern match against all Ints one by one
// Can't possibly pattern match against all Ints one by one
...
...
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