~ubuntu-branches/debian/sid/frama-c/sid

« back to all changes in this revision

Viewing changes to tests/spec/complete_behaviors.c

  • Committer: Bazaar Package Importer
  • Author(s): Mehdi Dogguy
  • Date: 2009-06-03 08:19:25 UTC
  • Revision ID: james.westby@ubuntu.com-20090603081925-kihvxvt0wy3zc4ar
Tags: upstream-20081201.dfsg
ImportĀ upstreamĀ versionĀ 20081201.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
typedef enum { Max, Min } kind;
 
2
int extremum (kind k, int x, int y) {
 
3
  return ((k == Max ? x > y : x < y) ? x: y);
 
4
}
 
5
/*@ requires k == Max || k == Min;
 
6
    assigns \nothing;
 
7
    ensures \result == x || \result == y;
 
8
    behavior is_max:
 
9
      assumes k == Max;
 
10
      ensures \result >= x && \result >= y;
 
11
    behavior is_min:
 
12
      assumes k == Min;
 
13
      ensures \result <= x && \result <= y;
 
14
    complete behaviors is_max, is_min;
 
15
    disjoint behaviors is_max, is_min;
 
16
*/
 
17
int extremum (kind k, int x, int y);