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
37bc9723
Commit
37bc9723
authored
8 years ago
by
Regis Blanc
Committed by
Ravi
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
io directory for tests
parent
45496c70
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
testcases/verification/xlang/GuessNumber.scala
+0
-35
0 additions, 35 deletions
testcases/verification/xlang/GuessNumber.scala
testcases/verification/xlang/io/GuessNumber.scala
+1
-1
1 addition, 1 deletion
testcases/verification/xlang/io/GuessNumber.scala
with
1 addition
and
36 deletions
testcases/verification/xlang/GuessNumber.scala
deleted
100644 → 0
+
0
−
35
View file @
45496c70
import
leon.lang._
import
leon.lang.xlang._
import
leon.util.Random
object
GuessNumber
{
def
pickRandomly
(
min
:
BigInt
,
max
:
BigInt
)
:
BigInt
=
{
require
(
min
>=
0
&&
max
>=
min
)
Random
.
nextBigInt
(
max
-
min
+
1
)
+
min
}
def
main
()
:
Unit
=
{
val
choice
=
pickRandomly
(
0
,
10
)
var
guess
=
pickRandomly
(
0
,
10
)
var
top
:
BigInt
=
10
var
bot
:
BigInt
=
0
(
while
(
bot
<
top
)
{
if
(
isGreater
(
guess
,
choice
))
{
top
=
guess
-
1
guess
=
pickRandomly
(
bot
,
top
)
}
else
if
(
isSmaller
(
guess
,
choice
))
{
bot
=
guess
+
1
guess
=
pickRandomly
(
bot
,
top
)
}
})
invariant
(
guess
>=
bot
&&
guess
<=
top
&&
bot
>=
0
&&
top
<=
10
&&
bot
<=
top
&&
choice
>=
bot
&&
choice
<=
top
)
val
answer
=
bot
assert
(
answer
==
choice
)
}
def
isGreater
(
guess
:
BigInt
,
choice
:
BigInt
)
:
Boolean
=
guess
>
choice
def
isSmaller
(
guess
:
BigInt
,
choice
:
BigInt
)
:
Boolean
=
guess
<
choice
}
This diff is collapsed.
Click to expand it.
testcases/verification/xlang/GuessNumber
Interactive
.scala
→
testcases/verification/xlang/
io/
GuessNumber.scala
+
1
−
1
View file @
37bc9723
...
@@ -4,7 +4,7 @@ import leon.io.StdIn
...
@@ -4,7 +4,7 @@ import leon.io.StdIn
import
leon.annotation._
import
leon.annotation._
object
GuessNumber
Interactive
{
object
GuessNumber
{
@extern
@extern
def
pickBetween
(
bot
:
BigInt
,
top
:
BigInt
)
:
BigInt
=
{
def
pickBetween
(
bot
:
BigInt
,
top
:
BigInt
)
:
BigInt
=
{
...
...
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