Skip to content

Commit dc19fdd

Browse files
committed
feat: rm object_t test from test/main
1 parent 9033c72 commit dc19fdd

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

tests/main.f90

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@ subroutine run()
1111
use formats_test, only: &
1212
formats_object => &
1313
test_object
14-
use object_m_test, only: &
15-
object_m_object => &
16-
test_object
1714
use vegetables, only: test_item_t, test_that, run_tests
1815

1916

2017

2118
type(test_item_t) :: tests
22-
type(test_item_t) :: individual_tests(3)
19+
type(test_item_t) :: individual_tests(2)
2320

2421
individual_tests(1) = data_partition_data_partition()
2522
individual_tests(2) = formats_object()
26-
individual_tests(3) = object_m_object()
2723
tests = test_that(individual_tests)
2824

2925

tests/object_m_test.f90

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,60 @@
11
module object_m_test
2-
!! author: Damian Rouson
3-
!!
4-
!! summary: verify object pattern asbtract parent
5-
use vegetables, only: &
6-
result_t, input_t, integer_input_t, test_item_t, & ! types
7-
describe, it, assert_equals, assert_that, assert_not ! functions
8-
use object_m, only : object_t
9-
implicit none
2+
!! Verify object pattern asbtract parent
3+
use test_m, only : test_t, test_result_t
4+
use object_m, only : object_t
5+
implicit none
106

11-
private
12-
public :: test_object
7+
private
8+
public :: object_test_t
139

14-
type, extends(object_t) :: subject
15-
contains
16-
procedure write_formatted
17-
end type
10+
type, extends(test_t) :: object_test_t
11+
contains
12+
procedure, nopass :: subject
13+
procedure, nopass :: results
14+
end type
15+
16+
type, extends(object_t) :: subject_t
17+
contains
18+
procedure write_formatted
19+
end type
1820

1921
contains
2022

21-
function test_object() result(tests)
22-
type(test_item_t) tests
23+
pure function subject() result(specimen)
24+
character(len=:), allocatable :: specimen
25+
specimen = "The object_m type"
26+
end function
27+
28+
pure function results() result(test_results)
29+
type(test_result_t), allocatable :: test_results(:)
2330

24-
tests = describe( &
25-
"object class", &
26-
[it( &
27-
".not. user_defined() if only default-initialized", &
28-
check_default_initialization), &
29-
it( &
30-
"user_defined() after call mark_as_defined", &
31-
check_mark_as_defined)])
31+
test_results = [ &
32+
test_result_t(".not. user_defined() if only default-initialized", check_default_initialization()), &
33+
test_result_t("user_defined() after call mark_as_defined", check_mark_as_defined()) &
34+
]
3235
end function
3336

34-
function check_default_initialization() result(result_)
37+
pure function check_default_initialization() result(passed)
3538
!! Verify that user_defined() is .false. for a default-initialied object
36-
class(object_t), allocatable :: object
37-
type(result_t) result_
38-
39-
allocate(subject :: object)
39+
class(object_t), allocatable :: object
40+
logical passed
4041

41-
result_ = assert_not(object%user_defined())
42+
allocate(subject_t :: object)
43+
passed = .not. object%user_defined()
4244
end function
4345

44-
function check_mark_as_defined() result(result_)
46+
pure function check_mark_as_defined() result(passed)
4547
!! Verify that mark_as_defined results in user_defined() being .true.
4648
class(object_t), allocatable :: object
47-
type(result_t) result_
48-
49-
allocate(subject :: object)
49+
logical passed
5050

51+
allocate(subject_t :: object)
5152
call object%mark_as_defined
52-
result_ = assert_that(object%user_defined())
53+
passed = object%user_defined()
5354
end function
5455

5556
subroutine write_formatted(self, unit, iotype, v_list, iostat, iomsg)
56-
class(subject), intent(in) :: self
57+
class(subject_t), intent(in) :: self
5758
integer, intent(in) :: unit
5859
character(*), intent(in) :: iotype
5960
integer, intent(in) :: v_list(:)
@@ -67,7 +68,7 @@ subroutine write_formatted(self, unit, iotype, v_list, iostat, iomsg)
6768
iomsg = ""
6869
case default
6970
iostat = -1
70-
iomsg = "object_m_test: subject%write_formatted iotype received unsupported iotype " // iotype
71+
iomsg = "object_m_test: subject_t%write_formatted iotype received unsupported iotype " // iotype
7172
end select
7273

7374
associate( unused => v_list)

tests/test-driver.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
program main
22
use user_defined_collectives_test, only : collectives_test_t
3+
use object_m_test, only : object_test_t
34
implicit none
45

56
type(collectives_test_t) collectives_test
7+
type(object_test_t) object_test
68

79
call collectives_test%report()
10+
call object_test%report()
811
end program

0 commit comments

Comments
 (0)