scilab: fix contract example (catch expected errors)
This commit is contained in:
parent
4660e693e9
commit
1f9ae92656
1 changed files with 10 additions and 3 deletions
|
|
@ -25,10 +25,17 @@ Foo_set (3.1415926);
|
|||
printf("Foo = %f\n", Foo_get());
|
||||
|
||||
// Check error message if violate contract
|
||||
g = gcd(-42,105);
|
||||
fact(-4);
|
||||
|
||||
try
|
||||
g = gcd(-42,105);
|
||||
catch
|
||||
printf("%s\n", lasterror());
|
||||
end
|
||||
|
||||
try
|
||||
fact(-4);
|
||||
catch
|
||||
printf("%s\n", lasterror());
|
||||
end
|
||||
|
||||
exit
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue