Skip to content

Commit 4ad1697

Browse files
committed
C_BOOL assigment demo
1 parent c3051e6 commit 4ad1697

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

test/bool/main.f90

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
program boollog
1+
program logical_C_bool
22

33
use, intrinsic ::iso_c_binding, only : C_BOOL
44

@@ -13,10 +13,15 @@ logical(C_BOOL) function logical_not(a) bind(C)
1313

1414
logical(C_BOOL) :: t, f
1515

16+
logical :: true_f, false_f
17+
1618
t = .true.
1719
f = .false.
1820

19-
if (logical_not(t)) error stop "logical_not(.true.) should be .false."
20-
if (.not. logical_not(f)) error stop "logical_not(.false.) should be .true."
21+
false_f = logical_not(t)
22+
true_f = logical_not(f)
23+
24+
if (false_f) error stop "logical_not(.true.) should be .false."
25+
if (.not. true_f) error stop "logical_not(.false.) should be .true."
2126

2227
end program

0 commit comments

Comments
 (0)