source:
CIVL/mods/dev.civl.com/examples/fortran/smack/function_fail.f90@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 391 bytes | |
| Line | |
|---|---|
| 1 | ! @expect error |
| 2 | |
| 3 | pure function cap(x) |
| 4 | implicit none |
| 5 | integer, intent(in) :: x |
| 6 | integer :: y |
| 7 | integer :: cap |
| 8 | y = x |
| 9 | if (10 < y) then |
| 10 | y = 10 |
| 11 | end if |
| 12 | cap = y |
| 13 | end function |
| 14 | |
| 15 | |
| 16 | program main |
| 17 | implicit none |
| 18 | integer :: cap |
| 19 | integer :: x |
| 20 | !$CVL $input |
| 21 | integer :: n |
| 22 | !$CVL $assert(cap(2) /= 2) |
| 23 | !$CVL $assert(cap(15) == 10) |
| 24 | x = n |
| 25 | !$CVL $assert(cap(x) <= 10) |
| 26 | end program main |
Note:
See TracBrowser
for help on using the repository browser.
