@@ -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+
4681contains
4782
4883 pure function check_assert (cond ) result(ok)
0 commit comments