Skip to content

Commit 2434a05

Browse files
authored
Merge pull request #42 from sourceryinstitute/image-1-reports
Image 1 reports test results + elemental co_all
2 parents a0d7831 + 80bed7d commit 2434a05

File tree

6 files changed

+27
-18
lines changed

6 files changed

+27
-18
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2020, Sourcery Institute
3+
Copyright (c) 2020-2023, Sourcery Institute
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

fpm.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name = "sourcery"
2-
version = "3.7.0"
2+
version = "3.8.0"
33
license = "BSD"
44
author = ["Damian Rouson"]
55
maintainer = "[email protected]"
6-
copyright = "2020-2022 Sourcery Institute"
6+
copyright = "2020-2023 Sourcery Institute"
77

88
[dependencies]
99
assert = {git = "https://github.com/sourceryinstitute/assert", tag = "1.4.0"}

src/sourcery/test_s.f90

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
submodule(test_m) test_s
2+
use user_defined_collectives_m, only : co_all
23
implicit none
34

45
contains
56

67
module procedure report
78
integer i
89

9-
print *
10-
print *, test%subject()
11-
associate(test_results => test%results())
12-
associate(num_tests => size(test_results))
13-
tests = tests + num_tests
14-
do i=1,num_tests
15-
print *," ",test_results(i)%characterize()
16-
end do
17-
associate(num_passes => count(test_results%passed()))
18-
print '(a,2(i0,a))'," ",num_passes," of ", num_tests," tests pass."
19-
passes = passes + num_passes
10+
associate(me => this_image())
11+
if (me==1) print *, new_line('a'), test%subject()
12+
associate(test_results => test%results())
13+
associate(num_tests => size(test_results))
14+
tests = tests + num_tests
15+
if (me==1) then
16+
do i=1,num_tests
17+
if (me==1) print *," ",test_results(i)%characterize()
18+
end do
19+
end if
20+
block
21+
logical, allocatable :: passing_tests(:)
22+
passing_tests = test_results%passed()
23+
call co_all(passing_tests)
24+
associate(num_passes => count(passing_tests))
25+
if (me==1) print '(a,2(i0,a))'," ",num_passes," of ", num_tests," tests pass."
26+
passes = passes + num_passes
27+
end associate
28+
end block
2029
end associate
2130
end associate
2231
end associate

src/sourcery/user_defined_collectives_m.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module user_defined_collectives_m
1212

1313
interface
1414

15-
module subroutine co_all(boolean)
15+
impure elemental module subroutine co_all(boolean)
1616
!! If any image in a team calls this subroutine, then every image in the
1717
!! the same team must call this subroutine. This subroutine sets the
1818
!! "boolean" argument .true. if it is true in all participating images

test/main.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ program main
2626
call command_line_test%report(passes, tests)
2727
call string_test%report(passes, tests)
2828

29-
print *
30-
print *,"_________ In total, ",passes," of ",tests, " tests pass. _________"
29+
if (this_image()==1) print *, new_line('a'), "_________ In total, ",passes," of ",tests, " tests pass. _________"
30+
if (passes /= tests) error stop
3131
end program

test/test_result_test.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function results() result(test_results)
2424
type(test_result_t), allocatable :: test_results(:)
2525

2626
test_results = [ &
27-
test_result_t("constructs and array of test_result_t objects elmentally", check_array_result_construction()) &
27+
test_result_t("constructs and array of test_result_t objects elementally", check_array_result_construction()) &
2828
]
2929
end function
3030

0 commit comments

Comments
 (0)