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
019b1fad
Commit
019b1fad
authored
14 years ago
by
Philippe Suter
Browse files
Options
Downloads
Patches
Plain Diff
one less bug
parent
fb3de75a
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/purescala/Analysis.scala
+16
-14
16 additions, 14 deletions
src/purescala/Analysis.scala
testcases/MergeSort.scala
+4
-2
4 additions, 2 deletions
testcases/MergeSort.scala
with
20 additions
and
16 deletions
src/purescala/Analysis.scala
+
16
−
14
View file @
019b1fad
...
@@ -111,21 +111,23 @@ class Analysis(val program: Program) {
...
@@ -111,21 +111,23 @@ class Analysis(val program: Program) {
}
}
}
}
verifiedVCs
=
verifiedVCs
.
reverse
if
(
verifiedVCs
.
size
>
0
)
{
val
col1wdth
=
verifiedVCs
.
map
(
_
.
_1
).
map
(
_
.
length
).
max
+
2
verifiedVCs
=
verifiedVCs
.
reverse
val
col2wdth
=
verifiedVCs
.
map
(
_
.
_2
).
map
(
_
.
length
).
max
+
2
val
col1wdth
=
verifiedVCs
.
map
(
_
.
_1
).
map
(
_
.
length
).
max
+
2
val
col3wdth
=
verifiedVCs
.
map
(
_
.
_3
).
map
(
_
.
length
).
max
+
2
val
col2wdth
=
verifiedVCs
.
map
(
_
.
_2
).
map
(
_
.
length
).
max
+
2
val
col4wdth
=
verifiedVCs
.
map
(
_
.
_4
).
map
(
_
.
length
).
max
val
col3wdth
=
verifiedVCs
.
map
(
_
.
_3
).
map
(
_
.
length
).
max
+
2
def
mk1line
(
line
:
(
String
,
String
,
String
,
String
))
:
String
=
{
val
col4wdth
=
verifiedVCs
.
map
(
_
.
_4
).
map
(
_
.
length
).
max
line
.
_1
+
(
" "
*
(
col1wdth
-
line
.
_1
.
length
))
+
def
mk1line
(
line
:
(
String
,
String
,
String
,
String
))
:
String
=
{
line
.
_2
+
(
" "
*
(
col2wdth
-
line
.
_2
.
length
))
+
line
.
_1
+
(
" "
*
(
col1wdth
-
line
.
_1
.
length
))
+
line
.
_3
+
(
" "
*
(
col3wdth
-
line
.
_3
.
length
))
+
line
.
_2
+
(
" "
*
(
col2wdth
-
line
.
_2
.
length
))
+
line
.
_4
line
.
_3
+
(
" "
*
(
col3wdth
-
line
.
_3
.
length
))
+
line
.
_4
}
val
dashes
:
String
=
"="
*
(
col1wdth
+
col2wdth
+
col3wdth
+
col4wdth
)
reporter
.
info
(
"Summary:\n"
+
dashes
+
"\n"
+
verifiedVCs
.
map
(
mk1line
(
_
)).
mkString
(
"\n"
)
+
"\n"
+
dashes
)
}
else
{
reporter
.
info
(
"No verification conditions were generated."
)
}
}
val
dashes
:
String
=
"="
*
(
col1wdth
+
col2wdth
+
col3wdth
+
col4wdth
)
reporter
.
info
(
"Summary:\n"
+
dashes
+
"\n"
+
verifiedVCs
.
map
(
mk1line
(
_
)).
mkString
(
"\n"
)
+
"\n"
+
dashes
)
}
}
def
postconditionVC
(
functionDefinition
:
FunDef
)
:
Expr
=
{
def
postconditionVC
(
functionDefinition
:
FunDef
)
:
Expr
=
{
...
...
This diff is collapsed.
Click to expand it.
testcases/MergeSort.scala
+
4
−
2
View file @
019b1fad
...
@@ -14,8 +14,10 @@ object MergeSort {
...
@@ -14,8 +14,10 @@ object MergeSort {
def
is_sorted
(
l
:
List
)
:
Boolean
=
l
match
{
def
is_sorted
(
l
:
List
)
:
Boolean
=
l
match
{
case
Nil
()
=>
true
case
Nil
()
=>
true
case
Cons
(
x
,
Nil
())
=>
true
case
Cons
(
x
,
xs
)
=>
xs
match
{
case
Cons
(
x
,
Cons
(
y
,
xs
))
=>
x
<=
y
&&
is_sorted
(
Cons
(
y
,
xs
))
case
Nil
()
=>
true
case
Cons
(
y
,
ys
)
=>
x
<=
y
&&
is_sorted
(
Cons
(
y
,
ys
))
}
}
}
def
length
(
list
:
List
)
:
Int
=
list
match
{
def
length
(
list
:
List
)
:
Int
=
list
match
{
...
...
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