Skip to content

Commit 1b7aa0a

Browse files
committed
test-assert-macro: Restore testing of examples from README.md
1 parent 0c58e66 commit 1b7aa0a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/test-assert-macro.F90

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,41 @@ program test_assert_macros
4343
print '(a)'," pass on invocation from a pure function"
4444
end block
4545

46+
!------------------------------------------
47+
#undef ASSERTIONS
48+
#define ASSERTIONS 1
49+
#include "assert_macros.h"
50+
51+
! The following examples are taken from README.md and should be kept in sync with that document:
52+
block
53+
integer :: computed_checksum = 37, expected_checksum = 37
54+
55+
#if defined(_CRAYFTN)
56+
! Cray Fortran uses different line continuations in macro invocations
57+
call_assert_describe( computed_checksum == expected_checksum, &
58+
"Checksum mismatch failure!" &
59+
)
60+
print *," passes with line breaks inside macro invocation"
61+
62+
call_assert_describe( computed_checksum == expected_checksum, & ! ensured since version 3.14
63+
"Checksum mismatch failure!" & ! TODO: write a better message here
64+
)
65+
print *," passes with C block comments embedded in macro invocation"
66+
#else
67+
call_assert_describe( computed_checksum == expected_checksum, \
68+
"Checksum mismatch failure!" \
69+
)
70+
print *," passes with line breaks inside macro invocation"
71+
72+
call_assert_describe( computed_checksum == expected_checksum, /* ensured since version 3.14 */ \
73+
"Checksum mismatch failure!" /* TODO: write a better message here */ \
74+
)
75+
print *," passes with C block comments embedded in macro invocation"
76+
#endif
77+
78+
end block
79+
!------------------------------------------
80+
4681
contains
4782

4883
pure function check_assert(cond) result(ok)

0 commit comments

Comments
 (0)