FV3 Bundle
UnitTest_Define.f90
Go to the documentation of this file.
1 !
2 ! UnitTest_Define
3 !
4 ! Module defining the UnitTest object
5 !
6 !
7 ! CREATION HISTORY:
8 ! Written by: Paul van Delst, 05-Feb-2007
9 ! paul.vandelst@noaa.gov
10 !
11 
13 
14  ! ------------------
15  ! Environment setup
16  ! -----------------
17  ! Module usage
18  USE type_kinds , ONLY: byte, short, long, single, double
19  USE compare_float_numbers, ONLY: OPERATOR(.equalto.)
20  ! Disable implicit typing
21  IMPLICIT NONE
22 
23  ! ------------
24  ! Visibilities
25  ! ------------
26  ! Everything private by default
27  PRIVATE
28  ! Datatypes
29  PUBLIC :: unittest_type
30  ! Procedures
31  PUBLIC :: unittest_init
32  PUBLIC :: unittest_setup
33  PUBLIC :: unittest_report
34  PUBLIC :: unittest_summary
35  PUBLIC :: unittest_n_passed
36  PUBLIC :: unittest_n_failed
37  PUBLIC :: unittest_passed
38  PUBLIC :: unittest_failed
39  PUBLIC :: unittest_assert
40  PUBLIC :: unittest_isequal
41  PUBLIC :: unittest_isequalwithin
42  PUBLIC :: unittest_defineversion
43 
44 
45  ! ---------------------
46  ! Procedure overloading
47  ! ---------------------
48  ! PUBLIC procedures
49  INTERFACE unittest_isequal
50  ! INTEGER(Byte) procedures
51  MODULE PROCEDURE intbyte_isequal_scalar
52  MODULE PROCEDURE intbyte_isequal_rank1
53  MODULE PROCEDURE intbyte_isequal_rank2
54  ! INTEGER(Short) procedures
55  MODULE PROCEDURE intshort_isequal_scalar
56  MODULE PROCEDURE intshort_isequal_rank1
57  MODULE PROCEDURE intshort_isequal_rank2
58  ! INTEGER(Long) procedures
59  MODULE PROCEDURE intlong_isequal_scalar
60  MODULE PROCEDURE intlong_isequal_rank1
61  MODULE PROCEDURE intlong_isequal_rank2
62  ! REAL(Single) procedures
63  MODULE PROCEDURE realsp_isequal_scalar
64  MODULE PROCEDURE realsp_isequal_rank1
65  MODULE PROCEDURE realsp_isequal_rank2
66  ! REAL(Double) procedures
67  MODULE PROCEDURE realdp_isequal_scalar
68  MODULE PROCEDURE realdp_isequal_rank1
69  MODULE PROCEDURE realdp_isequal_rank2
70  ! COMPLEX(Single) procedures
71  MODULE PROCEDURE complexsp_isequal_scalar
72  MODULE PROCEDURE complexsp_isequal_rank1
73  MODULE PROCEDURE complexsp_isequal_rank2
74  ! COMPLEX(Double) procedures
75  MODULE PROCEDURE complexdp_isequal_scalar
76  MODULE PROCEDURE complexdp_isequal_rank1
77  MODULE PROCEDURE complexdp_isequal_rank2
78  ! CHARACTER(*) procedures
79  MODULE PROCEDURE char_isequal_scalar
80  MODULE PROCEDURE char_isequal_rank1
81  MODULE PROCEDURE char_isequal_rank2
82  END INTERFACE unittest_isequal
83 
85  ! REAL(Single) procedures
86  MODULE PROCEDURE realsp_isequalwithin_scalar
87  MODULE PROCEDURE realsp_isequalwithin_rank1
88  MODULE PROCEDURE realsp_isequalwithin_rank2
89  ! REAL(Double) procedures
90  MODULE PROCEDURE realdp_isequalwithin_scalar
91  MODULE PROCEDURE realdp_isequalwithin_rank1
92  MODULE PROCEDURE realdp_isequalwithin_rank2
93  ! COMPLEX(Single) procedures
94  MODULE PROCEDURE complexsp_isequalwithin_scalar
95  MODULE PROCEDURE complexsp_isequalwithin_rank1
96  MODULE PROCEDURE complexsp_isequalwithin_rank2
97  ! COMPLEX(Double) procedures
98  MODULE PROCEDURE complexdp_isequalwithin_scalar
99  MODULE PROCEDURE complexdp_isequalwithin_rank1
100  MODULE PROCEDURE complexdp_isequalwithin_rank2
101  END INTERFACE unittest_isequalwithin
102 
103 
104  ! PRIVATE procedures
105  INTERFACE get_multiplier
106  MODULE PROCEDURE realsp_get_multiplier
107  MODULE PROCEDURE realdp_get_multiplier
108  END INTERFACE get_multiplier
109 
110 
111  ! -----------------
112  ! Module parameters
113  ! -----------------
114  CHARACTER(*), PARAMETER :: module_version_id = &
115  '$Id: UnitTest_Define.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
116  INTEGER, PARAMETER :: sl = 512
117  INTEGER, PARAMETER :: cr = 13
118  INTEGER, PARAMETER :: lf = 10
119  CHARACTER(2), PARAMETER :: crlf = achar(cr)//achar(lf)
120  CHARACTER(*), PARAMETER :: rfmt = 'es25.18'
121  CHARACTER(*), PARAMETER :: zfmt = '"(",'//rfmt//',",",'//rfmt//',")"'
122  LOGICAL, PARAMETER :: default_verbose = .false.
123 
124  ! Message colours
125  CHARACTER(*), PARAMETER :: green_colour = achar(27)//'[1;32m'
126  CHARACTER(*), PARAMETER :: red_colour = achar(27)//'[1;31m'
127  CHARACTER(*), PARAMETER :: no_colour = achar(27)//'[0m'
128 
129  ! Message levels
130  INTEGER, PARAMETER :: n_message_levels = 6
131  INTEGER, PARAMETER :: init_level = 1
132  INTEGER, PARAMETER :: setup_level = 2
133  INTEGER, PARAMETER :: test_level = 3
134  INTEGER, PARAMETER :: report_level = 4
135  INTEGER, PARAMETER :: summary_level = 5
136  INTEGER, PARAMETER :: internal_fail_level = 6
137  CHARACTER(*), PARAMETER :: message_level(n_message_levels) = &
138  [ 'INIT ', &
139  'SETUP ', &
140  'TEST ', &
141  'REPORT ', &
142  'SUMMARY ', &
143  'INTERNAL FAILURE' ]
144 
145  ! ------------------------
146  ! Derived type definitions
147  ! ------------------------
148  !:tdoc+:
150  PRIVATE
151  ! User accessible test settings
152  LOGICAL :: verbose = default_verbose
153  CHARACTER(SL) :: title = ''
154  CHARACTER(SL) :: caller = ''
155  ! Internal test settings
156  ! ...Test result messaging
157  INTEGER :: level = init_level
158  CHARACTER(SL) :: Procedure = ''
159  CHARACTER(SL) :: message = ''
160  ! ...Test result (used for array argument procedures)
161  LOGICAL :: test_result = .true.
162  ! ...Individual test counters
163  INTEGER :: n_tests = 0
164  INTEGER :: n_passed_tests = 0
165  INTEGER :: n_failed_tests = 0
166  ! ...All test counters
167  INTEGER :: n_alltests = 0
168  INTEGER :: n_passed_alltests = 0
169  INTEGER :: n_failed_alltests = 0
170  END TYPE unittest_type
171  !:tdoc-:
172 
173 CONTAINS
174 
175 
176 !################################################################################
177 !################################################################################
178 !## ##
179 !## ## PUBLIC MODULE ROUTINES ## ##
180 !## ##
181 !################################################################################
182 !################################################################################
183 
184 !------------------------------------------------------------------------------
185 !:sdoc+:
186 !
187 ! NAME:
188 ! UnitTest_Init
189 !
190 ! PURPOSE:
191 ! UnitTest initialisation subroutine.
192 !
193 ! This subroutine should be called ONCE, BEFORE ANY tests are performed.
194 !
195 ! CALLING SEQUENCE:
196 ! CALL UnitTest_Init( UnitTest, Verbose=Verbose )
197 !
198 ! OBJECTS:
199 ! UnitTest: UnitTest object.
200 ! UNITS: N/A
201 ! TYPE: TYPE(UnitTest_type)
202 ! DIMENSION: Scalar
203 ! ATTRIBUTES: INTENT(OUT)
204 !
205 ! OPTIONAL INPUTS:
206 ! Verbose: Logical argument to control length of reporting output.
207 ! If == .FALSE., Only failed tests are reported [DEFAULT].
208 ! == .TRUE., Both failed and passed tests are reported.
209 ! If not specified, default is .TRUE.
210 ! UNITS: N/A
211 ! TYPE: LOGICAL
212 ! DIMENSION: Scalar
213 ! ATTRIBUTES: INTENT(IN), OPTIONAL
214 !
215 !:sdoc-:
216 !------------------------------------------------------------------------------
217 
218  SUBROUTINE unittest_init( UnitTest, Verbose )
219  ! Arguments
220  TYPE(unittest_type), INTENT(OUT) :: unittest
221  LOGICAL, OPTIONAL, INTENT(IN) :: verbose
222  ! Parameters
223  CHARACTER(*), PARAMETER :: procedure_name = 'UnitTest_Init'
224  ! Variables
225  LOGICAL :: local_verbose
226 
227  ! Check optional arguments
228  local_verbose = default_verbose
229  IF ( PRESENT(verbose) ) local_verbose = verbose
230 
231  ! Perform initialisation
232  CALL set_property( &
233  unittest, &
234  verbose = local_verbose, &
235  level = init_level, &
236  Procedure = procedure_name, &
237  n_tests = 0, &
238  n_passed_tests = 0, &
239  n_failed_tests = 0, &
240  n_alltests = 0, &
241  n_passed_alltests = 0, &
242  n_failed_alltests = 0 )
243  CALL display_message( unittest )
244  END SUBROUTINE unittest_init
245 
246 
247 !------------------------------------------------------------------------------
248 !:sdoc+:
249 !
250 ! NAME:
251 ! UnitTest_Setup
252 !
253 ! PURPOSE:
254 ! UnitTest individual test setup subroutine.
255 !
256 ! This subroutine should be called BEFORE each set of tests performed.
257 !
258 ! CALLING SEQUENCE:
259 ! CALL UnitTest_Setup( UnitTest , &
260 ! Title , &
261 ! Caller = Caller , &
262 ! Verbose = Verbose )
263 !
264 ! OBJECT:
265 ! UnitTest: UnitTest object.
266 ! UNITS: N/A
267 ! TYPE: TYPE(UnitTest_type)
268 ! DIMENSION: Scalar
269 ! ATTRIBUTES: INTENT(IN OUT)
270 !
271 ! INPUTS:
272 ! Title: Character string containing the title of the test
273 ! to be performed.
274 ! UNITS: N/A
275 ! TYPE: CHARACTER(*)
276 ! DIMENSION: Scalar
277 ! ATTRIBUTES: INTENT(IN)
278 !
279 ! OPTIONAL INPUTS:
280 ! Caller: Character string containing the name of the calling
281 ! subprogram. If not specified, default is an empty string.
282 ! UNITS: N/A
283 ! TYPE: CHARACTER(*)
284 ! DIMENSION: Scalar
285 ! ATTRIBUTES: INTENT(IN), OPTIONAL
286 !
287 ! Verbose: Logical argument to control length of reporting output.
288 ! If == .FALSE., Only failed tests are reported [DEFAULT].
289 ! == .TRUE., Both failed and passed tests are reported.
290 ! If not specified, default is .TRUE.
291 ! UNITS: N/A
292 ! TYPE: LOGICAL
293 ! DIMENSION: Scalar
294 ! ATTRIBUTES: INTENT(IN), OPTIONAL
295 !
296 !:sdoc-:
297 !------------------------------------------------------------------------------
298 
299  SUBROUTINE unittest_setup( UnitTest, Title, Caller, Verbose )
300  ! Arguments
301  TYPE(unittest_type) , INTENT(IN OUT) :: unittest
302  CHARACTER(*) , INTENT(IN) :: title
303  CHARACTER(*), OPTIONAL, INTENT(IN) :: caller
304  LOGICAL, OPTIONAL, INTENT(IN) :: verbose
305  ! Parameters
306  CHARACTER(*), PARAMETER :: procedure_name = 'UnitTest_Setup'
307  ! Variables
308  CHARACTER(SL) :: local_caller
309  LOGICAL :: local_verbose
310  CHARACTER(SL) :: message
311 
312  ! Check arguments
313  local_caller = ''
314  IF ( PRESENT(caller) ) local_caller = '; CALLER: '//trim(adjustl(caller))
315  local_verbose = default_verbose
316  IF ( PRESENT(verbose) ) local_verbose = verbose
317 
318  ! Create init message
319  message = trim(title)//trim(local_caller)
320 
321  ! Perform initialistion
322  CALL set_property( &
323  unittest, &
324  title = adjustl(title), &
325  caller = local_caller , &
326  verbose = local_verbose , &
327  level = setup_level, &
328  Procedure = procedure_name, &
329  message = message, &
330  n_tests = 0, &
331  n_passed_tests = 0, &
332  n_failed_tests = 0 )
333  CALL display_message( unittest )
334 
335  END SUBROUTINE unittest_setup
336 
337 
338 !------------------------------------------------------------------------------
339 !:sdoc+:
340 !
341 ! NAME:
342 ! UnitTest_Report
343 !
344 ! PURPOSE:
345 ! UnitTest individual test report subroutine
346 !
347 ! This subroutine should be called AFTER each set of tests performed.
348 !
349 ! CALLING SEQUENCE:
350 ! CALL UnitTest_Report( UnitTest )
351 !
352 ! OBJECT:
353 ! UnitTest: UnitTest object.
354 ! UNITS: N/A
355 ! TYPE: TYPE(UnitTest_type)
356 ! DIMENSION: Scalar
357 ! ATTRIBUTES: INTENT(IN)
358 !
359 !:sdoc-:
360 !------------------------------------------------------------------------------
361 
362  SUBROUTINE unittest_report( UnitTest )
363  ! Arguments
364  TYPE(unittest_type), INTENT(IN OUT) :: unittest
365  ! Parameters
366  CHARACTER(*), PARAMETER :: procedure_name = 'UnitTest_Report'
367  ! Variables
368  INTEGER :: n_tests
369  INTEGER :: n_passed_tests
370  INTEGER :: n_failed_tests
371  CHARACTER(SL) :: message
372  CHARACTER(SL) :: attention
373  CHARACTER(SL) :: colour
374  ! Retrieve required properties
375  CALL get_property( &
376  unittest, &
377  n_tests = n_tests , &
378  n_passed_tests = n_passed_tests, &
379  n_failed_tests = n_failed_tests )
380 
381  ! Test fail attention-grabber
382  colour = green_colour
383  attention = ''
384  IF ( n_failed_tests /= 0 ) THEN
385  colour = red_colour
386  attention = ' <----<<< **WARNING**'
387  END IF
388 
389  ! Output results
390  WRITE( message, &
391  '(a,a,3x,"Passed ",i0," of ",i0," tests", &
392  &a,3x,"Failed ",i0," of ",i0," tests",a,a)') &
393  trim(colour), crlf, &
394  n_passed_tests, n_tests, &
395  crlf, &
396  n_failed_tests, n_tests, &
397  trim(attention), no_colour
398  CALL set_property( &
399  unittest, &
400  level = report_level, &
401  Procedure = procedure_name, &
402  message = message )
403  CALL display_message( unittest )
404 
405  END SUBROUTINE unittest_report
406 
407 
408 !------------------------------------------------------------------------------
409 !:sdoc+:
410 !
411 ! NAME:
412 ! UnitTest_Summary
413 !
414 ! PURPOSE:
415 ! UnitTest test suite report summary subroutine
416 !
417 ! This subroutine should be called ONCE, AFTER ALL tests are performed.
418 !
419 ! CALLING SEQUENCE:
420 ! CALL UnitTest_Summary( UnitTest )
421 !
422 ! OBJECT:
423 ! UnitTest: UnitTest object.
424 ! UNITS: N/A
425 ! TYPE: TYPE(UnitTest_type)
426 ! DIMENSION: Scalar
427 ! ATTRIBUTES: INTENT(IN)
428 !
429 !:sdoc-:
430 !------------------------------------------------------------------------------
431 
432  SUBROUTINE unittest_summary( UnitTest )
433  ! Arguments
434  TYPE(unittest_type), INTENT(IN OUT) :: unittest
435  ! Parameters
436  CHARACTER(*), PARAMETER :: procedure_name = 'UnitTest_Summary'
437  ! Variables
438  INTEGER :: n_alltests
439  INTEGER :: n_passed_alltests
440  INTEGER :: n_failed_alltests
441  CHARACTER(SL) :: message
442  CHARACTER(SL) :: attention
443  CHARACTER(SL) :: colour
444 
445  ! Retrieve required properties
446  CALL get_property( &
447  unittest, &
448  n_alltests = n_alltests , &
449  n_passed_alltests = n_passed_alltests, &
450  n_failed_alltests = n_failed_alltests )
451 
452  ! Test fail attention-grabber
453  colour = green_colour
454  attention = ''
455  IF ( n_failed_alltests /= 0 ) THEN
456  colour = red_colour
457  attention = ' <----<<< **WARNING**'
458  END IF
459 
460  ! Output results
461  WRITE( message, &
462  '(a,a,1x,"Passed ",i0," of ",i0," total tests",&
463  &a,1x,"Failed ",i0," of ",i0," total tests",a,a)') &
464  trim(colour), crlf, &
465  n_passed_alltests, n_alltests, &
466  crlf, &
467  n_failed_alltests, n_alltests, &
468  trim(attention), no_colour
469  CALL set_property( &
470  unittest, &
471  level = summary_level, &
472  Procedure = procedure_name, &
473  message = message )
474  CALL display_message( unittest )
475  END SUBROUTINE unittest_summary
476 
477 
478 !------------------------------------------------------------------------------
479 !:sdoc+:
480 !
481 ! NAME:
482 ! UnitTest_n_Passed
483 !
484 ! PURPOSE:
485 ! Utility function to return the number of tests passed.
486 !
487 ! CALLING SEQUENCE:
488 ! n = UnitTest_n_Passed( UnitTest )
489 !
490 ! OBJECT:
491 ! UnitTest: UnitTest object.
492 ! UNITS: N/A
493 ! TYPE: TYPE(UnitTest_type)
494 ! DIMENSION: Scalar
495 ! ATTRIBUTES: INTENT(IN)
496 !
497 ! FUNCTION RESULT:
498 ! n: The number of unit tests that have currently passed.
499 ! UNITS: N/A
500 ! TYPE: INTEGER
501 ! DIMENSION: Scalar
502 !
503 !:sdoc-:
504 !------------------------------------------------------------------------------
505 
506  PURE FUNCTION unittest_n_passed( UnitTest ) RESULT( n )
507  TYPE(unittest_type), INTENT(IN) :: unittest
508  INTEGER :: n
509  CALL get_property( unittest, n_passed_tests = n )
510  END FUNCTION unittest_n_passed
511 
512 
513 !------------------------------------------------------------------------------
514 !:sdoc+:
515 !
516 ! NAME:
517 ! UnitTest_n_Failed
518 !
519 ! PURPOSE:
520 ! Utility function to return the number of tests failed.
521 !
522 ! CALLING SEQUENCE:
523 ! n = UnitTest_n_Failed( UnitTest )
524 !
525 ! OBJECT:
526 ! UnitTest: UnitTest object.
527 ! UNITS: N/A
528 ! TYPE: TYPE(UnitTest_type)
529 ! DIMENSION: Scalar
530 ! ATTRIBUTES: INTENT(IN)
531 !
532 ! FUNCTION RESULT:
533 ! n: The number of unit tests that have currently failed.
534 ! UNITS: N/A
535 ! TYPE: INTEGER
536 ! DIMENSION: Scalar
537 !
538 !:sdoc-:
539 !------------------------------------------------------------------------------
540 
541  PURE FUNCTION unittest_n_failed( UnitTest ) RESULT( n )
542  TYPE(unittest_type), INTENT(IN) :: unittest
543  INTEGER :: n
544  CALL get_property( unittest, n_failed_tests = n )
545  END FUNCTION unittest_n_failed
546 
547 
548 !------------------------------------------------------------------------------
549 !:sdoc+:
550 !
551 ! NAME:
552 ! UnitTest_Passed
553 !
554 ! PURPOSE:
555 ! Function to inform if the last test performed passed.
556 !
557 ! CALLING SEQUENCE:
558 ! result = UnitTest_Passed( UnitTest )
559 !
560 ! OBJECT:
561 ! UnitTest: UnitTest object.
562 ! UNITS: N/A
563 ! TYPE: TYPE(UnitTest_type)
564 ! DIMENSION: Scalar
565 ! ATTRIBUTES: INTENT(IN)
566 !
567 ! FUNCTION RESULT:
568 ! result: Logical to indicate if the last test performed passed.
569 ! If == .TRUE., the last test passed,
570 ! == .FALSE., the last test failed.
571 ! UNITS: N/A
572 ! TYPE: LOGICAL
573 ! DIMENSION: Scalar
574 !
575 !:sdoc-:
576 !------------------------------------------------------------------------------
577 
578  PURE FUNCTION unittest_passed( UnitTest ) RESULT( Passed )
579  TYPE(unittest_type), INTENT(IN) :: unittest
580  LOGICAL :: passed
581  CALL get_property( unittest, test_result = passed )
582  END FUNCTION unittest_passed
583 
584 
585 !------------------------------------------------------------------------------
586 !:sdoc+:
587 !
588 ! NAME:
589 ! UnitTest_Failed
590 !
591 ! PURPOSE:
592 ! Function to inform if the last test performed failed.
593 !
594 ! Syntactic sugar procedure.
595 !
596 ! CALLING SEQUENCE:
597 ! result = UnitTest_Failed( UnitTest )
598 !
599 ! OBJECT:
600 ! UnitTest: UnitTest object.
601 ! UNITS: N/A
602 ! TYPE: TYPE(UnitTest_type)
603 ! DIMENSION: Scalar
604 ! ATTRIBUTES: INTENT(IN)
605 !
606 ! FUNCTION RESULT:
607 ! result: Logical to indicate if the last test performed failed.
608 ! If == .TRUE., the last test failed,
609 ! == .FALSE., the last test passed.
610 ! UNITS: N/A
611 ! TYPE: LOGICAL
612 ! DIMENSION: Scalar
613 !
614 !:sdoc-:
615 !------------------------------------------------------------------------------
616 
617  PURE FUNCTION unittest_failed( UnitTest ) RESULT( Failed )
618  TYPE(unittest_type), INTENT(IN) :: unittest
619  LOGICAL :: failed
620  failed = .NOT. unittest_passed( unittest )
621  END FUNCTION unittest_failed
622 
623 
624 !------------------------------------------------------------------------------
625 !:sdoc+:
626 !
627 ! NAME:
628 ! UnitTest_Assert
629 !
630 ! PURPOSE:
631 ! Subroutine to assert its test argument
632 !
633 ! CALLING SEQUENCE:
634 ! CALL UnitTest_Assert(UnitTest, Test)
635 !
636 ! OBJECTS:
637 ! UnitTest: UnitTest object.
638 ! UNITS: N/A
639 ! TYPE: TYPE(UnitTest_type)
640 ! DIMENSION: Scalar
641 ! ATTRIBUTES: INTENT(IN OUT)
642 !
643 ! INPUTS:
644 ! Test: The logical expression to assert.
645 ! UNITS: N/A
646 ! TYPE: LOGICAL
647 ! DIMENSION: Scalar
648 ! ATTRIBUTES: INTENT(IN)
649 !
650 !:sdoc-:
651 !------------------------------------------------------------------------------
652 
653  SUBROUTINE unittest_assert(UnitTest, Test)
654  ! Arguments
655  TYPE(unittest_type), INTENT(IN OUT) :: unittest
656  LOGICAL, INTENT(IN) :: test
657  ! Parameters
658  CHARACTER(*), PARAMETER :: procedure_name = 'UnitTest_Assert'
659  ! Variables
660  LOGICAL :: verbose
661  CHARACTER(SL) :: message
662 
663  ! Setup
664  message = ''
665  ! ...Locally modify properties for this test
666  CALL get_property( &
667  unittest, &
668  verbose = verbose )
669  verbose = verbose .OR. (.NOT. test) ! Always output test failure
670 
671  ! Assert the test
672  IF ( test ) THEN
673  CALL test_passed( unittest )
674  ELSE
675  CALL test_failed( unittest )
676  END IF
677 
678  ! Output message
679  CALL test_info_string( unittest, message )
680  CALL set_property( &
681  unittest, &
682  level = test_level, &
683  Procedure = procedure_name, &
684  message = message )
685  IF ( verbose ) CALL display_message( unittest )
686 
687  END SUBROUTINE unittest_assert
688 
689 
690 !------------------------------------------------------------------------------
691 !:sdoc+:
692 !
693 ! NAME:
694 ! UnitTest_IsEqual
695 !
696 ! PURPOSE:
697 ! Subroutine to assert that two arguments are equal.
698 !
699 ! CALLING SEQUENCE:
700 ! CALL UnitTest_IsEqual( UnitTest, Expected, Actual )
701 !
702 ! OBJECTS:
703 ! UnitTest: UnitTest object.
704 ! UNITS: N/A
705 ! TYPE: TYPE(UnitTest_type)
706 ! DIMENSION: Scalar
707 ! ATTRIBUTES: INTENT(IN OUT)
708 !
709 ! INPUTS:
710 ! Expected: The expected value of the variable being tested.
711 ! UNITS: N/A
712 ! TYPE: INTEGER(Byte) , or
713 ! INTEGER(Short) , or
714 ! INTEGER(Long) , or
715 ! REAL(Single) , or
716 ! REAL(Double) , or
717 ! COMPLEX(Single), or
718 ! COMPLEX(Double), or
719 ! CHARACTER(*)
720 ! DIMENSION: Scalar, or
721 ! Rank-1, or
722 ! Rank-2
723 ! ATTRIBUTES: INTENT(IN)
724 !
725 ! Actual: The actual value of the variable being tested.
726 ! UNITS: N/A
727 ! TYPE: Same as Expected input
728 ! DIMENSION: Same as Expected input
729 ! ATTRIBUTES: INTENT(IN)
730 !
731 !:sdoc-:
732 !------------------------------------------------------------------------------
733 
734  SUBROUTINE intbyte_isequal_scalar( UnitTest, Expected, Actual )
735  ! Arguments
736  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
737  INTEGER(Byte), INTENT(IN) :: Expected, Actual
738  ! Parameters
739  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Byte)]'
740  ! Variables
741  LOGICAL :: Test
742  LOGICAL :: Verbose
743  CHARACTER(SL) :: Message
744 
745  ! Setup
746  ! ...Assign the test
747  test = (expected == actual)
748  ! ...Locally modify properties for this test
749  CALL get_property( &
750  unittest, &
751  verbose = verbose )
752  verbose = verbose .OR. (.NOT. test) ! Always output test failure
753 
754 
755  ! Assert the test
756  IF ( test ) THEN
757  CALL test_passed( unittest )
758  ELSE
759  CALL test_failed( unittest )
760  END IF
761 
762  ! Output message
763  WRITE( message,'("Expected ",i0," and got ",i0)') expected, actual
764  CALL set_property( &
765  unittest, &
766  level = test_level, &
767  Procedure = procedure_name, &
768  message = message )
769  IF ( verbose ) CALL display_message( unittest )
770  END SUBROUTINE intbyte_isequal_scalar
771 
772 
773  SUBROUTINE intbyte_isequal_rank1( UnitTest, Expected, Actual )
774  ! Arguments
775  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
776  INTEGER(Byte), INTENT(IN) :: Expected(:), Actual(:)
777  ! Parameters
778  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Byte)]'
779  ! Variables
780  INTEGER :: i, isize
781  CHARACTER(SL) :: Message
782 
783  ! Check array sizes
784  isize = SIZE(expected)
785  IF ( SIZE(actual) /= isize ) THEN
786  CALL test_failed( unittest )
787  WRITE( message, &
788  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0)') &
789  isize, SIZE(actual)
790  CALL set_property( &
791  unittest, &
792  level = test_level, &
793  Procedure = procedure_name, &
794  message = message )
795  CALL display_message( unittest )
796  RETURN
797  ENDIF
798 
799  ! Loop over elements
800  DO i = 1, isize
801  CALL intbyte_isequal_scalar( unittest, expected(i), actual(i) )
802  END DO
803  END SUBROUTINE intbyte_isequal_rank1
804 
805 
806  SUBROUTINE intbyte_isequal_rank2( UnitTest, Expected, Actual )
807  ! Arguments
808  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
809  INTEGER(Byte), INTENT(IN) :: Expected(:,:), Actual(:,:)
810  ! Parameters
811  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Byte)]'
812  ! Variables
813  INTEGER :: i, j, isize, jsize
814  CHARACTER(SL) :: Message
815 
816  ! Check array sizes
817  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
818  IF ( SIZE(actual,dim=1) /= isize .OR. &
819  SIZE(actual,dim=2) /= jsize ) THEN
820  CALL test_failed( unittest )
821  WRITE( message, &
822  '("Array sizes are diffferent -- Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,")")') &
823  isize, jsize, &
824  SIZE(actual,dim=1), SIZE(actual,dim=2)
825  CALL set_property( &
826  unittest, &
827  level = test_level, &
828  Procedure = procedure_name, &
829  message = message )
830  CALL display_message( unittest )
831  RETURN
832  ENDIF
833 
834  ! Loop over elements
835  DO j = 1, jsize
836  DO i = 1, isize
837  CALL intbyte_isequal_scalar( unittest, expected(i,j), actual(i,j) )
838  END DO
839  END DO
840  END SUBROUTINE intbyte_isequal_rank2
841 
842 
843  SUBROUTINE intshort_isequal_scalar( UnitTest, Expected, Actual )
844  ! Arguments
845  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
846  INTEGER(Short), INTENT(IN) :: Expected, Actual
847  ! Parameters
848  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Short)]'
849  ! Variables
850  LOGICAL :: Test
851  LOGICAL :: Verbose
852  CHARACTER(SL) :: Message
853 
854  ! Setup
855  ! ...Assign the test
856  test = (expected == actual)
857  ! ...Locally modify properties for this test
858  CALL get_property( &
859  unittest, &
860  verbose = verbose )
861  verbose = verbose .OR. (.NOT. test) ! Always output test failure
862 
863 
864  ! Assert the test
865  IF ( test ) THEN
866  CALL test_passed( unittest )
867  ELSE
868  CALL test_failed( unittest )
869  END IF
870 
871  ! Output message
872  WRITE( message,'("Expected ",i0," and got ",i0)') expected, actual
873  CALL set_property( &
874  unittest, &
875  level = test_level, &
876  Procedure = procedure_name, &
877  message = message )
878  IF ( verbose ) CALL display_message( unittest )
879  END SUBROUTINE intshort_isequal_scalar
880 
881 
882  SUBROUTINE intshort_isequal_rank1( UnitTest, Expected, Actual )
883  ! Arguments
884  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
885  INTEGER(Short), INTENT(IN) :: Expected(:), Actual(:)
886  ! Parameters
887  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Short)]'
888  ! Variables
889  INTEGER :: i, isize
890  CHARACTER(SL) :: Message
891 
892  ! Check array sizes
893  isize = SIZE(expected)
894  IF ( SIZE(actual) /= isize ) THEN
895  CALL test_failed( unittest )
896  WRITE( message, &
897  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0)') &
898  isize, SIZE(actual)
899  CALL set_property( &
900  unittest, &
901  level = test_level, &
902  Procedure = procedure_name, &
903  message = message )
904  CALL display_message( unittest )
905  RETURN
906  ENDIF
907 
908  ! Loop over elements
909  DO i = 1, isize
910  CALL intshort_isequal_scalar( unittest, expected(i), actual(i) )
911  END DO
912  END SUBROUTINE intshort_isequal_rank1
913 
914 
915  SUBROUTINE intshort_isequal_rank2( UnitTest, Expected, Actual )
916  ! Arguments
917  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
918  INTEGER(Short), INTENT(IN) :: Expected(:,:), Actual(:,:)
919  ! Parameters
920  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Short)]'
921  ! Variables
922  INTEGER :: i, j, isize, jsize
923  CHARACTER(SL) :: Message
924 
925  ! Check array sizes
926  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
927  IF ( SIZE(actual,dim=1) /= isize .OR. &
928  SIZE(actual,dim=2) /= jsize ) THEN
929  CALL test_failed( unittest )
930  WRITE( message, &
931  '("Array sizes are diffferent -- Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,")")') &
932  isize, jsize, &
933  SIZE(actual,dim=1), SIZE(actual,dim=2)
934  CALL set_property( &
935  unittest, &
936  level = test_level, &
937  Procedure = procedure_name, &
938  message = message )
939  CALL display_message( unittest )
940  RETURN
941  ENDIF
942 
943  ! Loop over elements
944  DO j = 1, jsize
945  DO i = 1, isize
946  CALL intshort_isequal_scalar( unittest, expected(i,j), actual(i,j) )
947  END DO
948  END DO
949  END SUBROUTINE intshort_isequal_rank2
950 
951 
952  SUBROUTINE intlong_isequal_scalar( UnitTest, Expected, Actual )
953  ! Arguments
954  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
955  INTEGER(Long), INTENT(IN) :: Expected, Actual
956  ! Parameters
957  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Long)]'
958  ! Variables
959  LOGICAL :: Test
960  LOGICAL :: Verbose
961  CHARACTER(SL) :: Message
962 
963  ! Setup
964  ! ...Assign the test
965  test = (expected == actual)
966  ! ...Locally modify properties for this test
967  CALL get_property( &
968  unittest, &
969  verbose = verbose )
970  verbose = verbose .OR. (.NOT. test) ! Always output test failure
971 
972 
973  ! Assert the test
974  IF ( test ) THEN
975  CALL test_passed( unittest )
976  ELSE
977  CALL test_failed( unittest )
978  END IF
979 
980  ! Output message
981  WRITE( message,'("Expected ",i0," and got ",i0)') expected, actual
982  CALL set_property( &
983  unittest, &
984  level = test_level, &
985  Procedure = procedure_name, &
986  message = message )
987  IF ( verbose ) CALL display_message( unittest )
988  END SUBROUTINE intlong_isequal_scalar
989 
990 
991  SUBROUTINE intlong_isequal_rank1( UnitTest, Expected, Actual )
992  ! Arguments
993  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
994  INTEGER(Long), INTENT(IN) :: Expected(:), Actual(:)
995  ! Parameters
996  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Long)]'
997  ! Variables
998  INTEGER :: i, isize
999  CHARACTER(SL) :: Message
1000 
1001  ! Check array sizes
1002  isize = SIZE(expected)
1003  IF ( SIZE(actual) /= isize ) THEN
1004  CALL test_failed( unittest )
1005  WRITE( message, &
1006  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0)') &
1007  isize, SIZE(actual)
1008  CALL set_property( &
1009  unittest, &
1010  level = test_level, &
1011  Procedure = procedure_name, &
1012  message = message )
1013  CALL display_message( unittest )
1014  RETURN
1015  ENDIF
1016 
1017  ! Loop over elements
1018  DO i = 1, isize
1019  CALL intlong_isequal_scalar( unittest, expected(i), actual(i) )
1020  END DO
1021  END SUBROUTINE intlong_isequal_rank1
1022 
1023 
1024  SUBROUTINE intlong_isequal_rank2( UnitTest, Expected, Actual )
1025  ! Arguments
1026  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1027  INTEGER(Long), INTENT(IN) :: Expected(:,:), Actual(:,:)
1028  ! Parameters
1029  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[INTEGER(Long)]'
1030  ! Variables
1031  INTEGER :: i, j, isize, jsize
1032  CHARACTER(SL) :: Message
1033 
1034  ! Check array sizes
1035  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
1036  IF ( SIZE(actual,dim=1) /= isize .OR. &
1037  SIZE(actual,dim=2) /= jsize ) THEN
1038  CALL test_failed( unittest )
1039  WRITE( message, &
1040  '("Array sizes are diffferent -- Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,")")') &
1041  isize, jsize, &
1042  SIZE(actual,dim=1), SIZE(actual,dim=2)
1043  CALL set_property( &
1044  unittest, &
1045  level = test_level, &
1046  Procedure = procedure_name, &
1047  message = message )
1048  CALL display_message( unittest )
1049  RETURN
1050  ENDIF
1051 
1052  ! Loop over elements
1053  DO j = 1, jsize
1054  DO i = 1, isize
1055  CALL intlong_isequal_scalar( unittest, expected(i,j), actual(i,j) )
1056  END DO
1057  END DO
1058  END SUBROUTINE intlong_isequal_rank2
1059 
1060 
1061  SUBROUTINE realsp_isequal_scalar( UnitTest, Expected, Actual )
1062  ! Arguments
1063  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1064  REAL(Single), INTENT(IN) :: Expected, Actual
1065  ! Parameters
1066  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[REAL(Single)]'
1067  ! Variables
1068  LOGICAL :: Test
1069  LOGICAL :: Verbose
1070  CHARACTER(SL) :: Message
1071 
1072  ! Setup
1073  ! ...Assign the test
1074  test = (expected .equalto. actual)
1075  ! ...Locally modify properties for this test
1076  CALL get_property( &
1077  unittest, &
1078  verbose = verbose )
1079  verbose = verbose .OR. (.NOT. test) ! Always output test failure
1080 
1081 
1082  ! Assert the test
1083  IF ( test ) THEN
1084  CALL test_passed( unittest )
1085  ELSE
1086  CALL test_failed( unittest )
1087  END IF
1088 
1089  ! Output message
1090  WRITE( message, &
1091  '(a,7x,"Expected: ",'//rfmt//',a,&
1092  &7x,"And got: ",'//rfmt//')') &
1093  crlf, expected, crlf, actual
1094  CALL set_property( &
1095  unittest, &
1096  level = test_level, &
1097  Procedure = procedure_name, &
1098  message = message )
1099  IF ( verbose ) CALL display_message( unittest )
1100  END SUBROUTINE realsp_isequal_scalar
1101 
1102 
1103  SUBROUTINE realsp_isequal_rank1( UnitTest, Expected, Actual )
1104  ! Arguments
1105  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1106  REAL(Single), INTENT(IN) :: Expected(:), Actual(:)
1107  ! Parameters
1108  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[REAL(Single)]'
1109  ! Variables
1110  INTEGER :: i, isize
1111  CHARACTER(SL) :: Message
1112 
1113  ! Check array sizes
1114  isize = SIZE(expected)
1115  IF ( SIZE(actual) /= isize ) THEN
1116  CALL test_failed( unittest )
1117  WRITE( message, &
1118  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0)') &
1119  isize, SIZE(actual)
1120  CALL set_property( &
1121  unittest, &
1122  level = test_level, &
1123  Procedure = procedure_name, &
1124  message = message )
1125  CALL display_message( unittest )
1126  RETURN
1127  ENDIF
1128 
1129  ! Loop over elements
1130  DO i = 1, isize
1131  CALL realsp_isequal_scalar( unittest, expected(i), actual(i) )
1132  END DO
1133  END SUBROUTINE realsp_isequal_rank1
1134 
1135 
1136  SUBROUTINE realsp_isequal_rank2( UnitTest, Expected, Actual )
1137  ! Arguments
1138  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1139  REAL(Single), INTENT(IN) :: Expected(:,:), Actual(:,:)
1140  ! Parameters
1141  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[REAL(Single)]'
1142  ! Variables
1143  INTEGER :: i, j, isize, jsize
1144  CHARACTER(SL) :: Message
1145 
1146  ! Check array sizes
1147  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
1148  IF ( SIZE(actual,dim=1) /= isize .OR. &
1149  SIZE(actual,dim=2) /= jsize ) THEN
1150  CALL test_failed( unittest )
1151  WRITE( message, &
1152  '("Array sizes are diffferent -- Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,")")') &
1153  isize, jsize, &
1154  SIZE(actual,dim=1), SIZE(actual,dim=2)
1155  CALL set_property( &
1156  unittest, &
1157  level = test_level, &
1158  Procedure = procedure_name, &
1159  message = message )
1160  CALL display_message( unittest )
1161  RETURN
1162  ENDIF
1163 
1164  ! Loop over elements
1165  DO j = 1, jsize
1166  DO i = 1, isize
1167  CALL realsp_isequal_scalar( unittest, expected(i,j), actual(i,j) )
1168  END DO
1169  END DO
1170  END SUBROUTINE realsp_isequal_rank2
1171 
1172 
1173  SUBROUTINE realdp_isequal_scalar( UnitTest, Expected, Actual )
1174  ! Arguments
1175  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1176  REAL(Double), INTENT(IN) :: Expected, Actual
1177  ! Parameters
1178  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[REAL(Double)]'
1179  ! Variables
1180  LOGICAL :: Test
1181  LOGICAL :: Verbose
1182  CHARACTER(SL) :: Message
1183 
1184  ! Setup
1185  ! ...Assign the test
1186  test = (expected .equalto. actual)
1187  ! ...Locally modify properties for this test
1188  CALL get_property( &
1189  unittest, &
1190  verbose = verbose )
1191  verbose = verbose .OR. (.NOT. test) ! Always output test failure
1192 
1193 
1194  ! Assert the test
1195  IF ( test ) THEN
1196  CALL test_passed( unittest )
1197  ELSE
1198  CALL test_failed( unittest )
1199  END IF
1200 
1201  ! Output message
1202  WRITE( message, &
1203  '(a,7x,"Expected: ",'//rfmt//',a,&
1204  &7x,"And got: ",'//rfmt//')') &
1205  crlf, expected, crlf, actual
1206  CALL set_property( &
1207  unittest, &
1208  level = test_level, &
1209  Procedure = procedure_name, &
1210  message = message )
1211  IF ( verbose ) CALL display_message( unittest )
1212  END SUBROUTINE realdp_isequal_scalar
1213 
1214 
1215  SUBROUTINE realdp_isequal_rank1( UnitTest, Expected, Actual )
1216  ! Arguments
1217  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1218  REAL(Double), INTENT(IN) :: Expected(:), Actual(:)
1219  ! Parameters
1220  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[REAL(Double)]'
1221  ! Variables
1222  INTEGER :: i, isize
1223  CHARACTER(SL) :: Message
1224 
1225  ! Check array sizes
1226  isize = SIZE(expected)
1227  IF ( SIZE(actual) /= isize ) THEN
1228  CALL test_failed( unittest )
1229  WRITE( message, &
1230  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0)') &
1231  isize, SIZE(actual)
1232  CALL set_property( &
1233  unittest, &
1234  level = test_level, &
1235  Procedure = procedure_name, &
1236  message = message )
1237  CALL display_message( unittest )
1238  RETURN
1239  ENDIF
1240 
1241  ! Loop over elements
1242  DO i = 1, isize
1243  CALL realdp_isequal_scalar( unittest, expected(i), actual(i) )
1244  END DO
1245  END SUBROUTINE realdp_isequal_rank1
1246 
1247 
1248  SUBROUTINE realdp_isequal_rank2( UnitTest, Expected, Actual )
1249  ! Arguments
1250  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1251  REAL(Double), INTENT(IN) :: Expected(:,:), Actual(:,:)
1252  ! Parameters
1253  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[REAL(Double)]'
1254  ! Variables
1255  INTEGER :: i, j, isize, jsize
1256  CHARACTER(SL) :: Message
1257 
1258  ! Check array sizes
1259  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
1260  IF ( SIZE(actual,dim=1) /= isize .OR. &
1261  SIZE(actual,dim=2) /= jsize ) THEN
1262  CALL test_failed( unittest )
1263  WRITE( message, &
1264  '("Array sizes are diffferent -- Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,")")') &
1265  isize, jsize, &
1266  SIZE(actual,dim=1), SIZE(actual,dim=2)
1267  CALL set_property( &
1268  unittest, &
1269  level = test_level, &
1270  Procedure = procedure_name, &
1271  message = message )
1272  CALL display_message( unittest )
1273  RETURN
1274  ENDIF
1275 
1276  ! Loop over elements
1277  DO j = 1, jsize
1278  DO i = 1, isize
1279  CALL realdp_isequal_scalar( unittest, expected(i,j), actual(i,j) )
1280  END DO
1281  END DO
1282  END SUBROUTINE realdp_isequal_rank2
1283 
1284 
1285  SUBROUTINE complexsp_isequal_scalar( UnitTest, Expected, Actual )
1286  ! Arguments
1287  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1288  COMPLEX(Single), INTENT(IN) :: Expected, Actual
1289  ! Parameters
1290  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[COMPLEX(Single)]'
1291  ! Variables
1292  LOGICAL :: Test
1293  LOGICAL :: Verbose
1294  CHARACTER(SL) :: Message
1295 
1296  ! Setup
1297  ! ...Assign the test
1298  test = (expected .equalto. actual)
1299  ! ...Locally modify properties for this test
1300  CALL get_property( &
1301  unittest, &
1302  verbose = verbose )
1303  verbose = verbose .OR. (.NOT. test) ! Always output test failure
1304 
1305 
1306  ! Assert the test
1307  IF ( test ) THEN
1308  CALL test_passed( unittest )
1309  ELSE
1310  CALL test_failed( unittest )
1311  END IF
1312 
1313  ! Output message
1314  WRITE( message, &
1315  '(a,7x,"Expected: ",'//zfmt//',a,&
1316  &7x,"And got: ",'//zfmt//')') &
1317  crlf, expected, crlf, actual
1318  CALL set_property( &
1319  unittest, &
1320  level = test_level, &
1321  Procedure = procedure_name, &
1322  message = message )
1323  IF ( verbose ) CALL display_message( unittest )
1324  END SUBROUTINE complexsp_isequal_scalar
1325 
1326 
1327  SUBROUTINE complexsp_isequal_rank1( UnitTest, Expected, Actual )
1328  ! Arguments
1329  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1330  COMPLEX(Single), INTENT(IN) :: Expected(:), Actual(:)
1331  ! Parameters
1332  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[COMPLEX(Single)]'
1333  ! Variables
1334  INTEGER :: i, isize
1335  CHARACTER(SL) :: Message
1336 
1337  ! Check array sizes
1338  isize = SIZE(expected)
1339  IF ( SIZE(actual) /= isize ) THEN
1340  CALL test_failed( unittest )
1341  WRITE( message, &
1342  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0)') &
1343  isize, SIZE(actual)
1344  CALL set_property( &
1345  unittest, &
1346  level = test_level, &
1347  Procedure = procedure_name, &
1348  message = message )
1349  CALL display_message( unittest )
1350  RETURN
1351  ENDIF
1352 
1353  ! Loop over elements
1354  DO i = 1, isize
1355  CALL complexsp_isequal_scalar( unittest, expected(i), actual(i) )
1356  END DO
1357  END SUBROUTINE complexsp_isequal_rank1
1358 
1359 
1360  SUBROUTINE complexsp_isequal_rank2( UnitTest, Expected, Actual )
1361  ! Arguments
1362  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1363  COMPLEX(Single), INTENT(IN) :: Expected(:,:), Actual(:,:)
1364  ! Parameters
1365  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[COMPLEX(Single)]'
1366  ! Variables
1367  INTEGER :: i, j, isize, jsize
1368  CHARACTER(SL) :: Message
1369 
1370  ! Check array sizes
1371  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
1372  IF ( SIZE(actual,dim=1) /= isize .OR. &
1373  SIZE(actual,dim=2) /= jsize ) THEN
1374  CALL test_failed( unittest )
1375  WRITE( message, &
1376  '("Array sizes are diffferent -- Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,")")') &
1377  isize, jsize, &
1378  SIZE(actual,dim=1), SIZE(actual,dim=2)
1379  CALL set_property( &
1380  unittest, &
1381  level = test_level, &
1382  Procedure = procedure_name, &
1383  message = message )
1384  CALL display_message( unittest )
1385  RETURN
1386  ENDIF
1387 
1388  ! Loop over elements
1389  DO j = 1, jsize
1390  DO i = 1, isize
1391  CALL complexsp_isequal_scalar( unittest, expected(i,j), actual(i,j) )
1392  END DO
1393  END DO
1394  END SUBROUTINE complexsp_isequal_rank2
1395 
1396 
1397  SUBROUTINE complexdp_isequal_scalar( UnitTest, Expected, Actual )
1398  ! Arguments
1399  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1400  COMPLEX(Double), INTENT(IN) :: Expected, Actual
1401  ! Parameters
1402  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[COMPLEX(Double)]'
1403  ! Variables
1404  LOGICAL :: Test
1405  LOGICAL :: Verbose
1406  CHARACTER(SL) :: Message
1407 
1408  ! Setup
1409  ! ...Assign the test
1410  test = (expected .equalto. actual)
1411  ! ...Locally modify properties for this test
1412  CALL get_property( &
1413  unittest, &
1414  verbose = verbose )
1415  verbose = verbose .OR. (.NOT. test) ! Always output test failure
1416 
1417 
1418  ! Assert the test
1419  IF ( test ) THEN
1420  CALL test_passed( unittest )
1421  ELSE
1422  CALL test_failed( unittest )
1423  END IF
1424 
1425  ! Output message
1426  WRITE( message, &
1427  '(a,7x,"Expected: ",'//zfmt//',a,&
1428  &7x,"And got: ",'//zfmt//')') &
1429  crlf, expected, crlf, actual
1430  CALL set_property( &
1431  unittest, &
1432  level = test_level, &
1433  Procedure = procedure_name, &
1434  message = message )
1435  IF ( verbose ) CALL display_message( unittest )
1436  END SUBROUTINE complexdp_isequal_scalar
1437 
1438 
1439  SUBROUTINE complexdp_isequal_rank1( UnitTest, Expected, Actual )
1440  ! Arguments
1441  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1442  COMPLEX(Double), INTENT(IN) :: Expected(:), Actual(:)
1443  ! Parameters
1444  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[COMPLEX(Double)]'
1445  ! Variables
1446  INTEGER :: i, isize
1447  CHARACTER(SL) :: Message
1448 
1449  ! Check array sizes
1450  isize = SIZE(expected)
1451  IF ( SIZE(actual) /= isize ) THEN
1452  CALL test_failed( unittest )
1453  WRITE( message, &
1454  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0)') &
1455  isize, SIZE(actual)
1456  CALL set_property( &
1457  unittest, &
1458  level = test_level, &
1459  Procedure = procedure_name, &
1460  message = message )
1461  CALL display_message( unittest )
1462  RETURN
1463  ENDIF
1464 
1465  ! Loop over elements
1466  DO i = 1, isize
1467  CALL complexdp_isequal_scalar( unittest, expected(i), actual(i) )
1468  END DO
1469  END SUBROUTINE complexdp_isequal_rank1
1470 
1471 
1472  SUBROUTINE complexdp_isequal_rank2( UnitTest, Expected, Actual )
1473  ! Arguments
1474  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1475  COMPLEX(Double), INTENT(IN) :: Expected(:,:), Actual(:,:)
1476  ! Parameters
1477  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[COMPLEX(Double)]'
1478  ! Variables
1479  INTEGER :: i, j, isize, jsize
1480  CHARACTER(SL) :: Message
1481 
1482  ! Check array sizes
1483  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
1484  IF ( SIZE(actual,dim=1) /= isize .OR. &
1485  SIZE(actual,dim=2) /= jsize ) THEN
1486  CALL test_failed( unittest )
1487  WRITE( message, &
1488  '("Array sizes are diffferent -- Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,")")') &
1489  isize, jsize, &
1490  SIZE(actual,dim=1), SIZE(actual,dim=2)
1491  CALL set_property( &
1492  unittest, &
1493  level = test_level, &
1494  Procedure = procedure_name, &
1495  message = message )
1496  CALL display_message( unittest )
1497  RETURN
1498  ENDIF
1499 
1500  ! Loop over elements
1501  DO j = 1, jsize
1502  DO i = 1, isize
1503  CALL complexdp_isequal_scalar( unittest, expected(i,j), actual(i,j) )
1504  END DO
1505  END DO
1506  END SUBROUTINE complexdp_isequal_rank2
1507 
1508 
1509  SUBROUTINE char_isequal_scalar( UnitTest, Expected, Actual )
1510  ! Arguments
1511  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1512  CHARACTER(*), INTENT(IN) :: Expected, Actual
1513  ! Parameters
1514  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[CHARACTER]'
1515  ! Variables
1516  LOGICAL :: Test
1517  LOGICAL :: Verbose
1518  CHARACTER(SL) :: Message
1519 
1520  ! Setup
1521  ! ...Assign the test
1522  test = (expected == actual)
1523  ! ...Locally modify properties for this test
1524  CALL get_property( &
1525  unittest, &
1526  verbose = verbose )
1527  verbose = verbose .OR. (.NOT. test) ! Always output test failure
1528 
1529 
1530  ! Assert the test
1531  IF ( test ) THEN
1532  CALL test_passed( unittest )
1533  ELSE
1534  CALL test_failed( unittest )
1535  END IF
1536 
1537  ! Output message
1538  WRITE( message,'("Expected >",a,"< and got >",a,"<")') expected, actual
1539  CALL set_property( &
1540  unittest, &
1541  level = test_level, &
1542  Procedure = procedure_name, &
1543  message = message )
1544  IF ( verbose ) CALL display_message( unittest )
1545  END SUBROUTINE char_isequal_scalar
1546 
1547 
1548  SUBROUTINE char_isequal_rank1( UnitTest, Expected, Actual )
1549  ! Arguments
1550  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1551  CHARACTER(*), INTENT(IN) :: Expected(:), Actual(:)
1552  ! Parameters
1553  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[CHARACTER]'
1554  ! Variables
1555  INTEGER :: i, isize
1556  CHARACTER(SL) :: Message
1557 
1558  ! Check array sizes
1559  isize = SIZE(expected)
1560  IF ( SIZE(actual) /= isize ) THEN
1561  CALL test_failed( unittest )
1562  WRITE( message, &
1563  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0)') &
1564  isize, SIZE(actual)
1565  CALL set_property( &
1566  unittest, &
1567  level = test_level, &
1568  Procedure = procedure_name, &
1569  message = message )
1570  CALL display_message( unittest )
1571  RETURN
1572  ENDIF
1573 
1574  ! Loop over elements
1575  DO i = 1, isize
1576  CALL char_isequal_scalar( unittest, expected(i), actual(i) )
1577  END DO
1578  END SUBROUTINE char_isequal_rank1
1579 
1580 
1581  SUBROUTINE char_isequal_rank2( UnitTest, Expected, Actual )
1582  ! Arguments
1583  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1584  CHARACTER(*), INTENT(IN) :: Expected(:,:), Actual(:,:)
1585  ! Parameters
1586  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqual[CHARACTER]'
1587  ! Variables
1588  INTEGER :: i, j, isize, jsize
1589  CHARACTER(SL) :: Message
1590 
1591  ! Check array sizes
1592  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
1593  IF ( SIZE(actual,dim=1) /= isize .OR. &
1594  SIZE(actual,dim=2) /= jsize ) THEN
1595  CALL test_failed( unittest )
1596  WRITE( message, &
1597  '("Array sizes are diffferent -- Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,")")') &
1598  isize, jsize, &
1599  SIZE(actual,dim=1), SIZE(actual,dim=2)
1600  CALL set_property( &
1601  unittest, &
1602  level = test_level, &
1603  Procedure = procedure_name, &
1604  message = message )
1605  CALL display_message( unittest )
1606  RETURN
1607  ENDIF
1608 
1609  ! Loop over elements
1610  DO j = 1, jsize
1611  DO i = 1, isize
1612  CALL char_isequal_scalar( unittest, expected(i,j), actual(i,j) )
1613  END DO
1614  END DO
1615  END SUBROUTINE char_isequal_rank2
1616 
1617 
1618 !------------------------------------------------------------------------------
1619 !:sdoc+:
1620 !
1621 ! NAME:
1622 ! UnitTest_IsEqualWithin
1623 !
1624 ! PURPOSE:
1625 ! Subroutine to assert that two floating point arguments are equal to
1626 ! within the specified tolerance.
1627 !
1628 ! CALLING SEQUENCE:
1629 ! CALL UnitTest_IsEqualWithin( UnitTest , &
1630 ! Expected , &
1631 ! Actual , &
1632 ! Tolerance, &
1633 ! Epsilon_Scale = Epsilon_Scale )
1634 !
1635 ! OBJECTS:
1636 ! UnitTest: UnitTest object.
1637 ! UNITS: N/A
1638 ! TYPE: TYPE(UnitTest_type)
1639 ! DIMENSION: Scalar
1640 ! ATTRIBUTES: INTENT(IN OUT)
1641 !
1642 ! INPUTS:
1643 ! Expected: The expected value of the variable being tested.
1644 ! UNITS: N/A
1645 ! TYPE: REAL(Single) , or
1646 ! REAL(Double) , or
1647 ! COMPLEX(Single), or
1648 ! COMPLEX(Double)
1649 ! DIMENSION: Scalar, or
1650 ! Rank-1, or
1651 ! Rank-2
1652 ! ATTRIBUTES: INTENT(IN)
1653 !
1654 ! Actual: The actual value of the variable being tested.
1655 ! UNITS: N/A
1656 ! TYPE: Same as Expected input
1657 ! DIMENSION: Same as Expected input
1658 ! ATTRIBUTES: INTENT(IN)
1659 !
1660 ! Tolerance: The tolerance to within which the Expected and Actual
1661 ! values must agree. If negative, the value of
1662 ! EPSILON(Expected)
1663 ! is used.
1664 ! This argument is ignored if the EPSILON_SCALE optional
1665 ! argument is specified
1666 ! UNITS: N/A
1667 ! TYPE: Same as Expected input
1668 ! DIMENSION: Same as Expected input
1669 ! ATTRIBUTES: INTENT(IN)
1670 !
1671 ! OPTIONAL INPUTS:
1672 ! Epsilon_Scale: Set this logical flag to compute and use the tolerance
1673 ! value:
1674 ! EPSILON(Expected) * Scale_Factor
1675 ! where the scaling factor is the exponent value of the
1676 ! input argument Expected.
1677 ! UNITS: N/A
1678 ! TYPE: LOGICAL.
1679 ! DIMENSION: Scalar
1680 ! ATTRIBUTES: INTENT(IN)
1681 !
1682 !:sdoc-:
1683 !------------------------------------------------------------------------------
1684 
1685  SUBROUTINE realsp_isequalwithin_scalar( &
1686  UnitTest , &
1687  Expected , &
1688  Actual , &
1689  Tolerance , &
1690  Epsilon_Scale )
1691  ! Arguments
1692  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1693  REAL(Single), INTENT(IN) :: Expected, Actual, Tolerance
1694  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
1695  ! Parameters
1696  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[REAL(Single)]'
1697  ! Variables
1698  REAL(Single) :: tol
1699  LOGICAL :: Test
1700  LOGICAL :: Verbose
1701  CHARACTER(SL) :: Message
1702 
1703  ! Setup
1704  ! ...Default tolerance
1705  tol = tolerance
1706  ! ...Check optional arguments
1707  IF ( PRESENT(epsilon_scale) ) THEN
1708  IF ( epsilon_scale ) tol = epsilon(expected) * get_multiplier( expected )
1709  END IF
1710  ! ...Assign the test
1711  test = (abs(expected-actual) < tol)
1712  ! ...Locally modify properties for this test
1713  CALL get_property( &
1714  unittest, &
1715  verbose = verbose )
1716  verbose = verbose .OR. (.NOT. test) ! Always output test failure
1717 
1718 
1719  ! Assert the test
1720  IF ( test ) THEN
1721  CALL test_passed( unittest )
1722  ELSE
1723  CALL test_failed( unittest )
1724  END IF
1725 
1726  ! Output message
1727  WRITE( message, &
1728  '(a,7x,"Expected: ",'//rfmt//',a,&
1729  &7x,"To within: ",'//rfmt//',a,&
1730  &7x,"And got: ",'//rfmt//',a,&
1731  &7x,"|Difference|: ",'//rfmt//')') &
1732  crlf, expected, crlf, tol, crlf, actual, crlf, abs(expected-actual)
1733  CALL set_property( &
1734  unittest, &
1735  level = test_level, &
1736  Procedure = procedure_name, &
1737  message = message )
1738  IF ( verbose ) CALL display_message( unittest )
1739  END SUBROUTINE realsp_isequalwithin_scalar
1740 
1741 
1742  SUBROUTINE realsp_isequalwithin_rank1( &
1743  UnitTest , &
1744  Expected , &
1745  Actual , &
1746  Tolerance , &
1747  Epsilon_Scale )
1748  ! Arguments
1749  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1750  REAL(Single), INTENT(IN) :: Expected(:), Actual(:), Tolerance(:)
1751  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
1752  ! Parameters
1753  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[REAL(Single)]'
1754  ! Variables
1755  INTEGER :: i, isize
1756  CHARACTER(SL) :: Message
1757 
1758  ! Check array sizes
1759  isize = SIZE(expected)
1760  IF ( SIZE(actual) /= isize .OR. &
1761  SIZE(tolerance) /= isize ) THEN
1762  CALL test_failed( unittest )
1763  WRITE( message, &
1764  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0,"; Tolerance:",i0)') &
1765  isize, SIZE(actual), SIZE(tolerance)
1766  CALL set_property( &
1767  unittest, &
1768  level = test_level, &
1769  Procedure = procedure_name, &
1770  message = message )
1771  CALL display_message( unittest )
1772  RETURN
1773  ENDIF
1774 
1775  ! Loop over elements
1776  DO i = 1, isize
1778  unittest , &
1779  expected(i) , &
1780  actual(i) , &
1781  tolerance(i), &
1782  epsilon_scale = epsilon_scale )
1783  END DO
1784  END SUBROUTINE realsp_isequalwithin_rank1
1785 
1786 
1787  SUBROUTINE realsp_isequalwithin_rank2( &
1788  UnitTest , &
1789  Expected , &
1790  Actual , &
1791  Tolerance , &
1792  Epsilon_Scale )
1793  ! Arguments
1794  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1795  REAL(Single), INTENT(IN) :: Expected(:,:), Actual(:,:), Tolerance(:,:)
1796  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
1797  ! Parameters
1798  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[REAL(Single)]'
1799  ! Variables
1800  INTEGER :: i, j, isize, jsize
1801  CHARACTER(SL) :: Message
1802 
1803  ! Check array sizes
1804  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
1805  IF ( SIZE(actual,dim=1) /= isize .OR. &
1806  SIZE(actual,dim=2) /= jsize .OR. &
1807  SIZE(tolerance,dim=1) /= isize .OR. &
1808  SIZE(tolerance,dim=2) /= jsize ) THEN
1809  CALL test_failed( unittest )
1810  WRITE( message, &
1811  '("Array sizes are diffferent -- ",&
1812  &"Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,"); Tolerance:(",i0,",",i0,")")') &
1813  isize, jsize, &
1814  SIZE(actual,dim=1), SIZE(actual,dim=2), &
1815  SIZE(tolerance,dim=1), SIZE(tolerance,dim=2)
1816  CALL set_property( &
1817  unittest, &
1818  level = test_level, &
1819  Procedure = procedure_name, &
1820  message = message )
1821  CALL display_message( unittest )
1822  RETURN
1823  ENDIF
1824 
1825  ! Loop over elements
1826  DO j = 1, jsize
1827  DO i = 1, isize
1829  unittest , &
1830  expected(i,j) , &
1831  actual(i,j) , &
1832  tolerance(i,j), &
1833  epsilon_scale = epsilon_scale )
1834  END DO
1835  END DO
1836  END SUBROUTINE realsp_isequalwithin_rank2
1837 
1838 
1839  SUBROUTINE realdp_isequalwithin_scalar( &
1840  UnitTest , &
1841  Expected , &
1842  Actual , &
1843  Tolerance , &
1844  Epsilon_Scale )
1845  ! Arguments
1846  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1847  REAL(Double), INTENT(IN) :: Expected, Actual, Tolerance
1848  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
1849  ! Parameters
1850  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[REAL(Double)]'
1851  ! Variables
1852  REAL(Double) :: tol
1853  LOGICAL :: Test
1854  LOGICAL :: Verbose
1855  CHARACTER(SL) :: Message
1856 
1857  ! Setup
1858  ! ...Default tolerance
1859  tol = tolerance
1860  ! ...Check optional arguments
1861  IF ( PRESENT(epsilon_scale) ) THEN
1862  IF ( epsilon_scale ) tol = epsilon(expected) * get_multiplier( expected )
1863  END IF
1864  ! ...Assign the test
1865  test = (abs(expected-actual) < tol)
1866  ! ...Locally modify properties for this test
1867  CALL get_property( &
1868  unittest, &
1869  verbose = verbose )
1870  verbose = verbose .OR. (.NOT. test) ! Always output test failure
1871 
1872 
1873  ! Assert the test
1874  IF ( test ) THEN
1875  CALL test_passed( unittest )
1876  ELSE
1877  CALL test_failed( unittest )
1878  END IF
1879 
1880  ! Output message
1881  WRITE( message, &
1882  '(a,7x,"Expected: ",'//rfmt//',a,&
1883  &7x,"To within: ",'//rfmt//',a,&
1884  &7x,"And got: ",'//rfmt//',a,&
1885  &7x,"|Difference|: ",'//rfmt//')') &
1886  crlf, expected, crlf, tol, crlf, actual, crlf, abs(expected-actual)
1887  CALL set_property( &
1888  unittest, &
1889  level = test_level, &
1890  Procedure = procedure_name, &
1891  message = message )
1892  IF ( verbose ) CALL display_message( unittest )
1893  END SUBROUTINE realdp_isequalwithin_scalar
1894 
1895 
1896  SUBROUTINE realdp_isequalwithin_rank1( &
1897  UnitTest , &
1898  Expected , &
1899  Actual , &
1900  Tolerance , &
1901  Epsilon_Scale )
1902  ! Arguments
1903  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1904  REAL(Double), INTENT(IN) :: Expected(:), Actual(:), Tolerance(:)
1905  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
1906  ! Parameters
1907  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[REAL(Double)]'
1908  ! Variables
1909  INTEGER :: i, isize
1910  CHARACTER(SL) :: Message
1911 
1912  ! Check array sizes
1913  isize = SIZE(expected)
1914  IF ( SIZE(actual) /= isize .OR. &
1915  SIZE(tolerance) /= isize ) THEN
1916  CALL test_failed( unittest )
1917  WRITE( message, &
1918  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0,"; Tolerance:",i0)') &
1919  isize, SIZE(actual), SIZE(tolerance)
1920  CALL set_property( &
1921  unittest, &
1922  level = test_level, &
1923  Procedure = procedure_name, &
1924  message = message )
1925  CALL display_message( unittest )
1926  RETURN
1927  ENDIF
1928 
1929  ! Loop over elements
1930  DO i = 1, isize
1932  unittest , &
1933  expected(i) , &
1934  actual(i) , &
1935  tolerance(i), &
1936  epsilon_scale = epsilon_scale )
1937  END DO
1938  END SUBROUTINE realdp_isequalwithin_rank1
1939 
1940 
1941  SUBROUTINE realdp_isequalwithin_rank2( &
1942  UnitTest , &
1943  Expected , &
1944  Actual , &
1945  Tolerance , &
1946  Epsilon_Scale )
1947  ! Arguments
1948  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
1949  REAL(Double), INTENT(IN) :: Expected(:,:), Actual(:,:), Tolerance(:,:)
1950  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
1951  ! Parameters
1952  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[REAL(Double)]'
1953  ! Variables
1954  INTEGER :: i, j, isize, jsize
1955  CHARACTER(SL) :: Message
1956 
1957  ! Check array sizes
1958  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
1959  IF ( SIZE(actual,dim=1) /= isize .OR. &
1960  SIZE(actual,dim=2) /= jsize .OR. &
1961  SIZE(tolerance,dim=1) /= isize .OR. &
1962  SIZE(tolerance,dim=2) /= jsize ) THEN
1963  CALL test_failed( unittest )
1964  WRITE( message, &
1965  '("Array sizes are diffferent -- ",&
1966  &"Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,"); Tolerance:(",i0,",",i0,")")') &
1967  isize, jsize, &
1968  SIZE(actual,dim=1), SIZE(actual,dim=2), &
1969  SIZE(tolerance,dim=1), SIZE(tolerance,dim=2)
1970  CALL set_property( &
1971  unittest, &
1972  level = test_level, &
1973  Procedure = procedure_name, &
1974  message = message )
1975  CALL display_message( unittest )
1976  RETURN
1977  ENDIF
1978 
1979  ! Loop over elements
1980  DO j = 1, jsize
1981  DO i = 1, isize
1983  unittest , &
1984  expected(i,j) , &
1985  actual(i,j) , &
1986  tolerance(i,j), &
1987  epsilon_scale = epsilon_scale )
1988  END DO
1989  END DO
1990  END SUBROUTINE realdp_isequalwithin_rank2
1991 
1992 
1993  SUBROUTINE complexsp_isequalwithin_scalar( &
1994  UnitTest , &
1995  Expected , &
1996  Actual , &
1997  Tolerance , &
1998  Epsilon_Scale )
1999  ! Arguments
2000  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2001  COMPLEX(Single), INTENT(IN) :: Expected, Actual, Tolerance
2002  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
2003  ! Parameters
2004  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[COMPLEX(Single)]'
2005  ! Variables
2006  REAL(Single) :: tolr, toli
2007  REAL(Single) :: zr, zi
2008  REAL(Single) :: dzr, dzi
2009  LOGICAL :: Test
2010  LOGICAL :: Verbose
2011  CHARACTER(SL) :: Message
2012 
2013  ! Setup
2014  ! ...Split expected into real and imag
2015  zr = REAL(Expected,Single)
2016  zi = aimag(expected)
2017  ! ...Default tolerance
2018  tolr = REAL(Tolerance,Single)
2019  toli = aimag(tolerance)
2020  ! ...Check optional arguments
2021  IF ( PRESENT(epsilon_scale) ) THEN
2022  IF ( epsilon_scale ) THEN
2023  tolr = epsilon(zr) * get_multiplier(zr)
2024  toli = epsilon(zi) * get_multiplier(zi)
2025  END IF
2026  END IF
2027  ! ...Assign the test
2028  dzr = abs(zr - REAL(Actual,Single))
2029  dzi = abs(zi - aimag(actual))
2030  test = (dzr < tolr) .AND. (dzi < toli)
2031  ! ...Locally modify properties for this test
2032  CALL get_property( &
2033  unittest, &
2034  verbose = verbose )
2035  verbose = verbose .OR. (.NOT. test) ! Always output test failure
2036 
2037 
2038  ! Assert the test
2039  IF ( test ) THEN
2040  CALL test_passed( unittest )
2041  ELSE
2042  CALL test_failed( unittest )
2043  END IF
2044 
2045  ! Output message
2046  WRITE( message, &
2047  '(a,7x,"Expected: ",'//zfmt//',a,&
2048  &7x,"To within: ",'//zfmt//',a,&
2049  &7x,"And got: ",'//zfmt//',a,&
2050  &7x,"|Difference|: ",'//zfmt//')') &
2051  crlf, expected, crlf, cmplx(tolr,toli,single), crlf, actual, crlf, dzr, dzi
2052  CALL set_property( &
2053  unittest, &
2054  level = test_level, &
2055  Procedure = procedure_name, &
2056  message = message )
2057  IF ( verbose ) CALL display_message( unittest )
2058  END SUBROUTINE complexsp_isequalwithin_scalar
2059 
2060 
2061  SUBROUTINE complexsp_isequalwithin_rank1( &
2062  UnitTest , &
2063  Expected , &
2064  Actual , &
2065  Tolerance , &
2066  Epsilon_Scale )
2067  ! Arguments
2068  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2069  COMPLEX(Single), INTENT(IN) :: Expected(:), Actual(:), Tolerance(:)
2070  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
2071  ! Parameters
2072  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[COMPLEX(Single)]'
2073  ! Variables
2074  INTEGER :: i, isize
2075  CHARACTER(SL) :: Message
2076 
2077  ! Check array sizes
2078  isize = SIZE(expected)
2079  IF ( SIZE(actual) /= isize .OR. &
2080  SIZE(tolerance) /= isize ) THEN
2081  CALL test_failed( unittest )
2082  WRITE( message, &
2083  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0,"; Tolerance:",i0)') &
2084  isize, SIZE(actual), SIZE(tolerance)
2085  CALL set_property( &
2086  unittest, &
2087  level = test_level, &
2088  Procedure = procedure_name, &
2089  message = message )
2090  CALL display_message( unittest )
2091  RETURN
2092  ENDIF
2093 
2094  ! Loop over elements
2095  DO i = 1, isize
2097  unittest , &
2098  expected(i) , &
2099  actual(i) , &
2100  tolerance(i), &
2101  epsilon_scale = epsilon_scale )
2102  END DO
2103  END SUBROUTINE complexsp_isequalwithin_rank1
2104 
2105 
2106  SUBROUTINE complexsp_isequalwithin_rank2( &
2107  UnitTest , &
2108  Expected , &
2109  Actual , &
2110  Tolerance , &
2111  Epsilon_Scale )
2112  ! Arguments
2113  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2114  COMPLEX(Single), INTENT(IN) :: Expected(:,:), Actual(:,:), Tolerance(:,:)
2115  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
2116  ! Parameters
2117  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[COMPLEX(Single)]'
2118  ! Variables
2119  INTEGER :: i, j, isize, jsize
2120  CHARACTER(SL) :: Message
2121 
2122  ! Check array sizes
2123  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
2124  IF ( SIZE(actual,dim=1) /= isize .OR. &
2125  SIZE(actual,dim=2) /= jsize .OR. &
2126  SIZE(tolerance,dim=1) /= isize .OR. &
2127  SIZE(tolerance,dim=2) /= jsize ) THEN
2128  CALL test_failed( unittest )
2129  WRITE( message, &
2130  '("Array sizes are diffferent -- ",&
2131  &"Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,"); Tolerance:(",i0,",",i0,")")') &
2132  isize, jsize, &
2133  SIZE(actual,dim=1), SIZE(actual,dim=2), &
2134  SIZE(tolerance,dim=1), SIZE(tolerance,dim=2)
2135  CALL set_property( &
2136  unittest, &
2137  level = test_level, &
2138  Procedure = procedure_name, &
2139  message = message )
2140  CALL display_message( unittest )
2141  RETURN
2142  ENDIF
2143 
2144  ! Loop over elements
2145  DO j = 1, jsize
2146  DO i = 1, isize
2148  unittest , &
2149  expected(i,j) , &
2150  actual(i,j) , &
2151  tolerance(i,j), &
2152  epsilon_scale = epsilon_scale )
2153  END DO
2154  END DO
2155  END SUBROUTINE complexsp_isequalwithin_rank2
2156 
2157 
2158  SUBROUTINE complexdp_isequalwithin_scalar( &
2159  UnitTest , &
2160  Expected , &
2161  Actual , &
2162  Tolerance , &
2163  Epsilon_Scale )
2164  ! Arguments
2165  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2166  COMPLEX(Double), INTENT(IN) :: Expected, Actual, Tolerance
2167  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
2168  ! Parameters
2169  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[COMPLEX(Double)]'
2170  ! Variables
2171  REAL(Double) :: tolr, toli
2172  REAL(Double) :: zr, zi
2173  REAL(Double) :: dzr, dzi
2174  LOGICAL :: Test
2175  LOGICAL :: Verbose
2176  CHARACTER(SL) :: Message
2177 
2178  ! Setup
2179  ! ...Split expected into real and imag
2180  zr = REAL(Expected,Double)
2181  zi = aimag(expected)
2182  ! ...Default tolerance
2183  tolr = REAL(Tolerance,Double)
2184  toli = aimag(tolerance)
2185  ! ...Check optional arguments
2186  IF ( PRESENT(epsilon_scale) ) THEN
2187  IF ( epsilon_scale ) THEN
2188  tolr = epsilon(zr) * get_multiplier(zr)
2189  toli = epsilon(zi) * get_multiplier(zi)
2190  END IF
2191  END IF
2192  ! ...Assign the test
2193  dzr = abs(zr - REAL(Actual,Double))
2194  dzi = abs(zi - aimag(actual))
2195  test = (dzr < tolr) .AND. (dzi < toli)
2196  ! ...Locally modify properties for this test
2197  CALL get_property( &
2198  unittest, &
2199  verbose = verbose )
2200  verbose = verbose .OR. (.NOT. test) ! Always output test failure
2201 
2202 
2203  ! Assert the test
2204  IF ( test ) THEN
2205  CALL test_passed( unittest )
2206  ELSE
2207  CALL test_failed( unittest )
2208  END IF
2209 
2210  ! Output message
2211  WRITE( message, &
2212  '(a,7x,"Expected: ",'//zfmt//',a,&
2213  &7x,"To within: ",'//zfmt//',a,&
2214  &7x,"And got: ",'//zfmt//',a,&
2215  &7x,"|Difference|: ",'//zfmt//')') &
2216  crlf, expected, crlf, cmplx(tolr,toli,double), crlf, actual, crlf, dzr, dzi
2217  CALL set_property( &
2218  unittest, &
2219  level = test_level, &
2220  Procedure = procedure_name, &
2221  message = message )
2222  IF ( verbose ) CALL display_message( unittest )
2223  END SUBROUTINE complexdp_isequalwithin_scalar
2224 
2225 
2226  SUBROUTINE complexdp_isequalwithin_rank1( &
2227  UnitTest , &
2228  Expected , &
2229  Actual , &
2230  Tolerance , &
2231  Epsilon_Scale )
2232  ! Arguments
2233  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2234  COMPLEX(Double), INTENT(IN) :: Expected(:), Actual(:), Tolerance(:)
2235  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
2236  ! Parameters
2237  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[COMPLEX(Double)]'
2238  ! Variables
2239  INTEGER :: i, isize
2240  CHARACTER(SL) :: Message
2241 
2242  ! Check array sizes
2243  isize = SIZE(expected)
2244  IF ( SIZE(actual) /= isize .OR. &
2245  SIZE(tolerance) /= isize ) THEN
2246  CALL test_failed( unittest )
2247  WRITE( message, &
2248  '("Array sizes are diffferent -- Expected:",i0,"; Actual:",i0,"; Tolerance:",i0)') &
2249  isize, SIZE(actual), SIZE(tolerance)
2250  CALL set_property( &
2251  unittest, &
2252  level = test_level, &
2253  Procedure = procedure_name, &
2254  message = message )
2255  CALL display_message( unittest )
2256  RETURN
2257  ENDIF
2258 
2259  ! Loop over elements
2260  DO i = 1, isize
2262  unittest , &
2263  expected(i) , &
2264  actual(i) , &
2265  tolerance(i), &
2266  epsilon_scale = epsilon_scale )
2267  END DO
2268  END SUBROUTINE complexdp_isequalwithin_rank1
2269 
2270 
2271  SUBROUTINE complexdp_isequalwithin_rank2( &
2272  UnitTest , &
2273  Expected , &
2274  Actual , &
2275  Tolerance , &
2276  Epsilon_Scale )
2277  ! Arguments
2278  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2279  COMPLEX(Double), INTENT(IN) :: Expected(:,:), Actual(:,:), Tolerance(:,:)
2280  LOGICAL, OPTIONAL, INTENT(IN) :: Epsilon_Scale
2281  ! Parameters
2282  CHARACTER(*), PARAMETER :: PROCEDURE_NAME = 'UnitTest_IsEqualWithin[COMPLEX(Double)]'
2283  ! Variables
2284  INTEGER :: i, j, isize, jsize
2285  CHARACTER(SL) :: Message
2286 
2287  ! Check array sizes
2288  isize = SIZE(expected,dim=1); jsize = SIZE(expected,dim=2)
2289  IF ( SIZE(actual,dim=1) /= isize .OR. &
2290  SIZE(actual,dim=2) /= jsize .OR. &
2291  SIZE(tolerance,dim=1) /= isize .OR. &
2292  SIZE(tolerance,dim=2) /= jsize ) THEN
2293  CALL test_failed( unittest )
2294  WRITE( message, &
2295  '("Array sizes are diffferent -- ",&
2296  &"Expected:(",i0,",",i0,"); Actual:(",i0,",",i0,"); Tolerance:(",i0,",",i0,")")') &
2297  isize, jsize, &
2298  SIZE(actual,dim=1), SIZE(actual,dim=2), &
2299  SIZE(tolerance,dim=1), SIZE(tolerance,dim=2)
2300  CALL set_property( &
2301  unittest, &
2302  level = test_level, &
2303  Procedure = procedure_name, &
2304  message = message )
2305  CALL display_message( unittest )
2306  RETURN
2307  ENDIF
2308 
2309  ! Loop over elements
2310  DO j = 1, jsize
2311  DO i = 1, isize
2313  unittest , &
2314  expected(i,j) , &
2315  actual(i,j) , &
2316  tolerance(i,j), &
2317  epsilon_scale = epsilon_scale )
2318  END DO
2319  END DO
2320  END SUBROUTINE complexdp_isequalwithin_rank2
2321 
2322 
2323 !--------------------------------------------------------------------------------
2324 !:sdoc+:
2325 !
2326 ! NAME:
2327 ! UnitTest_DefineVersion
2328 !
2329 ! PURPOSE:
2330 ! Subroutine to return the module version information.
2331 !
2332 ! CALLING SEQUENCE:
2333 ! CALL UnitTest_DefineVersion( Id )
2334 !
2335 ! OUTPUTS:
2336 ! Id: Character string containing the version Id information
2337 ! for the module.
2338 ! UNITS: N/A
2339 ! TYPE: CHARACTER(*)
2340 ! DIMENSION: Scalar
2341 ! ATTRIBUTES: INTENT(OUT)
2342 !
2343 !:sdoc-:
2344 !--------------------------------------------------------------------------------
2345 
2346  SUBROUTINE unittest_defineversion( Id )
2347  CHARACTER(*), INTENT(OUT) :: id
2348  id = module_version_id
2349  END SUBROUTINE unittest_defineversion
2350 
2351 
2352 !################################################################################
2353 !################################################################################
2354 !## ##
2355 !## ## PRIVATE MODULE ROUTINES ## ##
2356 !## ##
2357 !################################################################################
2358 !################################################################################
2359 
2360 !===================
2361 ! METHOD PROCEDURES
2362 !===================
2363 
2364 !------------------------------------------------------------------------------
2365 !
2366 ! NAME:
2367 ! Set_Property
2368 !
2369 ! PURPOSE:
2370 ! Private subroutine to set the properties of a UnitTest object.
2371 !
2372 ! All WRITE access to the UnitTest object properties should be
2373 ! done using this subroutine.
2374 !
2375 ! CALLING SEQUENCE:
2376 ! CALL Set_Property( &
2377 ! UnitTest, &
2378 ! Verbose = Verbose , &
2379 ! Title = Title , &
2380 ! Caller = Caller , &
2381 ! Level = Level , &
2382 ! Procedure = Procedure , &
2383 ! Message = Message , &
2384 ! Test_Result = Test_Result , &
2385 ! n_Tests = n_Tests , &
2386 ! n_Passed_Tests = n_Passed_Tests , &
2387 ! n_Failed_Tests = n_Failed_Tests , &
2388 ! n_AllTests = n_AllTests , &
2389 ! n_Passed_AllTests = n_Passed_AllTests, &
2390 ! n_Failed_AllTests = n_Failed_AllTests )
2391 !
2392 ! OBJECT:
2393 ! UnitTest: UnitTest object.
2394 ! UNITS: N/A
2395 ! TYPE: TYPE(UnitTest_type)
2396 ! DIMENSION: Scalar
2397 ! ATTRIBUTES: INTENT(IN OUT)
2398 !
2399 ! OPTIONAL INPUTS:
2400 ! Verbose: Logical to control length of reporting output.
2401 ! If == .FALSE., Only failed tests are reported.
2402 ! == .TRUE., Both failed and passed tests are reported.
2403 ! UNITS: N/A
2404 ! TYPE: LOGICAL
2405 ! DIMENSION: Scalar
2406 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2407 !
2408 ! Title: Character string containing the title of the
2409 ! test to be performed.
2410 ! UNITS: N/A
2411 ! TYPE: CHARACTER(*)
2412 ! DIMENSION: Scalar
2413 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2414 !
2415 ! Caller: Character string containing the name of the
2416 ! calling subprogram.
2417 ! UNITS: N/A
2418 ! TYPE: CHARACTER(*)
2419 ! DIMENSION: Scalar
2420 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2421 !
2422 ! Level: Integer flag specifying the output message level.
2423 ! UNITS: N/A
2424 ! TYPE: INTEGER
2425 ! DIMENSION: Scalar
2426 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2427 !
2428 ! Procedure: The name of the UnitTest procedure.
2429 ! UNITS: N/A
2430 ! TYPE: CHARACTER(*)
2431 ! DIMENSION: Scalar
2432 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2433 !
2434 ! Message: Character string containing an informational
2435 ! message about the unit test performed.
2436 ! UNITS: N/A
2437 ! TYPE: CHARACTER(*)
2438 ! DIMENSION: Scalar
2439 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2440 !
2441 ! Test_Result: Logical to contain the result of unit tests
2442 ! performed
2443 ! If == .TRUE., Test passed.
2444 ! == .FALSE., Test failed.
2445 ! UNITS: N/A
2446 ! TYPE: LOGICAL
2447 ! DIMENSION: Scalar
2448 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2449 !
2450 ! n_Tests: The number of tests performed for the current
2451 ! unit test type, i.e. since the last call to
2452 ! UnitTest_Setup().
2453 ! UNITS: N/A
2454 ! TYPE: INTEGER
2455 ! DIMENSION: Scalar
2456 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2457 !
2458 ! n_Passed_Tests: The number of tests passed for the current
2459 ! unit test type, i.e. since the last call to
2460 ! UnitTest_Setup().
2461 ! UNITS: N/A
2462 ! TYPE: INTEGER
2463 ! DIMENSION: Scalar
2464 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2465 !
2466 ! n_Failed_Tests: The number of tests failed for the current
2467 ! unit test type, i.e. since the last call to
2468 ! UnitTest_Setup().
2469 ! UNITS: N/A
2470 ! TYPE: INTEGER
2471 ! DIMENSION: Scalar
2472 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2473 !
2474 ! n_AllTests: The total number of tests performed, i.e. since
2475 ! the last call to UnitTest_Init().
2476 ! UNITS: N/A
2477 ! TYPE: INTEGER
2478 ! DIMENSION: Scalar
2479 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2480 !
2481 ! n_Passed_AllTests: The total number of tests passed, i.e. since
2482 ! the last call to UnitTest_Init().
2483 ! UNITS: N/A
2484 ! TYPE: INTEGER
2485 ! DIMENSION: Scalar
2486 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2487 !
2488 ! n_Failed_AllTests: The total number of tests failed, i.e. since
2489 ! the last call to UnitTest_Init().
2490 ! UNITS: N/A
2491 ! TYPE: INTEGER
2492 ! DIMENSION: Scalar
2493 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2494 !
2495 !------------------------------------------------------------------------------
2496 
2497  PURE SUBROUTINE set_property( &
2498  UnitTest , & ! Object
2499  Verbose , & ! Optional input
2500  Title , & ! Optional input
2501  Caller , & ! Optional input
2502  Level , & ! Optional input
2503  Procedure , & ! Optional input
2504  Message , & ! Optional input
2505  Test_Result , & ! Optional input
2506  n_Tests , & ! Optional input
2507  n_Passed_Tests , & ! Optional input
2508  n_Failed_Tests , & ! Optional input
2509  n_AllTests , & ! Optional input
2510  n_Passed_AllTests, & ! Optional input
2511  n_Failed_AllTests ) ! Optional input
2512  ! Arguments
2513  TYPE(unittest_type) , INTENT(IN OUT) :: unittest
2514  LOGICAL , OPTIONAL, INTENT(IN) :: verbose
2515  CHARACTER(*), OPTIONAL, INTENT(IN) :: title
2516  CHARACTER(*), OPTIONAL, INTENT(IN) :: caller
2517  INTEGER , OPTIONAL, INTENT(IN) :: level
2518  CHARACTER(*), OPTIONAL, INTENT(IN) :: procedure
2519  CHARACTER(*), OPTIONAL, INTENT(IN) :: message
2520  LOGICAL , OPTIONAL, INTENT(IN) :: test_result
2521  INTEGER , OPTIONAL, INTENT(IN) :: n_tests
2522  INTEGER , OPTIONAL, INTENT(IN) :: n_passed_tests
2523  INTEGER , OPTIONAL, INTENT(IN) :: n_failed_tests
2524  INTEGER , OPTIONAL, INTENT(IN) :: n_alltests
2525  INTEGER , OPTIONAL, INTENT(IN) :: n_passed_alltests
2526  INTEGER , OPTIONAL, INTENT(IN) :: n_failed_alltests
2527  ! Set the object properties
2528  IF ( PRESENT(verbose ) ) unittest%Verbose = verbose
2529  IF ( PRESENT(title ) ) unittest%Title = title
2530  IF ( PRESENT(caller ) ) unittest%Caller = caller
2531  IF ( PRESENT(level ) ) unittest%Level = level
2532  IF ( PRESENT(Procedure ) ) unittest%Procedure = procedure
2533  IF ( PRESENT(message ) ) unittest%Message = message
2534  IF ( PRESENT(test_result ) ) unittest%Test_Result = test_result
2535  IF ( PRESENT(n_tests ) ) unittest%n_Tests = n_tests
2536  IF ( PRESENT(n_passed_tests ) ) unittest%n_Passed_Tests = n_passed_tests
2537  IF ( PRESENT(n_failed_tests ) ) unittest%n_Failed_Tests = n_failed_tests
2538  IF ( PRESENT(n_alltests ) ) unittest%n_AllTests = n_alltests
2539  IF ( PRESENT(n_passed_alltests) ) unittest%n_Passed_AllTests = n_passed_alltests
2540  IF ( PRESENT(n_failed_alltests) ) unittest%n_Failed_AllTests = n_failed_alltests
2541  END SUBROUTINE set_property
2542 
2543 
2544 !------------------------------------------------------------------------------
2545 !
2546 ! NAME:
2547 ! Get_Property
2548 !
2549 ! PURPOSE:
2550 ! Private subroutine to get the properties of a UnitTest object.
2551 !
2552 ! All READ access to the UnitTest object properties should be
2553 ! done using this subroutine.
2554 !
2555 ! CALLING SEQUENCE:
2556 ! CALL Get_Property( &
2557 ! UnitTest, &
2558 ! Verbose = Verbose , &
2559 ! Title = Title , &
2560 ! Caller = Caller , &
2561 ! Level = Level , &
2562 ! Procedure = Procedure , &
2563 ! Message = Message , &
2564 ! Test_Result = Test_Result , &
2565 ! n_Tests = n_Tests , &
2566 ! n_Passed_Tests = n_Passed_Tests , &
2567 ! n_Failed_Tests = n_Failed_Tests , &
2568 ! n_AllTests = n_AllTests , &
2569 ! n_Passed_AllTests = n_Passed_AllTests, &
2570 ! n_Failed_AllTests = n_Failed_AllTests )
2571 !
2572 ! OBJECT:
2573 ! UnitTest: UnitTest object.
2574 ! UNITS: N/A
2575 ! TYPE: TYPE(UnitTest_type)
2576 ! DIMENSION: Scalar
2577 ! ATTRIBUTES: INTENT(IN)
2578 !
2579 ! OPTIONAL OUTPUTS:
2580 ! Verbose: Logical to control length of reporting output.
2581 ! If == .FALSE., Only failed tests are reported.
2582 ! == .TRUE., Both failed and passed tests are reported.
2583 ! UNITS: N/A
2584 ! TYPE: LOGICAL
2585 ! DIMENSION: Scalar
2586 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2587 !
2588 ! Title: Character string containing the title of the
2589 ! test to be performed.
2590 ! UNITS: N/A
2591 ! TYPE: CHARACTER(*)
2592 ! DIMENSION: Scalar
2593 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2594 !
2595 ! Caller: Character string containing the name of the
2596 ! calling subprogram.
2597 ! UNITS: N/A
2598 ! TYPE: CHARACTER(*)
2599 ! DIMENSION: Scalar
2600 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2601 !
2602 ! Level: Integer flag specifying the output message level.
2603 ! UNITS: N/A
2604 ! TYPE: INTEGER
2605 ! DIMENSION: Scalar
2606 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2607 !
2608 ! Procedure: The name of the last UnitTest Procedure called.
2609 ! UNITS: N/A
2610 ! TYPE: CHARACTER(*)
2611 ! DIMENSION: Scalar
2612 ! ATTRIBUTES: INTENT(IN), OPTIONAL
2613 !
2614 ! Message: Character string containing an informational
2615 ! message about the last unit test performed.
2616 ! UNITS: N/A
2617 ! TYPE: CHARACTER(*)
2618 ! DIMENSION: Scalar
2619 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2620 !
2621 ! Test_Result: Logical containing the result of the last
2622 ! unit test performed
2623 ! If == .TRUE., Test passed.
2624 ! == .FALSE., Test failed.
2625 ! UNITS: N/A
2626 ! TYPE: LOGICAL
2627 ! DIMENSION: Scalar
2628 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2629 !
2630 ! n_Tests: The number of tests performed for the current
2631 ! unit test type, i.e. since the last call to
2632 ! UnitTest_Setup().
2633 ! UNITS: N/A
2634 ! TYPE: INTEGER
2635 ! DIMENSION: Scalar
2636 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2637 !
2638 ! n_Passed_Tests: The number of tests passed for the current
2639 ! unit test type, i.e. since the last call to
2640 ! UnitTest_Setup().
2641 ! UNITS: N/A
2642 ! TYPE: INTEGER
2643 ! DIMENSION: Scalar
2644 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2645 !
2646 ! n_Failed_Tests: The number of tests failed for the current
2647 ! unit test type, i.e. since the last call to
2648 ! UnitTest_Setup().
2649 ! UNITS: N/A
2650 ! TYPE: INTEGER
2651 ! DIMENSION: Scalar
2652 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2653 !
2654 ! n_AllTests: The total number of tests performed, i.e. since
2655 ! the last call to UnitTest_Init().
2656 ! UNITS: N/A
2657 ! TYPE: INTEGER
2658 ! DIMENSION: Scalar
2659 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2660 !
2661 ! n_Passed_AllTests: The total number of tests passed, i.e. since
2662 ! the last call to UnitTest_Init().
2663 ! UNITS: N/A
2664 ! TYPE: INTEGER
2665 ! DIMENSION: Scalar
2666 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2667 !
2668 ! n_Failed_AllTests: The total number of tests failed, i.e. since
2669 ! the last call to UnitTest_Init().
2670 ! UNITS: N/A
2671 ! TYPE: INTEGER
2672 ! DIMENSION: Scalar
2673 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
2674 !
2675 !------------------------------------------------------------------------------
2676 
2677  PURE SUBROUTINE get_property( &
2678  UnitTest , & ! Object
2679  Verbose , & ! Optional output
2680  Title , & ! Optional output
2681  Caller , & ! Optional output
2682  Level , & ! Optional output
2683  Procedure , & ! Optional output
2684  Message , & ! Optional output
2685  Test_Result , & ! Optional output
2686  n_Tests , & ! Optional output
2687  n_Passed_Tests , & ! Optional output
2688  n_Failed_Tests , & ! Optional output
2689  n_AllTests , & ! Optional output
2690  n_Passed_AllTests, & ! Optional output
2691  n_Failed_AllTests ) ! Optional output
2692  ! Arguments
2693  TYPE(unittest_type) , INTENT(IN) :: unittest
2694  LOGICAL , OPTIONAL, INTENT(OUT) :: verbose
2695  CHARACTER(*), OPTIONAL, INTENT(OUT) :: title
2696  CHARACTER(*), OPTIONAL, INTENT(OUT) :: caller
2697  INTEGER , OPTIONAL, INTENT(OUT) :: level
2698  CHARACTER(*), OPTIONAL, INTENT(OUT) :: procedure
2699  CHARACTER(*), OPTIONAL, INTENT(OUT) :: message
2700  LOGICAL , OPTIONAL, INTENT(OUT) :: test_result
2701  INTEGER , OPTIONAL, INTENT(OUT) :: n_tests
2702  INTEGER , OPTIONAL, INTENT(OUT) :: n_passed_tests
2703  INTEGER , OPTIONAL, INTENT(OUT) :: n_failed_tests
2704  INTEGER , OPTIONAL, INTENT(OUT) :: n_alltests
2705  INTEGER , OPTIONAL, INTENT(OUT) :: n_passed_alltests
2706  INTEGER , OPTIONAL, INTENT(OUT) :: n_failed_alltests
2707  ! Get the object properties
2708  IF ( PRESENT(verbose ) ) verbose = unittest%Verbose
2709  IF ( PRESENT(title ) ) title = unittest%Title
2710  IF ( PRESENT(caller ) ) caller = unittest%Caller
2711  IF ( PRESENT(level ) ) level = unittest%Level
2712  IF ( PRESENT(Procedure ) ) Procedure = unittest%Procedure
2713  IF ( PRESENT(message ) ) message = unittest%Message
2714  IF ( PRESENT(test_result ) ) test_result = unittest%Test_Result
2715  IF ( PRESENT(n_tests ) ) n_tests = unittest%n_Tests
2716  IF ( PRESENT(n_passed_tests ) ) n_passed_tests = unittest%n_Passed_Tests
2717  IF ( PRESENT(n_failed_tests ) ) n_failed_tests = unittest%n_Failed_Tests
2718  IF ( PRESENT(n_alltests ) ) n_alltests = unittest%n_AllTests
2719  IF ( PRESENT(n_passed_alltests) ) n_passed_alltests = unittest%n_Passed_AllTests
2720  IF ( PRESENT(n_failed_alltests) ) n_failed_alltests = unittest%n_Failed_AllTests
2721  END SUBROUTINE get_property
2722 
2723 
2724 !------------------------------------------------------------------------------
2725 !
2726 ! NAME:
2727 ! Test_Passed
2728 !
2729 ! PURPOSE:
2730 ! Subroutine to increment passed test counters.
2731 !
2732 ! CALLING SEQUENCE:
2733 ! CALL Test_Passed( UnitTest )
2734 !
2735 ! OBJECT:
2736 ! UnitTest: UnitTest object.
2737 ! UNITS: N/A
2738 ! TYPE: TYPE(UnitTest_type)
2739 ! DIMENSION: Scalar
2740 ! ATTRIBUTES: INTENT(IN OUT)
2741 !
2742 !------------------------------------------------------------------------------
2743 
2744  SUBROUTINE test_passed( UnitTest )
2745  ! Arguments
2746  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2747  ! Variables
2748  INTEGER :: n_Passed_Tests, n_Passed_AllTests
2749 
2750  ! Increment total test counters
2751  CALL test_increment( unittest )
2752 
2753  ! Increment the passed test counters
2754  ! ...Get 'em
2755  CALL get_property( &
2756  unittest, &
2757  n_passed_tests = n_passed_tests, &
2758  n_passed_alltests = n_passed_alltests )
2759  ! ...Increment
2760  n_passed_tests = n_passed_tests + 1
2761  n_passed_alltests = n_passed_alltests + 1
2762  ! ...Save 'em and set successful test result
2763  CALL set_property( &
2764  unittest, &
2765  test_result = .true., &
2766  n_passed_tests = n_passed_tests, &
2767  n_passed_alltests = n_passed_alltests )
2768  END SUBROUTINE test_passed
2769 
2770 
2771 !------------------------------------------------------------------------------
2772 !
2773 ! NAME:
2774 ! Test_Failed
2775 !
2776 ! PURPOSE:
2777 ! Subroutine to increment failed test counters.
2778 !
2779 ! CALLING SEQUENCE:
2780 ! CALL Test_Failed( UnitTest )
2781 !
2782 ! OBJECT:
2783 ! UnitTest: UnitTest object.
2784 ! UNITS: N/A
2785 ! TYPE: TYPE(UnitTest_type)
2786 ! DIMENSION: Scalar
2787 ! ATTRIBUTES: INTENT(IN OUT)
2788 !
2789 !------------------------------------------------------------------------------
2790 
2791  SUBROUTINE test_failed( UnitTest )
2792  ! Arguments
2793  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2794  ! Variables
2795  INTEGER :: n_Failed_Tests, n_Failed_AllTests
2796 
2797  ! Increment total test counters
2798  CALL test_increment( unittest )
2799 
2800  ! Increment the failed test counters
2801  ! ...Get 'em
2802  CALL get_property( &
2803  unittest, &
2804  n_failed_tests = n_failed_tests, &
2805  n_failed_alltests = n_failed_alltests )
2806  ! ...Increment
2807  n_failed_tests = n_failed_tests + 1
2808  n_failed_alltests = n_failed_alltests + 1
2809  ! ...Save 'em and set unsuccessful test result
2810  CALL set_property( &
2811  unittest, &
2812  test_result = .false., &
2813  n_failed_tests = n_failed_tests, &
2814  n_failed_alltests = n_failed_alltests )
2815  END SUBROUTINE test_failed
2816 
2817 
2818 !------------------------------------------------------------------------------
2819 !
2820 ! NAME:
2821 ! Test_Increment
2822 !
2823 ! PURPOSE:
2824 ! Subroutine to increment the test total counters.
2825 !
2826 ! CALLING SEQUENCE:
2827 ! CALL Test_Increment( UnitTest )
2828 !
2829 ! OBJECT:
2830 ! UnitTest: UnitTest object.
2831 ! UNITS: N/A
2832 ! TYPE: TYPE(UnitTest_type)
2833 ! DIMENSION: Scalar
2834 ! ATTRIBUTES: INTENT(IN OUT)
2835 !
2836 !------------------------------------------------------------------------------
2837 
2838  SUBROUTINE test_increment( UnitTest )
2839  TYPE(UnitTest_type), INTENT(IN OUT) :: UnitTest
2840  INTEGER :: n_Tests, n_AllTests
2841 
2842  CALL get_property( &
2843  unittest, &
2844  n_tests = n_tests, &
2845  n_alltests = n_alltests )
2846 
2847  n_tests = n_tests + 1
2848  n_alltests = n_alltests + 1
2849 
2850  CALL set_property( &
2851  unittest, &
2852  n_tests = n_tests, &
2853  n_alltests = n_alltests )
2854  END SUBROUTINE test_increment
2855 
2856 
2857 !------------------------------------------------------------------------------
2858 !
2859 ! NAME:
2860 ! Display_Message
2861 !
2862 ! PURPOSE:
2863 ! Subroutine to display the unit test messages to stdout.
2864 !
2865 ! CALLING SEQUENCE:
2866 ! CALL Display_Message( UnitTest )
2867 !
2868 ! OBJECT:
2869 ! UnitTest: UnitTest object.
2870 ! UNITS: N/A
2871 ! TYPE: TYPE(UnitTest_type)
2872 ! DIMENSION: Scalar
2873 ! ATTRIBUTES: INTENT(IN OUT)
2874 !
2875 !------------------------------------------------------------------------------
2876 
2877  SUBROUTINE display_message( UnitTest )
2878  TYPE(UnitTest_type), INTENT(IN) :: UnitTest
2879  ! Variables
2880  INTEGER :: Level
2881  CHARACTER(SL) :: Procedure
2882  CHARACTER(SL) :: Message
2883  CHARACTER(SL) :: Fmt
2884  CHARACTER(SL) :: Prefix
2885  CHARACTER(SL) :: Test_Info
2886  INTEGER :: n_Spaces
2887 
2888  CALL get_property( &
2889  unittest, &
2890  level = level, &
2891  Procedure = procedure, &
2892  message = message )
2893 
2894  ! Set output bits manually
2895  test_info = ''
2896  SELECT CASE(level)
2897  CASE(init_level)
2898  prefix = '/'
2899  n_spaces = 1
2900  CASE(setup_level)
2901  prefix = '/,3x,14("-"),/'
2902  n_spaces = 3
2903  CASE(test_level)
2904  prefix = ''
2905  n_spaces = 5
2906  CALL test_info_string( unittest, test_info )
2907  CASE(report_level)
2908  prefix = ''
2909  n_spaces = 3
2910  CASE(summary_level)
2911  prefix = '/,1x,16("="),/'
2912  n_spaces = 1
2913  CASE DEFAULT
2914  level = internal_fail_level
2915  prefix = '/,"INVALID MESSAGE LEVEL!!",/'
2916  n_spaces = 15
2917  END SELECT
2918 
2919  ! Write the message to stdout
2920  WRITE(fmt, '("(",a,i0,"x,""("",a,"") "",a,"": "",a,1x,a)")') trim(prefix), n_spaces
2921  WRITE( *,fmt=fmt ) trim(message_level(level)), trim(procedure), trim(test_info), trim(message)
2922 
2923  END SUBROUTINE display_message
2924 
2925 
2926 !------------------------------------------------------------------------------
2927 !
2928 ! NAME:
2929 ! Test_Info_String
2930 !
2931 ! PURPOSE:
2932 ! Subroutine to construct an info string for message output.
2933 !
2934 ! CALLING SEQUENCE:
2935 ! CALL Test_Info_String( UnitTest, info )
2936 !
2937 ! OBJECT:
2938 ! UnitTest: UnitTest object.
2939 ! UNITS: N/A
2940 ! TYPE: TYPE(UnitTest_type)
2941 ! DIMENSION: Scalar
2942 ! ATTRIBUTES: INTENT(IN)
2943 !
2944 ! OUTPUTS:
2945 ! info: Character string containing the test number and
2946 ! whether the test passed or failed.
2947 ! UNITS: N/A
2948 ! TYPE: CHARACTER(*)
2949 ! DIMENSION: Scalar
2950 ! ATTRIBUTES: INTENT(OUT)
2951 !
2952 !------------------------------------------------------------------------------
2953 
2954  SUBROUTINE test_info_string( UnitTest, info )
2955  TYPE(UnitTest_Type), INTENT(IN) :: UnitTest
2956  CHARACTER(*), INTENT(OUT) :: info
2957  INTEGER :: n_Tests
2958  CHARACTER(6) :: PassFail
2959  CALL get_property( unittest, n_tests = n_tests )
2960  IF ( unittest_passed( unittest ) ) THEN
2961  passfail = 'PASSED'
2962  ELSE
2963  passfail = 'FAILED'
2964  END IF
2965  WRITE( info,'("Test#",i0,1x,a,".")') n_tests, passfail
2966  END SUBROUTINE test_info_string
2967 
2968 
2969 !====================
2970 ! UTILITY PROCEDURES
2971 !====================
2972 
2973 !------------------------------------------------------------------------------
2974 !
2975 ! NAME:
2976 ! Get_Multiplier
2977 !
2978 ! PURPOSE:
2979 ! Elemental function to compute the exponent multiplier of an input
2980 ! for use in scaling tolerance values for floating point comparisons.
2981 !
2982 ! CALLING SEQUENCE:
2983 ! e = Get_Multiplier(x)
2984 !
2985 ! INPUTS:
2986 ! x: Number for which the exponent multiplier is required.
2987 ! UNITS: N/A
2988 ! TYPE: REAL(Single) , or
2989 ! REAL(Double)
2990 ! DIMENSION: Scalar or any rank
2991 ! ATTRIBUTES: INTENT(IN)
2992 !
2993 ! FUNCTION RESULT:
2994 ! e: Exponent multiplier to use in scaling tolerance values.
2995 ! UNITS: N/A
2996 ! TYPE: Same as input x.
2997 ! DIMENSION: Same as input x.
2998 !
2999 !------------------------------------------------------------------------------
3000 
3001  ELEMENTAL FUNCTION realsp_get_multiplier(x) RESULT(e)
3002  REAL(Single), INTENT(IN) :: x
3003  REAL(Single) :: e
3004  IF (x > 0.0_single) THEN
3005  e = 10.0_single**floor(log10(x))
3006  ELSE
3007  e = 1.0_single
3008  END IF
3009  END FUNCTION realsp_get_multiplier
3010 
3011  ELEMENTAL FUNCTION realdp_get_multiplier(x) RESULT(e)
3012  REAL(Double), INTENT(IN) :: x
3013  REAL(Double) :: e
3014  IF (x > 0.0_double) THEN
3015  e = 10.0_double**floor(log10(x))
3016  ELSE
3017  e = 1.0_double
3018  END IF
3019  END FUNCTION realdp_get_multiplier
3020 
3021 END MODULE unittest_define
subroutine, public unittest_setup(UnitTest, Title, Caller, Verbose)
integer, parameter sl
pure subroutine get_property(UnitTest, Verbose, Title, Caller, Level, Procedure, Message, Test_Result, n_Tests, n_Passed_Tests, n_Failed_Tests, n_AllTests, n_Passed_AllTests, n_Failed_AllTests)
pure logical function, public unittest_passed(UnitTest)
elemental real(single) function realsp_get_multiplier(x)
subroutine realdp_isequalwithin_rank1(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
subroutine test_passed(UnitTest)
subroutine realdp_isequal_rank1(UnitTest, Expected, Actual)
integer, parameter, public long
Definition: Type_Kinds.f90:76
subroutine realdp_isequalwithin_scalar(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
integer, parameter setup_level
subroutine test_failed(UnitTest)
integer, parameter lf
subroutine test_info_string(UnitTest, info)
subroutine complexdp_isequal_rank1(UnitTest, Expected, Actual)
subroutine, public unittest_summary(UnitTest)
character(*), parameter green_colour
integer, parameter init_level
character(*), parameter rfmt
character(2), parameter crlf
integer, parameter, public byte
Definition: Type_Kinds.f90:74
subroutine, public unittest_report(UnitTest)
character(*), dimension(n_message_levels), parameter message_level
subroutine realsp_isequal_scalar(UnitTest, Expected, Actual)
integer, parameter, public double
Definition: Type_Kinds.f90:106
subroutine realsp_isequalwithin_scalar(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
subroutine char_isequal_rank2(UnitTest, Expected, Actual)
subroutine intbyte_isequal_rank2(UnitTest, Expected, Actual)
integer, parameter, public single
Definition: Type_Kinds.f90:105
integer, parameter, public short
Definition: Type_Kinds.f90:75
character(*), parameter zfmt
integer, parameter cr
subroutine, public unittest_init(UnitTest, Verbose)
subroutine complexsp_isequal_rank2(UnitTest, Expected, Actual)
pure integer function, public unittest_n_failed(UnitTest)
integer, parameter summary_level
subroutine intshort_isequal_rank2(UnitTest, Expected, Actual)
subroutine complexdp_isequalwithin_rank1(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
subroutine complexsp_isequalwithin_scalar(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
subroutine intlong_isequal_rank2(UnitTest, Expected, Actual)
subroutine, public unittest_assert(UnitTest, Test)
subroutine complexsp_isequal_rank1(UnitTest, Expected, Actual)
subroutine realdp_isequalwithin_rank2(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
subroutine, public unittest_defineversion(Id)
subroutine complexdp_isequalwithin_rank2(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
subroutine char_isequal_scalar(UnitTest, Expected, Actual)
subroutine intshort_isequal_rank1(UnitTest, Expected, Actual)
character(*), parameter no_colour
subroutine char_isequal_rank1(UnitTest, Expected, Actual)
integer, parameter report_level
logical, parameter default_verbose
integer, parameter n_message_levels
subroutine test_increment(UnitTest)
subroutine intshort_isequal_scalar(UnitTest, Expected, Actual)
character(*), parameter module_version_id
subroutine intlong_isequal_scalar(UnitTest, Expected, Actual)
subroutine intbyte_isequal_rank1(UnitTest, Expected, Actual)
subroutine complexdp_isequalwithin_scalar(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
elemental real(double) function realdp_get_multiplier(x)
pure subroutine set_property(UnitTest, Verbose, Title, Caller, Level, Procedure, Message, Test_Result, n_Tests, n_Passed_Tests, n_Failed_Tests, n_AllTests, n_Passed_AllTests, n_Failed_AllTests)
subroutine complexdp_isequal_scalar(UnitTest, Expected, Actual)
subroutine intbyte_isequal_scalar(UnitTest, Expected, Actual)
subroutine realsp_isequalwithin_rank1(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
character(*), parameter red_colour
subroutine realsp_isequalwithin_rank2(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
subroutine complexsp_isequal_scalar(UnitTest, Expected, Actual)
integer, parameter test_level
pure integer function, public unittest_n_passed(UnitTest)
subroutine complexsp_isequalwithin_rank1(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
subroutine display_message(UnitTest)
subroutine complexsp_isequalwithin_rank2(UnitTest, Expected, Actual, Tolerance, Epsilon_Scale)
pure logical function, public unittest_failed(UnitTest)
subroutine realdp_isequal_rank2(UnitTest, Expected, Actual)
subroutine realdp_isequal_scalar(UnitTest, Expected, Actual)
subroutine intlong_isequal_rank1(UnitTest, Expected, Actual)
subroutine realsp_isequal_rank2(UnitTest, Expected, Actual)
subroutine complexdp_isequal_rank2(UnitTest, Expected, Actual)
subroutine realsp_isequal_rank1(UnitTest, Expected, Actual)
integer, parameter internal_fail_level