Skip to content

Commit

Permalink
Merge pull request #35 from AllanBlanchard/fix/triangle-inequality
Browse files Browse the repository at this point in the history
Adds triangle inequality to preconditions
Thanks @wizeman
  • Loading branch information
AllanBlanchard authored Apr 30, 2021
2 parents dab481d + b1392e5 commit bf70b93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/function-contract/behaviors/ex-3-triangle-answer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ enum Angles { RIGHT, ACUTE, OBTUSE };

/*@
requires 0 <= a && 0 <= b && 0 <= c;
requires a <= b+c;
requires a >= b && a >= c; // Note that this condition is not
// necessary for the function but
// added for this exercise
Expand Down
3 changes: 3 additions & 0 deletions code/function-contract/modularity/ex-5-triangle-answer.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ struct TriangleInfo {
};

/*@
requires 0 <= a && 0 <= b && 0 <= c;
requires a <= b+c;
assigns \nothing;
behavior equilateral:
Expand Down

0 comments on commit bf70b93

Please sign in to comment.