Skip to content

Commit 0f1b290

Browse files
committed
convert unit tests to FORD documentation syntax.
1 parent 131d37f commit 0f1b290

12 files changed

+163
-545
lines changed

src/tests/jf_test_1.f90

+14-50
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,9 @@
1-
!*******************************************************************************************************
2-
!****u* JSON/jf_test_1
1+
!*****************************************************************************************
2+
!>
3+
! Module for the first unit test.
34
!
4-
! NAME
5-
! jf_test_1
6-
!
7-
! DESCRIPTION
8-
! First unit test
9-
!
10-
! USES
11-
! json_module
12-
! iso_fortran_env (intrinsic)
13-
!
14-
! HISTORY
15-
! Izaak Beekman : 2/18/2015 : Created (refactoried original json_example.f90 file)
16-
!
17-
! LICENSE
18-
!
19-
! JSON-Fortran: A Fortran 2008 JSON API
20-
!
21-
! https://github.com/jacobwilliams/json-fortran
22-
!
23-
! Copyright (c) 2014, Jacob Williams
24-
!
25-
! All rights reserved.
26-
!
27-
! Redistribution and use in source and binary forms, with or without modification,
28-
! are permitted provided that the following conditions are met:
29-
! * Redistributions of source code must retain the above copyright notice, this
30-
! list of conditions and the following disclaimer.
31-
! * Redistributions in binary form must reproduce the above copyright notice, this
32-
! list of conditions and the following disclaimer in the documentation and/or
33-
! other materials provided with the distribution.
34-
! * The names of its contributors may not be used to endorse or promote products
35-
! derived from this software without specific prior written permission.
36-
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
37-
! ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
38-
! WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39-
! DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
40-
! ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41-
! (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42-
! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
43-
! ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44-
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45-
! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46-
!
47-
! SOURCE
5+
!# HISTORY
6+
! * Izaak Beekman : 2/18/2015 : Created (refactoried original json_example.f90 file)
487

498
module jf_test_1_mod
509

@@ -53,14 +12,14 @@ module jf_test_1_mod
5312

5413
implicit none
5514

56-
character(len=*),parameter :: dir = '../files/inputs/' !working directory
15+
character(len=*),parameter :: dir = '../files/inputs/' !! working directory
5716
character(len=*),parameter :: filename1 = 'test1.json'
5817

5918
contains
6019

6120
subroutine test_1(error_cnt)
6221

63-
! Read a sample JSON file and retrieve some data from it
22+
!! Read a sample JSON file and retrieve some data from it
6423

6524
implicit none
6625

@@ -284,14 +243,19 @@ subroutine test_1(error_cnt)
284243
end subroutine test_1
285244

286245
end module jf_test_1_mod
246+
!*****************************************************************************************
287247

248+
!*****************************************************************************************
288249
program jf_test_1
250+
251+
!! First unit test.
252+
289253
use jf_test_1_mod , only: test_1
290254
implicit none
291255
integer :: n_errors
292256
n_errors = 0
293257
call test_1(n_errors)
294258
if (n_errors /= 0) stop 1
259+
295260
end program jf_test_1
296-
297-
!*******************************************************************************************************
261+
!*****************************************************************************************

src/tests/jf_test_10.f90

+11-45
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,8 @@
1-
!*******************************************************************************************************
2-
!****u* JSON/jf_test_10
1+
!*****************************************************************************************
2+
!> author: Jacob Williams
3+
! date: 3/10/2015
34
!
4-
! NAME
5-
! jf_test_10
6-
!
7-
! DESCRIPTION
8-
! Tenth unit test.
9-
!
10-
! AUTHOR
11-
! Jacob Williams : 3/10/3015
12-
!
13-
! LICENSE
14-
!
15-
! JSON-Fortran: A Fortran 2008 JSON API
16-
!
17-
! https://github.com/jacobwilliams/json-fortran
18-
!
19-
! Copyright (c) 2014, Jacob Williams
20-
!
21-
! All rights reserved.
22-
!
23-
! Redistribution and use in source and binary forms, with or without modification,
24-
! are permitted provided that the following conditions are met:
25-
! * Redistributions of source code must retain the above copyright notice, this
26-
! list of conditions and the following disclaimer.
27-
! * Redistributions in binary form must reproduce the above copyright notice, this
28-
! list of conditions and the following disclaimer in the documentation and/or
29-
! other materials provided with the distribution.
30-
! * The names of its contributors may not be used to endorse or promote products
31-
! derived from this software without specific prior written permission.
32-
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33-
! ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34-
! WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35-
! DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
36-
! ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37-
! (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38-
! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
39-
! ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40-
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41-
! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42-
!
43-
! SOURCE
5+
! Module for the tenth unit test.
446

457
module jf_test_10_mod
468

@@ -56,7 +18,7 @@ module jf_test_10_mod
5618

5719
subroutine test_10(error_cnt)
5820

59-
! Test some of the lesser-used features of the library
21+
!! Test some of the lesser-used features of the library
6022

6123
implicit none
6224

@@ -353,14 +315,18 @@ subroutine test_10(error_cnt)
353315
end subroutine test_10
354316

355317
end module jf_test_10_mod
318+
!*****************************************************************************************
356319

320+
!*****************************************************************************************
357321
program jf_test_10
322+
323+
!! Tenth unit test.
324+
358325
use jf_test_10_mod , only: test_10
359326
implicit none
360327
integer :: n_errors
361328
n_errors = 0
362329
call test_10(n_errors)
363330
if (n_errors /= 0) stop 1
364331
end program jf_test_10
365-
366-
!*******************************************************************************************************
332+
!*****************************************************************************************

src/tests/jf_test_11.F90

+12-50
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,8 @@
1-
!*******************************************************************************************************
2-
!****u* JSON/jf_test_11
1+
!*****************************************************************************************
2+
!> author: Izaak Beekman
3+
! date: 3/13/2015
34
!
4-
! NAME
5-
! jf_test_11
6-
!
7-
! DESCRIPTION
8-
! 11th unit test to test unicode support if enabled
9-
!
10-
! USES
11-
! json_module
12-
! iso_fortran_env (intrinsic)
13-
!
14-
! HISTORY
15-
! Izaak Beekman : created : 3/13/2015
16-
!
17-
! LICENSE
18-
!
19-
! JSON-Fortran: A Fortran 2008 JSON API
20-
!
21-
! https://github.com/jacobwilliams/json-fortran
22-
!
23-
! Copyright (c) 2014, Jacob Williams
24-
!
25-
! All rights reserved.
26-
!
27-
! Redistribution and use in source and binary forms, with or without modification,
28-
! are permitted provided that the following conditions are met:
29-
! * Redistributions of source code must retain the above copyright notice, this
30-
! list of conditions and the following disclaimer.
31-
! * Redistributions in binary form must reproduce the above copyright notice, this
32-
! list of conditions and the following disclaimer in the documentation and/or
33-
! other materials provided with the distribution.
34-
! * The names of its contributors may not be used to endorse or promote products
35-
! derived from this software without specific prior written permission.
36-
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
37-
! ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
38-
! WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39-
! DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
40-
! ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41-
! (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42-
! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
43-
! ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44-
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45-
! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46-
!
47-
! SOURCE
5+
! Module for the 11th unit test to test unicode support if enabled.
486

497
module jf_test_11_mod
508

@@ -53,7 +11,7 @@ module jf_test_11_mod
5311

5412
implicit none
5513

56-
character(len=*),parameter :: dir = '../files/inputs/' !working directory
14+
character(len=*),parameter :: dir = '../files/inputs/' !! working directory
5715
# ifdef USE_UCS4
5816
character(len=*),parameter :: unicode_file = 'hello-world-ucs4.json'
5917
#endif
@@ -63,7 +21,7 @@ module jf_test_11_mod
6321

6422
subroutine test_11(error_cnt)
6523

66-
! Read the file generated in jf_test_2, and extract some data from it.
24+
!! Read the file and extract some data from it.
6725

6826
implicit none
6927

@@ -319,14 +277,18 @@ subroutine test_11(error_cnt)
319277
end subroutine test_11
320278

321279
end module jf_test_11_mod
280+
!*****************************************************************************************
322281

282+
!*****************************************************************************************
323283
program jf_test_11
284+
285+
!! 11th unit test.
286+
324287
use jf_test_11_mod , only: test_11
325288
implicit none
326289
integer :: n_errors
327290
n_errors = 0
328291
call test_11(n_errors)
329292
if (n_errors /= 0) stop 1
330293
end program jf_test_11
331-
332-
!*******************************************************************************************************
294+
!*****************************************************************************************

src/tests/jf_test_12.f90

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
!*****************************************************************************************
2+
!> author: Izaak Beekman
3+
! date: 07/27/2015
4+
!
5+
! Module for the 12th unit test.
6+
17
module jf_test_12_mod
28

39
use json_module
410
use, intrinsic :: iso_fortran_env , only: error_unit, output_unit, wp => real64
511

612
implicit none
713

8-
character(len=*),parameter :: dir = '../files/' !! Path to write JSON file to
9-
character(len=*),parameter :: file = 'test12.json' !! Filename to write
14+
character(len=*),parameter :: dir = '../files/' !! Path to write JSON file to
15+
character(len=*),parameter :: file = 'test12.json' !! Filename to write
1016
real(wp), parameter :: TOL = 100*epsilon(1.0_wp) !! Tolerance for real comparisons
1117

1218
contains
@@ -162,6 +168,7 @@ subroutine test_12(error_cnt)
162168
close(lun)
163169

164170
contains
171+
165172
subroutine check_errors(assertion)
166173
logical, optional, intent(in) :: assertion
167174
if (json_failed()) then
@@ -189,13 +196,19 @@ subroutine get_3D_from_array(element, i, count)
189196

190197
end subroutine
191198

192-
end module
199+
end module jf_test_12_mod
200+
!*****************************************************************************************
193201

202+
!*****************************************************************************************
194203
program jf_test_12
204+
205+
!! 12th unit test.
206+
195207
use jf_test_12_mod, only: test_12
196208
implicit none
197209
integer :: n_errors
198210
n_errors = 0
199211
call test_12(n_errors)
200212
if ( n_errors /= 0) stop 1
201-
end program
213+
end program jf_test_12
214+
!*****************************************************************************************

0 commit comments

Comments
 (0)