-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpftest_serial_before_after.pf
56 lines (42 loc) · 1.42 KB
/
pftest_serial_before_after.pf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
! 1. This test suite should be executed with atleast 3 MPI processes
! 2. When building these tests pass the "-DUSE_MPI=YES" to the
! compiler. If this option is not provided only the non-MPI tests,
! tests that don't have npes specified, will be run
module test_serial_before_after
use pfunit_mod
implicit none
integer :: num_tests
integer :: test_sz = 0
public :: init, finalise, test_one, test_two
contains
@before
subroutine init()
implicit none
num_tests = 0
test_sz = 1
end subroutine init
! Cannot use "finalize" because "pfunit_mod" already
! defines it - yikes
@after
subroutine finalise()
implicit none
! "num_tests" should be equal to 1 - Since the init/finalize
! is run before every test
@assertEqual(num_tests, 1, "Number of tests is not equal to 1")
@assertEqual(test_sz, 1)
end subroutine finalise
@test
subroutine test_one()
implicit none
num_tests = num_tests + 1
@assertFalse(test_sz == 0, "Test size is equal to 0 - fixtures not working")
@assertTrue(test_sz == 1, "Test size is not equal to 1 - fixtures not working")
end subroutine test_one
@test
subroutine test_two()
implicit none
num_tests = num_tests + 1
@assertFalse(test_sz == 0, "Test size is equal to 0 - fixtures not working")
@assertTrue(test_sz == 1, "Test size is not equal to 1 - fixtures not working")
end subroutine test_two
end module test_serial_before_after