Skip to content

Commit 4e4390e

Browse files
committed
tests: Incorporate recent Julienne improvements
* New `test_diagnosis_t` copy constructor allows the `ALSO` macros to accept either `test_diagnosis_t` or default logical * This in turn allows removal of many uses of `.expect.`
1 parent 7914998 commit 4e4390e

8 files changed

+19
-20
lines changed

test/prif_allocate_test.F90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module prif_allocate_test_m
1515
use prif, only : prif_deallocate_coarray, prif_deallocate_coarrays
1616
#endif
1717
use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, string_t, usher &
18-
,operator(.all.), operator(.also.), operator(.equalsExpected.), operator(.expect.), operator(//)
18+
,operator(.all.), operator(.also.), operator(.equalsExpected.), operator(//)
1919
use iso_c_binding, only: &
2020
c_ptr, c_int, c_int64_t, c_size_t, c_null_funptr, &
2121
c_f_pointer, c_null_ptr, c_loc, c_associated, c_intptr_t
@@ -72,15 +72,15 @@ function check_allocate_integer_scalar_coarray_with_corank1() result(diag)
7272

7373
allocated_memory = c_null_ptr
7474
local_slice => null()
75-
ALSO(.expect. (.not. associated(local_slice)))
75+
ALSO(.not. associated(local_slice))
7676

7777
data_size = storage_size(dummy_element)/8
7878
call prif_allocate_coarray( &
7979
lcobounds, ucobounds, data_size, c_null_funptr, &
8080
coarray_handle, allocated_memory)
8181

8282
call c_f_pointer(allocated_memory, local_slice)
83-
ALSO(.expect. associated(local_slice))
83+
ALSO(associated(local_slice))
8484

8585
local_slice = 42
8686
ALSO(local_slice .equalsExpected. 42)
@@ -172,7 +172,7 @@ function assert_aliased(h1, h2, offset) result(diag)
172172

173173
call prif_set_context_data(h2, c_null_ptr)
174174
call prif_get_context_data(h1, c1)
175-
ALSO(.expect. (.not. c_associated(c1)))
175+
ALSO(.not. c_associated(c1))
176176

177177
end function
178178

@@ -199,7 +199,7 @@ function check_allocate_integer_array_coarray_with_corank2() result(diag)
199199

200200
allocated_memory = c_null_ptr
201201
local_slice => null()
202-
ALSO(.expect. (.not.associated(local_slice)))
202+
ALSO(.not.associated(local_slice))
203203

204204
data_size = 10*storage_size(dummy_element)/8
205205
call prif_allocate_coarray( &
@@ -210,7 +210,7 @@ function check_allocate_integer_array_coarray_with_corank2() result(diag)
210210
ALSO2(query_size .equalsExpected. data_size, "invalid prif_size_bytes")
211211

212212
call c_f_pointer(allocated_memory, local_slice, [10])
213-
ALSO(.expect. associated(local_slice))
213+
ALSO(associated(local_slice))
214214

215215
local_slice = [(i*i, i = 1, 10)]
216216
ALSO(.all. (local_slice .equalsExpected. [(i*i, i = 1, 10)]))

test/prif_atomic_test.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module prif_atomic_test_m
55
use iso_c_binding, only: &
66
c_ptr, c_int64_t, c_intptr_t, c_size_t, c_null_funptr, c_f_pointer, c_loc, c_sizeof
77
use julienne_m, only: call_julienne_assert_, test_description_t, test_diagnosis_t, test_result_t, test_t, string_t, usher &
8-
,operator(.also.), operator(.expect.), operator(.equalsExpected.), operator(.isAtLeast.), operator(.isAtMost.), operator(.lessThan.), operator(//)
8+
,operator(.also.), operator(.equalsExpected.), operator(.isAtLeast.), operator(.isAtMost.), operator(.lessThan.), operator(//)
99
use prif
1010
#if FORCE_PRIF_0_5 || FORCE_PRIF_0_6
1111
use prif, only : prif_deallocate_coarray_ => prif_deallocate_coarray
@@ -401,7 +401,7 @@ function check_atomic_contended() result(diag)
401401
call prif_atomic_cas_logical_indirect(root, base_addr_logical, &
402402
old=value_logical, compare=tmp_logical, new=(.not. tmp_logical))
403403
if (value_logical .eqv. tmp_logical) exit ! success
404-
ALSO2(.expect. logical(value_logical .eqv. .not. tmp_logical), desc//"mid-swap sanity check")
404+
ALSO2(logical(value_logical .eqv. .not. tmp_logical), desc//"mid-swap sanity check")
405405
tmp_logical = value_logical ! collision => retry
406406
end do
407407

test/prif_co_reduce_test.F90

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module prif_co_reduce_test_m
88
,operator(.also.) &
99
,operator(.approximates.) &
1010
,operator(.equalsExpected.) &
11-
,operator(.expect.) &
1211
,operator(.within.) &
1312
,operator(//) &
1413
,usher &
@@ -75,14 +74,14 @@ function check_logical() result(diag)
7574

7675
val = .true.
7776
call prif_co_reduce(val, op, c_null_ptr)
78-
ALSO(.expect. val)
77+
ALSO(val)
7978

8079
call prif_this_image_no_coarray(this_image=me)
8180
if (me == 1) then
8281
val = .false.
8382
end if
8483
call prif_co_reduce(val, op, c_null_ptr)
85-
ALSO(.expect. (.not. val))
84+
ALSO(.not. val)
8685
end function
8786

8887
subroutine and_wrapper(arg1, arg2_and_out, count, cdata) bind(C)

test/prif_coarray_inquiry_test.F90

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ module prif_coarray_inquiry_test_m
2020
,operator(.all.) &
2121
,operator(.also.) &
2222
,operator(.equalsExpected.) &
23-
,operator(.expect.) &
2423
,usher &
2524
,string_t &
2625
,test_description_t &
@@ -77,7 +76,7 @@ function check_prif_local_data_pointer() result(diag)
7776
coarray_handle, &
7877
allocation_ptr)
7978
call prif_local_data_pointer(coarray_handle, local_ptr)
80-
diag = .expect. c_associated(local_ptr, allocation_ptr)
79+
diag = c_associated(local_ptr, allocation_ptr)
8180
call prif_deallocate_coarray(coarray_handle)
8281
end function
8382

@@ -113,7 +112,7 @@ impure elemental function check_cobound(corank) result(diag)
113112
lcobounds, ucobounds, data_size, c_null_funptr, &
114113
coarray_handle, allocated_memory)
115114

116-
ALSO(.expect. c_associated(allocated_memory))
115+
ALSO(c_associated(allocated_memory))
117116

118117
call prif_size_bytes(coarray_handle, data_size=query_size)
119118
ALSO2(query_size .equalsExpected. data_size, "prif_size_bytes is valid")

test/prif_image_queries_test.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function valid_image_list(nums) result(diag)
6161

6262
call prif_num_images(num_images=ni)
6363
diag = &
64-
.expect. allocated(nums) .also. &
64+
allocated(nums) .also. &
6565
(size(nums) .isAtMost. ni) .also. &
6666
(.all. (nums .isAtLeast. 1)) .also. &
6767
(.all. (nums .isAtMost. ni)) .also. &

test/prif_sync_images_test.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module prif_sync_images_test_m
22
use iso_c_binding, only: c_int
33
use prif, only : prif_sync_images, prif_this_image_no_coarray, prif_num_images, prif_sync_all
4-
use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, operator(.expect.), usher
4+
use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, usher
55

66
implicit none
77
private

test/prif_types_test.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module prif_types_test_m
44
use iso_fortran_env, only: int8
55
use prif, only: prif_team_type, prif_event_type, prif_notify_type, prif_lock_type, prif_critical_type
66
use julienne_m, only: test_description_t, test_diagnosis_t, test_result_t, test_t, string_t, usher &
7-
,operator(.all.), operator(.also.), operator(.expect.), operator(.equalsExpected.), operator(.greaterThan.), operator(.isAtMost.), operator(//)
7+
,operator(.all.), operator(.also.), operator(.equalsExpected.), operator(.greaterThan.), operator(.isAtMost.), operator(//)
88

99
implicit none
1010
private
@@ -61,7 +61,7 @@ function check_team_type() result(diag)
6161
! default initialization check
6262
pointer_wrap%info => tgt
6363
pointer_wrap = transfer(team, pointer_wrap)
64-
ALSO2(.expect.(.not. associated(pointer_wrap%info)), "default initialization to null")
64+
ALSO2(.not. associated(pointer_wrap%info), "default initialization to null")
6565
end function
6666

6767
function check_event_type() result(diag)

test/test-utils.F90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#endif
1818

1919
#define ALSO(exp) ALSO2(exp, "expression: (" // CPP_STRINGIFY_SOURCE(exp) // ")")
20-
#define ALSO2(exp,desc) diag = diag .also. (exp) // NEW_LINE(' ') // \
21-
__FILE__ // ":" // CPP_LINE_STRING // ": FAILED: " // desc
20+
#define ALSO2(exp,desc) diag = diag .also. \
21+
( test_diagnosis_t(exp, NEW_LINE('')) // \
22+
__FILE__ // ":" // CPP_LINE_STRING // ": FAILED: " // desc )
2223

0 commit comments

Comments
 (0)