Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
pub
frama-c
Commits
38986ffc
Commit
38986ffc
authored
7 months ago
by
Kilyan Le Gallic
Committed by
Allan Blanchard
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[wp] Added tests for Why3 integration, oracles missing
parent
bb853881
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/plugins/wp/tests/wp_gallery/euclid3.c
+43
-0
43 additions, 0 deletions
src/plugins/wp/tests/wp_gallery/euclid3.c
src/plugins/wp/tests/wp_gallery/external-import.c
+23
-0
23 additions, 0 deletions
src/plugins/wp/tests/wp_gallery/external-import.c
with
66 additions
and
0 deletions
src/plugins/wp/tests/wp_gallery/euclid3.c
0 → 100644
+
43
−
0
View file @
38986ffc
#include
<limits.h>
//@ import why3: number::Gcd;
//@ import why3: int::MinMax;
/*@
requires \abs(a) <= INT_MAX ;
requires \abs(b) <= INT_MAX ;
assigns \nothing;
ensures \result == Gcd::gcd(a,b);
*/
int
euclid_gcd
(
int
a
,
int
b
)
{
int
r
;
/*@
loop assigns a, b, r;
loop invariant Gcd::gcd(a,b) == \at( Gcd::gcd(a,b), Pre );
loop variant \abs(b);
*/
while
(
b
!=
0
)
{
r
=
b
;
b
=
a
%
b
;
a
=
r
;
}
return
a
<
0
?
-
a
:
a
;
}
/*@
requires \abs(a) <= INT_MAX;
requires \abs(b) <= INT_MAX;
requires \abs(c) <= INT_MAX;
requires \abs(d) <= INT_MAX;
assigns \nothing;
ensures \result == Gcd::gcd(MinMax::min(a,b), MinMax::max(c,d) );
*/
int
minmax_gcd
(
int
a
,
int
b
,
int
c
,
int
d
)
{
int
x
=
(
a
>
b
)
?
b
:
a
;
int
y
=
(
c
>
d
)
?
c
:
d
;
return
euclid_gcd
(
x
,
y
);
}
This diff is collapsed.
Click to expand it.
src/plugins/wp/tests/wp_gallery/external-import.c
0 → 100644
+
23
−
0
View file @
38986ffc
#include
<limits.h>
//@ import why3: summodule::Sum;
/*@
requires \abs(a) <= INT_MAX ;
requires \abs(b) <= INT_MAX ;
assigns \nothing;
ensures \result == Sum::sum(a,b);
*/
int
sum
(
int
a
,
int
b
)
{
/*@
loop assigns a, b;
loop invariant a <= a + b;
loop variant b;
*/
while
(
b
!=
0
){
a
+=
1
;
b
-=
1
;
}
return
a
;
}
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