https://www.cdslab.org/paramonte/fortran/2
Current view: top level - test - test_pm_arrayReplace@routines.inc.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 839 839 100.0 %
Date: 2024-04-08 03:18:57 Functions: 442 442 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!                                                                                                                            !!!!
       4             : !!!!    ParaMonte: Parallel Monte Carlo and Machine Learning Library.                                                           !!!!
       5             : !!!!                                                                                                                            !!!!
       6             : !!!!    Copyright (C) 2012-present, The Computational Data Science Lab                                                          !!!!
       7             : !!!!                                                                                                                            !!!!
       8             : !!!!    This file is part of the ParaMonte library.                                                                             !!!!
       9             : !!!!                                                                                                                            !!!!
      10             : !!!!    LICENSE                                                                                                                 !!!!
      11             : !!!!                                                                                                                            !!!!
      12             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md                                                          !!!!
      13             : !!!!                                                                                                                            !!!!
      14             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      15             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      16             : 
      17             : !>  \brief
      18             : !>  This module contains implementations of the tests of the procedures under the generic interfaces
      19             : !>  [getReplaced](@ref Array_pmod::getReplaced),
      20             : !>  [setReplaced](@ref Array_pmod::setReplaced).
      21             : !>
      22             : !>  \fintest
      23             : !>
      24             : !>  \author
      25             : !>  \AmirShahmoradi, September 1, 2017, 11:35 PM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin
      26             : 
      27             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      28             : 
      29             : #if     getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED || \
      30             :         getReplaced_D1_D1_D0_LK_ENABLED || setReplaced_D1_D1_D0_LK_ENABLED || \
      31             :         getReplaced_D1_D0_D1_LK_ENABLED || setReplaced_D1_D0_D1_LK_ENABLED || \
      32             :         getReplaced_D1_D0_D0_LK_ENABLED || setReplaced_D1_D0_D0_LK_ENABLED
      33             : #define IS_EQUAL .eqv.
      34             : #else
      35             : #define IS_EQUAL ==
      36             : #endif
      37             : 
      38             : #if     getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
      39             : #define GET_SIZE len
      40             : #else
      41             : #define GET_SIZE size
      42             : #endif
      43             : 
      44             : #if     getReplaced_ENABLED
      45             :         character(*, SK), parameter :: PROCEDURE_NAME = "@getReplaced()"
      46             : #elif   setReplaced_ENABLED
      47             :         character(*, SK), parameter :: PROCEDURE_NAME = "@setReplaced()"
      48             : #endif
      49             : 
      50             :         integer(IK), allocatable :: instance(:)
      51             : 
      52             : #if     getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
      53             : #define ALL
      54           1 :         character(:,SKC), allocatable   :: ArrayNew_ref, ArrayTemplate, Array, pattern, Replacement
      55             : #elif   getReplaced_D1_D0_D0_SK_ENABLED || setReplaced_D1_D0_D0_SK_ENABLED
      56             :         character(2,SKC), allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:)
      57             :         character(2,SKC)                :: pattern, Replacement, lower, upper
      58           1 :         lower = SKC_"aa"; upper = SKC_"zz"
      59             : #elif   getReplaced_D1_D0_D0_IK_ENABLED || setReplaced_D1_D0_D0_IK_ENABLED
      60             :         integer(IKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:)
      61             :         integer(IKC)                    :: pattern, Replacement, lower, upper
      62           5 :         lower = -127_IKC; upper = 127_IKC
      63             : #elif   getReplaced_D1_D0_D0_LK_ENABLED || setReplaced_D1_D0_D0_LK_ENABLED
      64             :         logical(LKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:)
      65             :         logical(LKC)                    :: pattern, Replacement, lower, upper
      66           5 :         lower = .false._LKC; upper = .true._LKC
      67             : #elif   getReplaced_D1_D0_D0_CK_ENABLED || setReplaced_D1_D0_D0_CK_ENABLED
      68             :         complex(CKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:)
      69             :         complex(CKC)                    :: pattern, Replacement, lower, upper
      70           4 :         lower = (0._CKC, 0._CKC); upper = (1._CKC, 1._CKC)
      71             : #elif   getReplaced_D1_D0_D0_RK_ENABLED || setReplaced_D1_D0_D0_RK_ENABLED
      72             :         real(RKC)       , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:)
      73             :         real(RKC)                       :: pattern, Replacement, lower, upper
      74           4 :         lower = 0._RKC; upper = 1._RKC
      75             : #elif   getReplaced_D1_D0_D1_SK_ENABLED || setReplaced_D1_D0_D1_SK_ENABLED
      76             :         character(2,SKC), allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), Replacement(:)
      77             :         character(2,SKC)                :: pattern, lower, upper
      78           1 :         lower = SKC_"aa"; upper = SKC_"zz"
      79             : #elif   getReplaced_D1_D0_D1_IK_ENABLED || setReplaced_D1_D0_D1_IK_ENABLED
      80             :         integer(IKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), Replacement(:)
      81             :         integer(IKC)                    :: pattern, lower, upper
      82           5 :         lower = 0_IKC; upper = 9_IKC
      83             : #elif   getReplaced_D1_D0_D1_LK_ENABLED || setReplaced_D1_D0_D1_LK_ENABLED
      84             :         logical(LKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), Replacement(:)
      85             :         logical(LKC)                    :: pattern, lower, upper
      86           5 :         lower = .false._LKC; upper = .true._LKC
      87             : #elif   getReplaced_D1_D0_D1_CK_ENABLED || setReplaced_D1_D0_D1_CK_ENABLED
      88             :         complex(CKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), Replacement(:)
      89             :         complex(CKC)                    :: pattern, lower, upper
      90           4 :         lower = (0._CKC, 0._CKC); upper = (1._CKC, 1._CKC)
      91             : #elif   getReplaced_D1_D0_D1_RK_ENABLED || setReplaced_D1_D0_D1_RK_ENABLED
      92             :         real(RKC)       , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), Replacement(:)
      93             :         real(RKC)                       :: pattern, lower, upper
      94           4 :         lower = 0._RKC; upper = 1._RKC
      95             : #elif   getReplaced_D1_D1_D0_SK_ENABLED || setReplaced_D1_D1_D0_SK_ENABLED
      96             :         character(2,SKC), allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:)
      97             :         character(2,SKC)                :: Replacement, lower, upper
      98           1 :         lower = SKC_"aa"; upper = SKC_"zz"
      99             : #elif   getReplaced_D1_D1_D0_IK_ENABLED || setReplaced_D1_D1_D0_IK_ENABLED
     100             :         integer(IKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:)
     101             :         integer(IKC)                    :: Replacement, lower, upper
     102           5 :         lower = 0_IKC; upper = 9_IKC
     103             : #elif   getReplaced_D1_D1_D0_LK_ENABLED || setReplaced_D1_D1_D0_LK_ENABLED
     104             :         logical(LKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:)
     105             :         logical(LKC)                    :: Replacement, lower, upper
     106           5 :         lower = .false._LKC; upper = .true._LKC
     107             : #elif   getReplaced_D1_D1_D0_CK_ENABLED || setReplaced_D1_D1_D0_CK_ENABLED
     108             :         complex(CKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:)
     109             :         complex(CKC)                    :: Replacement, lower, upper
     110           4 :         lower = (0._CKC, 0._CKC); upper = (1._CKC, 1._CKC)
     111             : #elif   getReplaced_D1_D1_D0_RK_ENABLED || setReplaced_D1_D1_D0_RK_ENABLED
     112             :         real(RKC)       , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:)
     113             :         real(RKC)                       :: Replacement, lower, upper
     114           4 :         lower = 0._RKC; upper = 1._RKC
     115             : #elif   getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     116             :         character(2,SKC), allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:), Replacement(:)
     117             : #elif   getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     118             :         integer(IKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:), Replacement(:)
     119             : #elif   getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     120             :         logical(LKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:), Replacement(:)
     121             : #elif   getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     122             :         complex(CKC)    , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:), Replacement(:)
     123             : #elif   getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     124             :         real(RKC)       , allocatable   :: ArrayNew_ref(:), ArrayTemplate(:), Array(:), pattern(:), Replacement(:)
     125             : #else
     126             : #error  "Unrecognized interface."
     127             : #endif
     128             : 
     129             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     130             : 
     131          77 :         assertion = .true._LK
     132          77 :         call runTestsWith(getReplacedEnabled = .true._LK)
     133          77 :         call runTestsWith(getReplacedEnabled = .false._LK)
     134          77 :         call runTestsWith(getReplacedEnabled = .true._LK, iseq = iseq)
     135          77 :         call runTestsWith(getReplacedEnabled = .false._LK, iseq = iseq)
     136             : 
     137             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     138             : 
     139             :     contains
     140             : 
     141             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     142             : 
     143         308 :         subroutine runTestsWith(getReplacedEnabled, iseq)
     144             :             logical(LK), intent(in)         :: getReplacedEnabled
     145             :             logical(LK), external, optional :: iseq
     146             : 
     147             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     148             : #if         getReplaced_D1_D0_D0_ENABLED || getReplaced_D1_D0_D1_ENABLED || getReplaced_D1_D1_D0_ENABLED || \
     149             :             setReplaced_D1_D0_D0_ENABLED || setReplaced_D1_D0_D1_ENABLED || setReplaced_D1_D1_D0_ENABLED
     150             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     151             : 
     152             :             integer(IK) :: itest, jtest
     153             :             integer(IK), allocatable :: InstanceCopy(:)!, InstancePositive(:), Loc(:)
     154             : 
     155        2508 :             do itest = 1_IK, 10_IK
     156             : 
     157        2280 :                 call reset()
     158        2520 :                 allocate(ArrayTemplate(getUnifRand(1, 10)))
     159       14934 :                 call setUnifRand(ArrayTemplate, lower, upper)
     160             : #if             getReplaced_D1_D1_D0_ENABLED || setReplaced_D1_D1_D0_ENABLED
     161         830 :                 allocate(pattern(getUnifRand(0, size(ArrayTemplate) + 2)))
     162             : #endif
     163             : #if             getReplaced_D1_D0_D1_ENABLED || setReplaced_D1_D0_D1_ENABLED
     164         829 :                 allocate(Replacement(getUnifRand(0, size(ArrayTemplate) + 2)))
     165             : #endif
     166        5168 :                 call setUnifRand(Replacement, lower, upper)
     167             : 
     168        7068 :                 do jtest = 1_IK, 2_IK
     169             : 
     170        4560 :                     if (jtest == 1_IK) then
     171        5045 :                         call setUnifRand(pattern, lower, upper)
     172             :                     else
     173             : #if                     getReplaced_D1_D1_D0_ENABLED || setReplaced_D1_D1_D0_ENABLED
     174        2295 :                         pattern = ArrayTemplate(getUnifRand(1, size(ArrayTemplate) + 1) : getUnifRand(0, size(ArrayTemplate)))
     175             : #else
     176        1520 :                         pattern = ArrayTemplate(getUnifRand(1, size(ArrayTemplate)))
     177             : #endif
     178             :                     end if
     179             : 
     180       36704 :                     Array = ArrayTemplate
     181        4560 :                     call report(getReplacedEnabled, iseq)
     182        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array.", int(__LINE__, IK))
     183             : 
     184        4560 :                     if (allocated(instance)) deallocate(instance)
     185        4560 :                     allocate(instance(getUnifRand(0, 2 * size(ArrayTemplate))))
     186       29547 :                     call setUnifRand(instance, -2_IK * size(ArrayTemplate, kind = IK), 2_IK * size(ArrayTemplate, kind = IK))
     187             : 
     188       36086 :                     Array = ArrayTemplate
     189        4560 :                     call report(getReplacedEnabled, iseq, instance = instance)
     190        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance`.", int(__LINE__, IK))
     191             : 
     192       35379 :                     Array = ArrayTemplate
     193        4560 :                     call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     194        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance` with `sorted = .false.`.", int(__LINE__, IK))
     195             : 
     196       35379 :                     Array = ArrayTemplate
     197        4560 :                     call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     198        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance` with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     199             : 
     200       35379 :                     Array = ArrayTemplate
     201        4560 :                     call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     202        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance` with `unique = .false.`.", int(__LINE__, IK))
     203             : 
     204             :                     !   Sorting and removing duplicates in mixed `instance` is very difficult without a priori knowledge of the locations of `pattern` in `Array`.
     205             :                     !   So, we limit the tests to only cases where `instance` is strictly positive or negative.
     206             : 
     207       29547 :                     instance = abs(instance)
     208       17246 :                     if (getUnifRand()) instance = -instance
     209       37756 :                     InstanceCopy = instance
     210       47272 :                     instance = getUnique(instance)
     211             : 
     212       35379 :                     Array = ArrayTemplate
     213        4560 :                     call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     214        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance` with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     215             : 
     216       35379 :                     Array = ArrayTemplate
     217        4560 :                     call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     218        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance` with `unique = .true.`.", int(__LINE__, IK))
     219             : 
     220        4560 :                     call setSorted(InstanceCopy)
     221       36441 :                     instance = InstanceCopy
     222             : 
     223       35379 :                     Array = ArrayTemplate
     224        4560 :                     call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     225        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance` with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     226             : 
     227       35379 :                     Array = ArrayTemplate
     228        4560 :                     call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     229        4560 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance` with `sorted = .true.`.", int(__LINE__, IK))
     230             : 
     231       47272 :                     instance = getUnique(instance)
     232       35379 :                     Array = ArrayTemplate
     233        4560 :                     call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     234        6840 :                     call test%assert(assertion, PROCEDURE_NAME//SK_": All instances of pattern must be properly replaced with the input replacement in the input array with `instance` with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     235             : 
     236             :                 end do
     237             : 
     238             :             end do
     239             : 
     240             : 
     241             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     242             : #elif       getReplaced_D0_D0_D0_ENABLED || getReplaced_D1_D1_D1_ENABLED || \
     243             :             setReplaced_D0_D0_D0_ENABLED || setReplaced_D1_D1_D1_ENABLED
     244             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     245             : 
     246             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     247             : 
     248          80 :             call reset()
     249             : 
     250             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     251           4 :             ArrayTemplate = ""
     252           4 :             pattern = ""
     253           4 :             Replacement = ""
     254           4 :             ArrayNew_ref = ""
     255             : #elif       getReplaced_D1_D1_D1_SK_ENABLED
     256             :             allocate(character(2,SKC) :: ArrayTemplate(0), ArrayNew_ref(0), Replacement(0), pattern(0))
     257             : #elif       setReplaced_D1_D1_D1_SK_ENABLED
     258           4 :             allocate(ArrayTemplate(0), ArrayNew_ref(0), Replacement(0), pattern(0))
     259             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     260          20 :             allocate(ArrayTemplate(0), ArrayNew_ref(0), Replacement(0), pattern(0))
     261             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     262          16 :             allocate(ArrayTemplate(0), ArrayNew_ref(0), Replacement(0), pattern(0))
     263             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     264          16 :             allocate(ArrayTemplate(0), ArrayNew_ref(0), Replacement(0), pattern(0))
     265             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     266          20 :             allocate(ArrayTemplate(0), ArrayNew_ref(0), Replacement(0), pattern(0))
     267             : #endif
     268          80 :             allocate(instance(0))
     269             : 
     270          80 :             Array = ArrayTemplate
     271          80 :             call report(getReplacedEnabled, iseq)
     272          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array.", int(__LINE__, IK))
     273             : 
     274         156 :             Array = ArrayTemplate
     275          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     276          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance`.", int(__LINE__, IK))
     277             : 
     278         156 :             Array = ArrayTemplate
     279          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     280          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance` with `sorted = .true.`.", int(__LINE__, IK))
     281             : 
     282         156 :             Array = ArrayTemplate
     283          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     284          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance` with `sorted = .false.`.", int(__LINE__, IK))
     285             : 
     286         156 :             Array = ArrayTemplate
     287          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     288          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance` with `unique = .true.`.", int(__LINE__, IK))
     289             : 
     290         156 :             Array = ArrayTemplate
     291          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     292          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance` with `unique = .false.`.", int(__LINE__, IK))
     293             : 
     294         156 :             Array = ArrayTemplate
     295          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     296          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance` with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     297             : 
     298         156 :             Array = ArrayTemplate
     299          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     300          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance` with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     301             : 
     302         156 :             Array = ArrayTemplate
     303          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     304          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance` with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     305             : 
     306         156 :             Array = ArrayTemplate
     307          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     308          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, pattern, replacement, has empty resulting array with `instance` with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     309             : 
     310             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     311             : 
     312          80 :             call reset()
     313             : 
     314             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     315           4 :             ArrayTemplate = ""
     316           4 :             pattern = ""
     317           4 :             Replacement = "XX"
     318             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     319           4 :             allocate(character(2,SKC) :: ArrayTemplate(0), pattern(0))
     320          12 :             Replacement = ["XX"]
     321             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     322          20 :             allocate(ArrayTemplate(0), pattern(0))
     323          60 :             Replacement = [11_IKC]
     324             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     325          16 :             allocate(ArrayTemplate(0), pattern(0))
     326          48 :             Replacement = [11._CKC]
     327             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     328          16 :             allocate(ArrayTemplate(0), pattern(0))
     329          48 :             Replacement = [11._RKC]
     330             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     331          20 :             allocate(ArrayTemplate(0), pattern(0))
     332          60 :             Replacement = [.false._LKC]
     333             : #endif
     334         308 :             ArrayNew_ref = Replacement
     335          80 :             allocate(instance(0))
     336             : 
     337          80 :             Array = ArrayTemplate
     338          80 :             call report(getReplacedEnabled, iseq)
     339          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in replacement as new array.", int(__LINE__, IK))
     340             : 
     341         156 :             Array = ArrayTemplate
     342         156 :             ArrayNew_ref = ArrayTemplate
     343          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     344          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty.", int(__LINE__, IK))
     345             : 
     346         156 :             Array = ArrayTemplate
     347          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     348          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty with `sorted = .true.`.", int(__LINE__, IK))
     349             : 
     350         156 :             Array = ArrayTemplate
     351          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     352          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty with `sorted = .false.`.", int(__LINE__, IK))
     353             : 
     354         156 :             Array = ArrayTemplate
     355          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     356          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty with `unique = .true.`.", int(__LINE__, IK))
     357             : 
     358         156 :             Array = ArrayTemplate
     359          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     360          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty with `unique = .false.`.", int(__LINE__, IK))
     361             : 
     362         156 :             Array = ArrayTemplate
     363          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     364          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     365             : 
     366         156 :             Array = ArrayTemplate
     367          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     368          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     369             : 
     370         156 :             Array = ArrayTemplate
     371          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     372          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     373             : 
     374         156 :             Array = ArrayTemplate
     375          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     376          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance` is empty with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     377             : 
     378             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     379             : 
     380          80 :             call reset()
     381             : 
     382             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     383           4 :             ArrayTemplate = ""
     384           4 :             pattern = ""
     385           4 :             Replacement = "XX"
     386             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     387           4 :             allocate(character(2,SKC) :: ArrayTemplate(0), pattern(0))
     388          12 :             Replacement = ["XX"]
     389             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     390          20 :             allocate(ArrayTemplate(0), pattern(0))
     391          60 :             Replacement = [11_IKC]
     392             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     393          16 :             allocate(ArrayTemplate(0), pattern(0))
     394          48 :             Replacement = [11._CKC]
     395             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     396          16 :             allocate(ArrayTemplate(0), pattern(0))
     397          48 :             Replacement = [11._RKC]
     398             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     399          20 :             allocate(ArrayTemplate(0), pattern(0))
     400          60 :             Replacement = [.false._LKC]
     401             : #endif
     402         308 :             ArrayNew_ref = Replacement
     403         240 :             instance = [1000_IK]
     404             : 
     405         156 :             Array = ArrayTemplate
     406          80 :             call report(getReplacedEnabled, iseq)
     407          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in replacement as new array.", int(__LINE__, IK))
     408             : 
     409         156 :             Array = ArrayTemplate
     410         156 :             ArrayNew_ref = ArrayTemplate
     411          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     412          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number.", int(__LINE__, IK))
     413             : 
     414         156 :             Array = ArrayTemplate
     415          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     416          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number with `sorted = .true.`.", int(__LINE__, IK))
     417             : 
     418         156 :             Array = ArrayTemplate
     419          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     420          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number with `sorted = .false.`.", int(__LINE__, IK))
     421             : 
     422         156 :             Array = ArrayTemplate
     423          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     424          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number with `unique = .true.`.", int(__LINE__, IK))
     425             : 
     426         156 :             Array = ArrayTemplate
     427          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     428          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number with `unique = .false.`.", int(__LINE__, IK))
     429             : 
     430         156 :             Array = ArrayTemplate
     431          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     432          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     433             : 
     434         156 :             Array = ArrayTemplate
     435          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     436          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     437             : 
     438         156 :             Array = ArrayTemplate
     439          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     440          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     441             : 
     442         156 :             Array = ArrayTemplate
     443          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     444          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with empty pattern and non-empty replacement, must result in an empty array when `instance`is a nonsensical number with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     445             : 
     446             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     447             : 
     448          80 :             call reset()
     449             : 
     450             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     451           4 :             ArrayTemplate = "A"
     452           4 :             pattern = ""
     453           4 :             Replacement = "XX"
     454           4 :             ArrayNew_ref = "XXAXX"
     455             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     456          12 :             ArrayTemplate = ["AA"]
     457           4 :             allocate(character(2,SKC) :: pattern(0))
     458          12 :             Replacement = ["XX"]
     459          20 :             ArrayNew_ref = ["XX", "AA", "XX"]
     460             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     461          60 :             ArrayTemplate = [33_IKC]
     462          20 :             allocate(pattern(0))
     463          60 :             Replacement = [11_IKC]
     464         100 :             ArrayNew_ref = [11_IKC, 33_IKC, 11_IKC]
     465             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     466          48 :             ArrayTemplate = [33._CKC]
     467          16 :             allocate(pattern(0))
     468          48 :             Replacement = [11._CKC]
     469          80 :             ArrayNew_ref = [11._CKC, 33._CKC, 11._CKC]
     470             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     471          48 :             ArrayTemplate = [33._RKC]
     472          16 :             allocate(pattern(0))
     473          48 :             Replacement = [11._RKC]
     474          80 :             ArrayNew_ref = [11._RKC, 33._RKC, 11._RKC]
     475             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     476          60 :             ArrayTemplate = [.true._LKC]
     477          20 :             allocate(pattern(0))
     478          60 :             Replacement = [.false._LKC]
     479         100 :             ArrayNew_ref = [.false._LKC, .true._LKC, .false._LKC]
     480             : #endif
     481          80 :             allocate(instance(0))
     482             : 
     483         308 :             Array = ArrayTemplate
     484          80 :             call report(getReplacedEnabled, iseq)
     485          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in ArrayTemplate sandwiched with two Replacements as new array.", int(__LINE__, IK))
     486             : 
     487         308 :             Array = ArrayTemplate
     488         308 :             ArrayNew_ref = ArrayTemplate
     489          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     490          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array.", int(__LINE__, IK))
     491             : 
     492         232 :             Array = ArrayTemplate
     493          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     494          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array with `sorted = .true.`.", int(__LINE__, IK))
     495             : 
     496         232 :             Array = ArrayTemplate
     497          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     498          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array with `sorted = .false.`.", int(__LINE__, IK))
     499             : 
     500         232 :             Array = ArrayTemplate
     501          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     502          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array with `unique = .true.`.", int(__LINE__, IK))
     503             : 
     504         232 :             Array = ArrayTemplate
     505          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     506          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array with `unique = .false.`.", int(__LINE__, IK))
     507             : 
     508         232 :             Array = ArrayTemplate
     509          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     510          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     511             : 
     512         232 :             Array = ArrayTemplate
     513          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     514          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     515             : 
     516         232 :             Array = ArrayTemplate
     517          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     518          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     519             : 
     520         232 :             Array = ArrayTemplate
     521          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     522          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is an empty array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     523             : 
     524             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     525             : 
     526          80 :             call reset()
     527             : 
     528             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     529           4 :             ArrayTemplate = "A"
     530           4 :             pattern = ""
     531           4 :             Replacement = "XX"
     532           4 :             ArrayNew_ref = "XXAXX"
     533             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     534          12 :             ArrayTemplate = ["AA"]
     535           4 :             allocate(character(2,SKC) :: pattern(0))
     536          12 :             Replacement = ["XX"]
     537          20 :             ArrayNew_ref = ["XX", "AA", "XX"]
     538             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     539          60 :             ArrayTemplate = [33_IKC]
     540          20 :             allocate(pattern(0))
     541          60 :             Replacement = [11_IKC]
     542         100 :             ArrayNew_ref = [11_IKC, 33_IKC, 11_IKC]
     543             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     544          48 :             ArrayTemplate = [33._CKC]
     545          16 :             allocate(pattern(0))
     546          48 :             Replacement = [11._CKC]
     547          80 :             ArrayNew_ref = [11._CKC, 33._CKC, 11._CKC]
     548             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     549          48 :             ArrayTemplate = [33._RKC]
     550          16 :             allocate(pattern(0))
     551          48 :             Replacement = [11._RKC]
     552          80 :             ArrayNew_ref = [11._RKC, 33._RKC, 11._RKC]
     553             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     554          60 :             ArrayTemplate = [.true._LKC]
     555          20 :             allocate(pattern(0))
     556          60 :             Replacement = [.false._LKC]
     557         100 :             ArrayNew_ref = [.false._LKC, .true._LKC, .false._LKC]
     558             : #endif
     559         320 :             instance = [1_IK, -1_IK]
     560             : 
     561         232 :             Array = ArrayTemplate
     562          80 :             call report(getReplacedEnabled, iseq)
     563          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in ArrayTemplate sandwiched with two Replacements as new array.", int(__LINE__, IK))
     564             : 
     565         308 :             Array = ArrayTemplate
     566          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     567          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array.", int(__LINE__, IK))
     568             : 
     569         308 :             Array = ArrayTemplate
     570          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     571          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array with `sorted = .true.`.", int(__LINE__, IK))
     572             : 
     573         308 :             Array = ArrayTemplate
     574          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     575          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array with `sorted = .false.`.", int(__LINE__, IK))
     576             : 
     577         308 :             Array = ArrayTemplate
     578          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     579          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array with `unique = .true.`.", int(__LINE__, IK))
     580             : 
     581         308 :             Array = ArrayTemplate
     582          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     583          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array with `unique = .false.`.", int(__LINE__, IK))
     584             : 
     585         308 :             Array = ArrayTemplate
     586          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     587          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     588             : 
     589         308 :             Array = ArrayTemplate
     590          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     591          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     592             : 
     593         308 :             Array = ArrayTemplate
     594          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     595          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     596             : 
     597         308 :             Array = ArrayTemplate
     598          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     599          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty sorted unique array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     600             : 
     601             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     602             : 
     603          80 :             call reset()
     604             : 
     605             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     606           4 :             ArrayTemplate = "A"
     607           4 :             pattern = ""
     608           4 :             Replacement = "XX"
     609           4 :             ArrayNew_ref = "XXAXX"
     610             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     611          12 :             ArrayTemplate = ["AA"]
     612           4 :             allocate(character(2,SKC) :: pattern(0))
     613          12 :             Replacement = ["XX"]
     614          20 :             ArrayNew_ref = ["XX", "AA", "XX"]
     615             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     616          60 :             ArrayTemplate = [33_IKC]
     617          20 :             allocate(pattern(0))
     618          60 :             Replacement = [11_IKC]
     619         100 :             ArrayNew_ref = [11_IKC, 33_IKC, 11_IKC]
     620             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     621          48 :             ArrayTemplate = [33._CKC]
     622          16 :             allocate(pattern(0))
     623          48 :             Replacement = [11._CKC]
     624          80 :             ArrayNew_ref = [11._CKC, 33._CKC, 11._CKC]
     625             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     626          48 :             ArrayTemplate = [33._RKC]
     627          16 :             allocate(pattern(0))
     628          48 :             Replacement = [11._RKC]
     629          80 :             ArrayNew_ref = [11._RKC, 33._RKC, 11._RKC]
     630             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     631          60 :             ArrayTemplate = [.true._LK]
     632          20 :             allocate(pattern(0))
     633          60 :             Replacement = [.false._LK]
     634         100 :             ArrayNew_ref = [.false._LK, .true._LK, .false._LK]
     635             : #endif
     636         320 :             instance = [-1000_IK, 250_IK]
     637             : 
     638         308 :             Array = ArrayTemplate
     639          80 :             call report(getReplacedEnabled, iseq)
     640          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in ArrayTemplate sandwiched with two Replacements as new array.", int(__LINE__, IK))
     641             : 
     642         308 :             Array = ArrayTemplate
     643         308 :             ArrayNew_ref = ArrayTemplate
     644          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     645          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array.", int(__LINE__, IK))
     646             : 
     647         232 :             Array = ArrayTemplate
     648          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     649          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array with `sorted = .true.`.", int(__LINE__, IK))
     650             : 
     651         232 :             Array = ArrayTemplate
     652          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     653          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array with `sorted = .false.`.", int(__LINE__, IK))
     654             : 
     655         232 :             Array = ArrayTemplate
     656          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     657          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array with `unique = .true.`.", int(__LINE__, IK))
     658             : 
     659         232 :             Array = ArrayTemplate
     660          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     661          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array with `unique = .false.`.", int(__LINE__, IK))
     662             : 
     663         232 :             Array = ArrayTemplate
     664          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     665          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     666             : 
     667         232 :             Array = ArrayTemplate
     668          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     669          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     670             : 
     671         232 :             Array = ArrayTemplate
     672          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     673          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     674             : 
     675         232 :             Array = ArrayTemplate
     676          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     677          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty insane array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     678             : 
     679             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     680             : 
     681          80 :             call reset()
     682             : 
     683             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     684           4 :             ArrayTemplate = "A"
     685           4 :             pattern = ""
     686           4 :             Replacement = "XX"
     687           4 :             ArrayNew_ref = "AXX"
     688             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     689          12 :             ArrayTemplate = ["AA"]
     690           4 :             allocate(character(2,SKC) :: pattern(0))
     691          12 :             Replacement = ["XX"]
     692          16 :             ArrayNew_ref = ["AA", "XX"]
     693             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     694          60 :             ArrayTemplate = [33_IKC]
     695          20 :             allocate(pattern(0))
     696          60 :             Replacement = [11_IKC]
     697          80 :             ArrayNew_ref = [33_IKC, 11_IKC]
     698             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     699          48 :             ArrayTemplate = [33._CKC]
     700          16 :             allocate(pattern(0))
     701          48 :             Replacement = [11._CKC]
     702          64 :             ArrayNew_ref = [33._CKC, 11._CKC]
     703             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     704          48 :             ArrayTemplate = [33._RKC]
     705          16 :             allocate(pattern(0))
     706          48 :             Replacement = [11._RKC]
     707          64 :             ArrayNew_ref = [33._RKC, 11._RKC]
     708             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     709          60 :             ArrayTemplate = [.true._LK]
     710          20 :             allocate(pattern(0))
     711          60 :             Replacement = [.false._LK]
     712          80 :             ArrayNew_ref = [.true._LK, .false._LK]
     713             : #endif
     714             : 
     715         232 :             Array = ArrayTemplate
     716         320 :             instance = [0_IK, 2_IK]
     717          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     718          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in ArrayTemplate sandwiched with two Replacements as new array.", int(__LINE__, IK))
     719             : 
     720         308 :             Array = ArrayTemplate
     721         320 :             instance = [0_IK, -1_IK]
     722          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     723          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array.", int(__LINE__, IK))
     724             : 
     725         308 :             Array = ArrayTemplate
     726          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     727          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .true.`.", int(__LINE__, IK))
     728             : 
     729         308 :             Array = ArrayTemplate
     730          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     731          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .false.`.", int(__LINE__, IK))
     732             : 
     733         308 :             Array = ArrayTemplate
     734          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     735          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `unique = .true.`.", int(__LINE__, IK))
     736             : 
     737         308 :             Array = ArrayTemplate
     738          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     739          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `unique = .false.`.", int(__LINE__, IK))
     740             : 
     741         308 :             Array = ArrayTemplate
     742          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     743          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     744             : 
     745         308 :             Array = ArrayTemplate
     746          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     747          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     748             : 
     749         308 :             Array = ArrayTemplate
     750          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     751          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     752             : 
     753         308 :             Array = ArrayTemplate
     754          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     755          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     756             : 
     757             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     758             : 
     759          80 :             call reset()
     760             : 
     761             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     762           4 :             ArrayTemplate = ""
     763           4 :             pattern = "A"
     764           4 :             Replacement = "XX"
     765             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     766           4 :             allocate(character(2,SKC) :: ArrayTemplate(0))
     767          12 :             pattern = ["AA"]
     768          12 :             Replacement = ["XX"]
     769             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     770          20 :             allocate(ArrayTemplate(0))
     771          60 :             pattern = [33_IKC]
     772          60 :             Replacement = [11_IKC]
     773             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     774          16 :             allocate(ArrayTemplate(0))
     775          48 :             pattern = [33._CKC]
     776          48 :             Replacement = [11._CKC]
     777             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     778          16 :             allocate(ArrayTemplate(0))
     779          48 :             pattern = [33._RKC]
     780          48 :             Replacement = [11._RKC]
     781             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     782          20 :             allocate(ArrayTemplate(0))
     783          60 :             pattern = [.true._LK]
     784          60 :             Replacement = [.false._LK]
     785             : #endif
     786          80 :             ArrayNew_ref = ArrayTemplate
     787         320 :             instance = [0_IK, -1_IK]
     788             : 
     789         156 :             Array = ArrayTemplate
     790          80 :             call report(getReplacedEnabled, iseq)
     791          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in ArrayTemplate sandwiched with two Replacements as new array.", int(__LINE__, IK))
     792             : 
     793         156 :             Array = ArrayTemplate
     794          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     795          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array.", int(__LINE__, IK))
     796             : 
     797         156 :             Array = ArrayTemplate
     798          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     799          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .true.`.", int(__LINE__, IK))
     800             : 
     801         156 :             Array = ArrayTemplate
     802          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     803          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .false.`.", int(__LINE__, IK))
     804             : 
     805         156 :             Array = ArrayTemplate
     806          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     807          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `unique = .true.`.", int(__LINE__, IK))
     808             : 
     809         156 :             Array = ArrayTemplate
     810          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     811          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `unique = .false.`.", int(__LINE__, IK))
     812             : 
     813         156 :             Array = ArrayTemplate
     814          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     815          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     816             : 
     817         156 :             Array = ArrayTemplate
     818          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     819          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     820             : 
     821         156 :             Array = ArrayTemplate
     822          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     823          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     824             : 
     825         156 :             Array = ArrayTemplate
     826          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     827          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An empty array, with non-empty pattern and non-empty replacement, must result in the same array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     828             : 
     829             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     830             : 
     831          80 :             call reset()
     832             : 
     833             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     834           4 :             ArrayTemplate = "AA"
     835           4 :             pattern = "A"
     836           4 :             Replacement = ""
     837             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     838          16 :             ArrayTemplate = ["AA", "AA"]
     839          12 :             pattern = ["AA"]
     840           4 :             allocate(Replacement(0))
     841             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     842          80 :             ArrayTemplate = [33_IKC, 33_IKC]
     843          60 :             pattern = [33_IKC]
     844          20 :             allocate(Replacement(0))
     845             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     846          64 :             ArrayTemplate = [33._CKC, 33._CKC]
     847          48 :             pattern = [33._CKC]
     848          16 :             allocate(Replacement(0))
     849             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     850          64 :             ArrayTemplate = [33._RKC, 33._RKC]
     851          48 :             pattern = [33._RKC]
     852          16 :             allocate(Replacement(0))
     853             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     854          60 :             ArrayTemplate = [.true._LK]
     855          60 :             pattern = [.true._LK]
     856          20 :             allocate(Replacement(0))
     857             : #endif
     858          80 :             ArrayNew_ref = Replacement
     859         320 :             instance = [1_IK, -1_IK]
     860             : 
     861         364 :             Array = ArrayTemplate
     862          80 :             call report(getReplacedEnabled, iseq)
     863          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array.", int(__LINE__, IK))
     864             : 
     865         364 :             Array = ArrayTemplate
     866          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     867          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array.", int(__LINE__, IK))
     868             : 
     869         364 :             Array = ArrayTemplate
     870          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     871          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array with `sorted = .true.`.", int(__LINE__, IK))
     872             : 
     873         364 :             Array = ArrayTemplate
     874          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     875          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array with `sorted = .false.`.", int(__LINE__, IK))
     876             : 
     877         364 :             Array = ArrayTemplate
     878          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     879          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array with `unique = .true.`.", int(__LINE__, IK))
     880             : 
     881         364 :             Array = ArrayTemplate
     882          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     883          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array with `unique = .false.`.", int(__LINE__, IK))
     884             : 
     885         364 :             Array = ArrayTemplate
     886          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     887          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     888             : 
     889         364 :             Array = ArrayTemplate
     890          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     891          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     892             : 
     893         364 :             Array = ArrayTemplate
     894          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     895          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     896             : 
     897         364 :             Array = ArrayTemplate
     898          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     899          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and empty replacement, must result in an empty new array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     900             : 
     901             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     902             : 
     903          80 :             call reset()
     904             : 
     905             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     906           4 :             ArrayTemplate = "AABBAACCAADDAAEE"
     907           4 :             pattern = "A"
     908           4 :             Replacement = "XX"
     909           4 :             ArrayNew_ref = "XXABBXXACCAADDXXXXEE"
     910             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     911          72 :             ArrayTemplate = ["AA", "AA", "BB", "BB", "AA", "AA", "CC", "CC", "AA", "AA", "DD", "DD", "AA", "AA", "EE", "EE"]
     912          12 :             pattern = ["AA"]
     913          16 :             Replacement = ["XX", "XX"]
     914          88 :             ArrayNew_ref = ["XX", "XX", "AA", "BB", "BB", "XX", "XX", "AA", "CC", "CC", "AA", "AA", "DD", "DD", "XX", "XX", "XX", "XX", "EE", "EE"]
     915             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     916         360 :             ArrayTemplate = [1_IKC, 1_IKC, 2_IKC, 2_IKC, 1_IKC, 1_IKC, 3_IKC, 3_IKC, 1_IKC, 1_IKC, 4_IKC, 4_IKC, 1_IKC, 1_IKC, 5_IKC, 5_IKC]
     917          60 :             pattern = [1_IKC]
     918          80 :             Replacement = [0_IKC, 0_IKC]
     919         440 :             ArrayNew_ref = [0_IKC, 0_IKC, 1_IKC, 2_IKC, 2_IKC, 0_IKC, 0_IKC, 1_IKC, 3_IKC, 3_IKC, 1_IKC, 1_IKC, 4_IKC, 4_IKC, 0_IKC, 0_IKC, 0_IKC, 0_IKC, 5_IKC, 5_IKC]
     920             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     921         288 :             ArrayTemplate = [1._CKC, 1._CKC, 2._CKC, 2._CKC, 1._CKC, 1._CKC, 3._CKC, 3._CKC, 1._CKC, 1._CKC, 4._CKC, 4._CKC, 1._CKC, 1._CKC, 5._CKC, 5._CKC]
     922          48 :             pattern = [1._CKC]
     923          64 :             Replacement = [0._CKC, 0._CKC]
     924         352 :             ArrayNew_ref = [0._CKC, 0._CKC, 1._CKC, 2._CKC, 2._CKC, 0._CKC, 0._CKC, 1._CKC, 3._CKC, 3._CKC, 1._CKC, 1._CKC, 4._CKC, 4._CKC, 0._CKC, 0._CKC, 0._CKC, 0._CKC, 5._CKC, 5._CKC]
     925             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
     926         288 :             ArrayTemplate = [1._RKC, 1._RKC, 2._RKC, 2._RKC, 1._RKC, 1._RKC, 3._RKC, 3._RKC, 1._RKC, 1._RKC, 4._RKC, 4._RKC, 1._RKC, 1._RKC, 5._RKC, 5._RKC]
     927          48 :             pattern = [1._RKC]
     928          64 :             Replacement = [0._RKC, 0._RKC]
     929         352 :             ArrayNew_ref = [0._RKC, 0._RKC, 1._RKC, 2._RKC, 2._RKC, 0._RKC, 0._RKC, 1._RKC, 3._RKC, 3._RKC, 1._RKC, 1._RKC, 4._RKC, 4._RKC, 0._RKC, 0._RKC, 0._RKC, 0._RKC, 5._RKC, 5._RKC]
     930             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
     931         360 :             ArrayTemplate = [.true._LK, .true._LK, .false._LK, .false._LK, .true._LK, .true._LK, .false._LK, .false._LK, .true._LK, .true._LK, .false._LK, .false._LK, .true._LK, .true._LK, .false._LK, .false._LK]
     932          60 :             pattern = [.true._LK]
     933          80 :             Replacement = [.false._LK, .false._LK]
     934         440 :             ArrayNew_ref = [.false._LK, .false._LK, .true._LK, .false._LK, .false._LK, .false._LK, .false._LK, .true._LK, .false._LK, .false._LK, .true._LK, .true._LK, .false._LK, .false._LK, .false._LK, .false._LK, .false._LK, .false._LK, .false._LK, .false._LK]
     935             : #endif
     936             : 
     937        1448 :             Array = ArrayTemplate
     938         480 :             instance = [1_IK, 3_IK, 7_IK, 8_IK]
     939          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     940          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array.", int(__LINE__, IK))
     941             : 
     942        1448 :             Array = ArrayTemplate
     943         480 :             instance = [1_IK, 3_IK, -2_IK, -1_IK]
     944          80 :             call report(getReplacedEnabled, iseq, instance = instance)
     945          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array.", int(__LINE__, IK))
     946             : 
     947        1448 :             Array = ArrayTemplate
     948          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
     949          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true.`.", int(__LINE__, IK))
     950             : 
     951        1448 :             Array = ArrayTemplate
     952          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
     953          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false.`.", int(__LINE__, IK))
     954             : 
     955        1448 :             Array = ArrayTemplate
     956          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
     957          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `unique = .true.`.", int(__LINE__, IK))
     958             : 
     959        1448 :             Array = ArrayTemplate
     960          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
     961          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `unique = .false.`.", int(__LINE__, IK))
     962             : 
     963        1448 :             Array = ArrayTemplate
     964          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
     965          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
     966             : 
     967        1448 :             Array = ArrayTemplate
     968          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
     969          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
     970             : 
     971        1448 :             Array = ArrayTemplate
     972          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
     973          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
     974             : 
     975        1448 :             Array = ArrayTemplate
     976          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
     977          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
     978             : 
     979             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     980             : 
     981          80 :             call reset()
     982             : 
     983             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
     984           4 :             ArrayTemplate = "AABBAACCAADDAAEE"
     985           4 :             pattern = "A"
     986           4 :             Replacement = "XX"
     987           4 :             ArrayNew_ref = "XXXXBBXXXXCCXXXXDDXXXXEE"
     988             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
     989          72 :             ArrayTemplate = ["AA", "AA", "BB", "BB", "AA", "AA", "CC", "CC", "AA", "AA", "DD", "DD", "AA", "AA", "EE", "EE"]
     990          12 :             pattern = ["AA"]
     991          16 :             Replacement = ["XX", "XX"]
     992         104 :             ArrayNew_ref = ["XX", "XX", "XX", "XX", "BB", "BB", "XX", "XX", "XX", "XX", "CC", "CC", "XX", "XX", "XX", "XX", "DD", "DD", "XX", "XX", "XX", "XX", "EE", "EE"]
     993             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
     994         360 :             ArrayTemplate = [1_IKC, 1_IKC, 2_IKC, 2_IKC, 1_IKC, 1_IKC, 3_IKC, 3_IKC, 1_IKC, 1_IKC, 4_IKC, 4_IKC, 1_IKC, 1_IKC, 5_IKC, 5_IKC]
     995          60 :             pattern = [1_IKC]
     996          80 :             Replacement = [0_IKC, 0_IKC]
     997         520 :             ArrayNew_ref = [0_IKC, 0_IKC, 0_IKC, 0_IKC, 2_IKC, 2_IKC, 0_IKC, 0_IKC, 0_IKC, 0_IKC, 3_IKC, 3_IKC, 0_IKC, 0_IKC, 0_IKC, 0_IKC, 4_IKC, 4_IKC, 0_IKC, 0_IKC, 0_IKC, 0_IKC, 5_IKC, 5_IKC]
     998             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
     999         288 :             ArrayTemplate = [1._CKC, 1._CKC, 2._CKC, 2._CKC, 1._CKC, 1._CKC, 3._CKC, 3._CKC, 1._CKC, 1._CKC, 4._CKC, 4._CKC, 1._CKC, 1._CKC, 5._CKC, 5._CKC]
    1000          48 :             pattern = [1._CKC]
    1001          64 :             Replacement = [0._CKC, 0._CKC]
    1002         416 :             ArrayNew_ref = [0._CKC, 0._CKC, 0._CKC, 0._CKC, 2._CKC, 2._CKC, 0._CKC, 0._CKC, 0._CKC, 0._CKC, 3._CKC, 3._CKC, 0._CKC, 0._CKC, 0._CKC, 0._CKC, 4._CKC, 4._CKC, 0._CKC, 0._CKC, 0._CKC, 0._CKC, 5._CKC, 5._CKC]
    1003             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
    1004         288 :             ArrayTemplate = [1._RKC, 1._RKC, 2._RKC, 2._RKC, 1._RKC, 1._RKC, 3._RKC, 3._RKC, 1._RKC, 1._RKC, 4._RKC, 4._RKC, 1._RKC, 1._RKC, 5._RKC, 5._RKC]
    1005          48 :             pattern = [1._RKC]
    1006          64 :             Replacement = [0._RKC, 0._RKC]
    1007         416 :             ArrayNew_ref = [0._RKC, 0._RKC, 0._RKC, 0._RKC, 2._RKC, 2._RKC, 0._RKC, 0._RKC, 0._RKC, 0._RKC, 3._RKC, 3._RKC, 0._RKC, 0._RKC, 0._RKC, 0._RKC, 4._RKC, 4._RKC, 0._RKC, 0._RKC, 0._RKC, 0._RKC, 5._RKC, 5._RKC]
    1008             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
    1009         360 :             ArrayTemplate = [.true., .true., .false., .false., .true., .true., .false., .false., .true., .true., .false., .false., .true., .true., .false., .false.]
    1010          60 :             pattern = [.true.]
    1011          80 :             Replacement = [.false., .false.]
    1012         520 :             ArrayNew_ref = [.false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false., .false.]
    1013             : #endif
    1014         800 :             instance = [-8_IK, -7_IK, -6_IK, -5_IK, -4_IK, -3_IK, -2_IK, -1_IK]
    1015             : 
    1016        1448 :             Array = ArrayTemplate
    1017          80 :             call report(getReplacedEnabled, iseq)
    1018          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array.", int(__LINE__, IK))
    1019             : 
    1020        1448 :             Array = ArrayTemplate
    1021          80 :             call report(getReplacedEnabled, iseq, instance = instance)
    1022          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array.", int(__LINE__, IK))
    1023             : 
    1024        1448 :             Array = ArrayTemplate
    1025          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
    1026          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true.`.", int(__LINE__, IK))
    1027             : 
    1028        1448 :             Array = ArrayTemplate
    1029          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
    1030          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false.`.", int(__LINE__, IK))
    1031             : 
    1032        1448 :             Array = ArrayTemplate
    1033          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
    1034          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `unique = .true.`.", int(__LINE__, IK))
    1035             : 
    1036        1448 :             Array = ArrayTemplate
    1037          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
    1038          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `unique = .false.`.", int(__LINE__, IK))
    1039             : 
    1040        1448 :             Array = ArrayTemplate
    1041          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
    1042          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
    1043             : 
    1044        1448 :             Array = ArrayTemplate
    1045          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
    1046          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
    1047             : 
    1048        1448 :             Array = ArrayTemplate
    1049          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
    1050          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
    1051             : 
    1052        1448 :             Array = ArrayTemplate
    1053          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
    1054          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
    1055             : 
    1056             :             ! unsort and duplicate instance elements.
    1057          80 :             call setShuffled(instance)
    1058        2320 :             instance = [instance, 1_IK]
    1059             : 
    1060        1448 :             Array = ArrayTemplate
    1061          80 :             call report(getReplacedEnabled, iseq, instance = instance)
    1062          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty non-unique unsorted mixed array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
    1063             : 
    1064        1448 :             Array = ArrayTemplate
    1065          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
    1066          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty non-unique unsorted mixed array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
    1067             : 
    1068             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1069             : 
    1070          80 :             call reset()
    1071             : 
    1072             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
    1073           4 :             ArrayTemplate = "AABBAACCAADDAAEE"
    1074           4 :             pattern = "Y"
    1075           4 :             Replacement = "XX"
    1076             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
    1077          72 :             ArrayTemplate = ["AA", "AA", "BB", "BB", "AA", "AA", "CC", "CC", "AA", "AA", "DD", "DD", "AA", "AA", "EE", "EE"]
    1078          12 :             pattern = ["YY"]
    1079          16 :             Replacement = ["XX", "XX"]
    1080             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
    1081         360 :             ArrayTemplate = [1_IKC, 1_IKC, 2_IKC, 2_IKC, 1_IKC, 1_IKC, 3_IKC, 3_IKC, 1_IKC, 1_IKC, 4_IKC, 4_IKC, 1_IKC, 1_IKC, 5_IKC, 5_IKC]
    1082          60 :             pattern = [-1_IKC]
    1083          80 :             Replacement = [0_IKC, 0_IKC]
    1084             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
    1085         288 :             ArrayTemplate = [1._CKC, 1._CKC, 2._CKC, 2._CKC, 1._CKC, 1._CKC, 3._CKC, 3._CKC, 1._CKC, 1._CKC, 4._CKC, 4._CKC, 1._CKC, 1._CKC, 5._CKC, 5._CKC]
    1086          48 :             pattern = [-1._CKC]
    1087          64 :             Replacement = [0._CKC, 0._CKC]
    1088             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
    1089         288 :             ArrayTemplate = [1._RKC, 1._RKC, 2._RKC, 2._RKC, 1._RKC, 1._RKC, 3._RKC, 3._RKC, 1._RKC, 1._RKC, 4._RKC, 4._RKC, 1._RKC, 1._RKC, 5._RKC, 5._RKC]
    1090          48 :             pattern = [-1._RKC]
    1091          64 :             Replacement = [0._RKC, 0._RKC]
    1092             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
    1093         360 :             ArrayTemplate = [.true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true., .true.]
    1094          60 :             pattern = [.false.]
    1095          80 :             Replacement = [.false., .false.]
    1096             : #endif
    1097         800 :             instance = [-8_IK, -7_IK, -6_IK, -5_IK, -4_IK, -3_IK, -2_IK, -1_IK]
    1098             : 
    1099        1448 :             ArrayNew_ref = ArrayTemplate
    1100        1448 :             Array = ArrayTemplate
    1101          80 :             call report(getReplacedEnabled, iseq)
    1102          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array.", int(__LINE__, IK))
    1103             : 
    1104        1372 :             Array = ArrayTemplate
    1105          80 :             call report(getReplacedEnabled, iseq, instance = instance)
    1106          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array.", int(__LINE__, IK))
    1107             : 
    1108        1372 :             Array = ArrayTemplate
    1109          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
    1110          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true.`.", int(__LINE__, IK))
    1111             : 
    1112        1372 :             Array = ArrayTemplate
    1113          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
    1114          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false.`.", int(__LINE__, IK))
    1115             : 
    1116        1372 :             Array = ArrayTemplate
    1117          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
    1118          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `unique = .true.`.", int(__LINE__, IK))
    1119             : 
    1120        1372 :             Array = ArrayTemplate
    1121          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
    1122          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `unique = .false.`.", int(__LINE__, IK))
    1123             : 
    1124        1372 :             Array = ArrayTemplate
    1125          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
    1126          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
    1127             : 
    1128        1372 :             Array = ArrayTemplate
    1129          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
    1130          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
    1131             : 
    1132        1372 :             Array = ArrayTemplate
    1133          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
    1134          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
    1135             : 
    1136        1372 :             Array = ArrayTemplate
    1137          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
    1138          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty mixed array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
    1139             : 
    1140             :             ! unsort and duplicate instance elements.
    1141          80 :             call setShuffled(instance)
    1142        2320 :             instance = [instance, 1_IK]
    1143             : 
    1144        1372 :             Array = ArrayTemplate
    1145          80 :             call report(getReplacedEnabled, iseq, instance = instance)
    1146          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty non-unique unsorted mixed array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
    1147             : 
    1148        1372 :             Array = ArrayTemplate
    1149          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
    1150          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": A non-empty array, with non-empty matching pattern and non-empty replacement, must result in a properly-replaced new array when `instance` is a non-empty non-unique unsorted mixed array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
    1151             : 
    1152             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1153             : 
    1154          80 :             call reset()
    1155             : 
    1156             : #if         getReplaced_D0_D0_D0_SK_ENABLED || setReplaced_D0_D0_D0_SK_ENABLED
    1157           4 :             ArrayTemplate = "AA"
    1158           4 :             Replacement = "XX"
    1159             : #elif       getReplaced_D1_D1_D1_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
    1160          12 :             ArrayTemplate = ["AA"]
    1161          12 :             Replacement = ["XX"]
    1162             : #elif       getReplaced_D1_D1_D1_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
    1163          60 :             ArrayTemplate = [33_IKC]
    1164          80 :             Replacement = [11_IKC, 11_IKC]
    1165             : #elif       getReplaced_D1_D1_D1_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
    1166          48 :             ArrayTemplate = [(33._CKC,-33._CKC)]
    1167          64 :             Replacement = [(11._CKC,-11._CKC), (11._CKC,-11._CKC)]
    1168             : #elif       getReplaced_D1_D1_D1_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
    1169          48 :             ArrayTemplate = [33._RKC]
    1170          64 :             Replacement = [11._RKC, 11._RKC]
    1171             : #elif       getReplaced_D1_D1_D1_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
    1172          80 :             ArrayTemplate = [.true., .true.]
    1173          80 :             Replacement = [.false., .false.]
    1174             : #endif
    1175         328 :             pattern = ArrayTemplate
    1176         328 :             ArrayNew_ref = ArrayTemplate
    1177         320 :             instance = [0_IK, 3_IK]
    1178             : 
    1179         328 :             Array = ArrayTemplate
    1180          80 :             call report(getReplacedEnabled, iseq, instance = instance)
    1181          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array.", int(__LINE__, IK))
    1182             : 
    1183         252 :             Array = ArrayTemplate
    1184          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
    1185          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array with `sorted = .true.`.", int(__LINE__, IK))
    1186             : 
    1187         252 :             Array = ArrayTemplate
    1188          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
    1189          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array with `sorted = .false.`.", int(__LINE__, IK))
    1190             : 
    1191         252 :             Array = ArrayTemplate
    1192          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
    1193          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array with `unique = .true.`.", int(__LINE__, IK))
    1194             : 
    1195         252 :             Array = ArrayTemplate
    1196          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
    1197          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array with `unique = .false.`.", int(__LINE__, IK))
    1198             : 
    1199         252 :             Array = ArrayTemplate
    1200          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
    1201          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
    1202             : 
    1203         252 :             Array = ArrayTemplate
    1204          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
    1205          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
    1206             : 
    1207         252 :             Array = ArrayTemplate
    1208          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
    1209          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
    1210             : 
    1211         252 :             Array = ArrayTemplate
    1212          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
    1213          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a nonsensical array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
    1214             : 
    1215         400 :             instance = [1_IK, 2_IK, -1_IK]
    1216         356 :             ArrayNew_ref = Replacement
    1217             : 
    1218         252 :             Array = ArrayTemplate
    1219          80 :             call report(getReplacedEnabled, iseq, instance = instance)
    1220          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array.", int(__LINE__, IK))
    1221             : 
    1222         304 :             Array = ArrayTemplate
    1223          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK)
    1224          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array with `sorted = .true.`.", int(__LINE__, IK))
    1225             : 
    1226         304 :             Array = ArrayTemplate
    1227          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK)
    1228          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array with `sorted = .false.`.", int(__LINE__, IK))
    1229             : 
    1230         304 :             Array = ArrayTemplate
    1231          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .true._LK)
    1232          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array with `unique = .true.`.", int(__LINE__, IK))
    1233             : 
    1234         304 :             Array = ArrayTemplate
    1235          80 :             call report(getReplacedEnabled, iseq, instance = instance, unique = .false._LK)
    1236          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array with `unique = .false.`.", int(__LINE__, IK))
    1237             : 
    1238         304 :             Array = ArrayTemplate
    1239          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .true._LK)
    1240          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array with `sorted = .true._LK, unique = .true.`.", int(__LINE__, IK))
    1241             : 
    1242         304 :             Array = ArrayTemplate
    1243          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .true._LK)
    1244          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array with `sorted = .false._LK, unique = .true.`.", int(__LINE__, IK))
    1245             : 
    1246         304 :             Array = ArrayTemplate
    1247          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .true._LK, unique = .false._LK)
    1248          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array with `sorted = .true._LK, unique = .false.`.", int(__LINE__, IK))
    1249             : 
    1250         304 :             Array = ArrayTemplate
    1251          80 :             call report(getReplacedEnabled, iseq, instance = instance, sorted = .false._LK, unique = .false._LK)
    1252          80 :             call test%assert(assertion, PROCEDURE_NAME//SK_": An non-empty array that identical to the pattern with non-empty replacement, must result in the same array when `instance` is a mixed but sensible array with `sorted = .false._LK, unique = .false.`.", int(__LINE__, IK))
    1253             : 
    1254             :             !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1255             : 
    1256             : #else
    1257             :             !%%%%%%%%%%%%%%%%%%%%%%%%
    1258             : #error      "Unrecognized interface."
    1259             :             !%%%%%%%%%%%%%%%%%%%%%%%%
    1260             : #endif
    1261             : 
    1262         308 :         end subroutine
    1263             : 
    1264             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1265             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1266             : 
    1267       56960 :         subroutine report(getReplacedEnabled, iseq, instance, sorted, unique)
    1268             :             logical(LK) , intent(in)                        :: getReplacedEnabled
    1269             :             logical(LK) , external  , optional              :: iseq
    1270             :             integer(IK) , intent(in), optional, contiguous  :: instance(:)
    1271             :             logical(LK) , intent(in), optional              :: sorted
    1272             :             logical(LK) , intent(in), optional              :: unique
    1273             :             !write(*,"(*(g0,:,', '))") "Array", Array
    1274             :             !write(*,"(*(g0,:,', '))") "pattern", pattern
    1275             :             !write(*,"(*(g0,:,', '))") "Replacement", Replacement
    1276             :             !write(*,"(*(g0,:,', '))") "present(iseq)", present(iseq)
    1277             :             !if (present(instance)) write(*,"(*(g0,:,', '))") "instance", instance
    1278             :             !if (present(sorted)) write(*,"(*(g0,:,', '))") "sorted", sorted
    1279             :             !if (present(unique)) write(*,"(*(g0,:,', '))") "unique", unique
    1280       56960 :             if (present(iseq) .and. present(instance)) then
    1281             : #if             getReplaced_D1_D0_D0_ENABLED || getReplaced_D1_D0_D1_ENABLED || getReplaced_D1_D1_D0_ENABLED || \
    1282             :                 setReplaced_D1_D0_D0_ENABLED || setReplaced_D1_D0_D1_ENABLED || setReplaced_D1_D1_D0_ENABLED
    1283      295663 :                 ArrayNew_ref = getReplaced(Array, [pattern], [Replacement], iseqVec, instance, sorted, unique)
    1284             : #endif
    1285       25800 :                 if (getReplacedEnabled) then
    1286      186330 :                     Array = getReplaced(Array, pattern, Replacement, iseq, instance, sorted, unique)
    1287             :                 else
    1288       12900 :                     call setReplaced(Array, pattern, Replacement, iseq, instance, sorted, unique)
    1289             :                 end if
    1290             : 
    1291       31160 :             elseif (present(iseq) .and. .not. present(instance)) then
    1292             : #if             getReplaced_D1_D0_D0_ENABLED || getReplaced_D1_D0_D1_ENABLED || getReplaced_D1_D1_D0_ENABLED || \
    1293             :                 setReplaced_D1_D0_D0_ENABLED || setReplaced_D1_D0_D1_ENABLED || setReplaced_D1_D1_D0_ENABLED
    1294       36018 :                 ArrayNew_ref = getReplaced(Array, [pattern], [Replacement], iseqVec)
    1295             : #endif
    1296        2680 :                 if (getReplacedEnabled) then
    1297       22606 :                     Array = getReplaced(Array, pattern, Replacement, iseq)
    1298             :                 else
    1299        1340 :                     call setReplaced(Array, pattern, Replacement, iseq)
    1300             :                 end if
    1301       28480 :             elseif (.not. present(iseq) .and. present(instance)) then
    1302             : #if             getReplaced_D1_D0_D0_ENABLED || getReplaced_D1_D0_D1_ENABLED || getReplaced_D1_D1_D0_ENABLED || \
    1303             :                 setReplaced_D1_D0_D0_ENABLED || setReplaced_D1_D0_D1_ENABLED || setReplaced_D1_D1_D0_ENABLED
    1304      292174 :                 ArrayNew_ref = getReplaced(Array, [pattern], [Replacement], instance, sorted, unique)
    1305             : #endif
    1306       25800 :                 if (getReplacedEnabled) then
    1307      180574 :                     Array = getReplaced(Array, pattern, Replacement, instance, sorted, unique)
    1308             :                 else
    1309       12900 :                     call setReplaced(Array, pattern, Replacement, instance, sorted, unique)
    1310             :                 end if
    1311             :             else
    1312             : #if             getReplaced_D1_D0_D0_ENABLED || getReplaced_D1_D0_D1_ENABLED || getReplaced_D1_D1_D0_ENABLED || \
    1313             :                 setReplaced_D1_D0_D0_ENABLED || setReplaced_D1_D0_D1_ENABLED || setReplaced_D1_D1_D0_ENABLED
    1314       35587 :                 ArrayNew_ref = getReplaced(Array, [pattern], [Replacement])
    1315             : #endif
    1316        2680 :                 if (getReplacedEnabled) then
    1317       22024 :                     Array = getReplaced(Array, pattern, Replacement)
    1318             :                 else
    1319        1340 :                     call setReplaced(Array, pattern, Replacement)
    1320             :                 end if
    1321             :             end if
    1322             : 
    1323       56960 :             assertion = assertion .and. GET_SIZE(Array, kind = IK) == GET_SIZE(ArrayNew_ref, kind = IK)
    1324       62320 :             call setOutput(getReplacedEnabled, iseq, instance, sorted, unique)
    1325       56960 :             call test%assert(assertion, PROCEDURE_NAME//SK_": The length of the output array must match the length of the reference array.", int(__LINE__, IK))
    1326             : 
    1327      408934 :             assertion = assertion .and. ALL(Array IS_EQUAL ArrayNew_ref)
    1328       62320 :             call setOutput(getReplacedEnabled, iseq, instance, sorted, unique)
    1329             : 
    1330       56960 :         end subroutine
    1331             : 
    1332             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1333             : 
    1334      113920 :         subroutine setOutput(getReplacedEnabled, iseq, instance, sorted, unique)
    1335             :             logical(LK) , intent(in)                        :: getReplacedEnabled
    1336             :             logical(LK) , external  , optional              :: iseq
    1337             :             integer(IK) , intent(in), optional, contiguous  :: instance(:)
    1338             :             logical(LK) , intent(in), optional              :: sorted
    1339             :             logical(LK) , intent(in), optional              :: unique
    1340      113920 :             if (test%traceable .and. .not. assertion) then
    1341             :                 ! LCOV_EXCL_START
    1342             :                 write(test%disp%unit,"(*(g0,:,', '))")
    1343             :                 write(test%disp%unit,"(*(g0,:,', '))") "Array              ", Array
    1344             :                 write(test%disp%unit,"(*(g0,:,', '))") "ArrayNew_ref       ", ArrayNew_ref
    1345             :                 write(test%disp%unit,"(*(g0,:,', '))") "ArrayTemplate      ", ArrayTemplate
    1346             :                 write(test%disp%unit,"(*(g0,:,', '))") "size(Array)        ", GET_SIZE(Array, kind = IK)
    1347             :                 write(test%disp%unit,"(*(g0,:,', '))") "size(ArrayNew_ref) ", GET_SIZE(ArrayNew_ref, kind = IK)
    1348             :                 write(test%disp%unit,"(*(g0,:,', '))") "size(ArrayTemplate)", GET_SIZE(ArrayTemplate, kind = IK)
    1349             :                 write(test%disp%unit,"(*(g0,:,', '))") "Replacement        ", Replacement
    1350             :                 write(test%disp%unit,"(*(g0,:,', '))") "pattern            ", pattern
    1351             :                 write(test%disp%unit,"(*(g0,:,', '))") "present(instance)  ", present(instance)
    1352             :                 write(test%disp%unit,"(*(g0,:,', '))") "present(unique)    ", present(unique)
    1353             :                 write(test%disp%unit,"(*(g0,:,', '))") "present(sorted)    ", present(sorted)
    1354             :                 write(test%disp%unit,"(*(g0,:,', '))") "present(iseq)      ", present(iseq)
    1355             :                 if (present(instance)) then
    1356             :                 write(test%disp%unit,"(*(g0,:,', '))") "instance           ", instance
    1357             :                 end if
    1358             :                 if (present(sorted)) then
    1359             :                 write(test%disp%unit,"(*(g0,:,', '))") "sorted             ", sorted
    1360             :                 end if
    1361             :                 if (present(unique)) then
    1362             :                 write(test%disp%unit,"(*(g0,:,', '))") "unique             ", unique
    1363             :                 end if
    1364             :                 if (present(instance)) then
    1365             :                 write(test%disp%unit,"(*(g0,:,', '))") "getReplacedEnabled ", getReplacedEnabled
    1366             :                 end if
    1367             :                 write(test%disp%unit,"(*(g0,:,', '))")
    1368             :                 ! LCOV_EXCL_STOP
    1369             :             end if
    1370      113920 :         end subroutine
    1371             : 
    1372             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1373             : 
    1374        3320 :         subroutine reset()
    1375             :             implicit none
    1376        3320 :             if (allocated(ArrayTemplate)) deallocate(ArrayTemplate)
    1377             : #if         getReplaced_D1_D1_D0_ENABLED || setReplaced_D1_D1_D0_ENABLED || \
    1378             :             getReplaced_D1_D1_D1_ENABLED || setReplaced_D1_D1_D1_ENABLED
    1379        1748 :             if (allocated(pattern)) deallocate(pattern)
    1380             : #endif
    1381             : #if         getReplaced_D1_D0_D1_ENABLED || setReplaced_D1_D0_D1_ENABLED || \
    1382             :             getReplaced_D1_D1_D1_ENABLED || setReplaced_D1_D1_D1_ENABLED
    1383        1748 :             if (allocated(Replacement)) deallocate(Replacement)
    1384             : #endif
    1385        3320 :             if (allocated(ArrayNew_ref)) deallocate(ArrayNew_ref)
    1386        3320 :             if (allocated(instance)) deallocate(instance)
    1387        3320 :         end subroutine
    1388             : 
    1389             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1390             : 
    1391             : #if     getReplaced_D0_D0_D0_ENABLED || setReplaced_D0_D0_D0_ENABLED
    1392        1188 :         function iseq(Segment, pattern) result(equivalent)
    1393             :             character(*,SKC), intent(in) :: pattern, Segment
    1394             :             logical(LK) :: equivalent
    1395        1188 :             equivalent = Segment == pattern
    1396        1188 :         end function
    1397             : #elif   getReplaced_D1_D0_D0_ENABLED || getReplaced_D1_D0_D1_ENABLED || \
    1398             :         setReplaced_D1_D0_D0_ENABLED || setReplaced_D1_D0_D1_ENABLED
    1399       79290 :         function iseq(Segment, pattern) result(equivalent)
    1400             : #if         getReplaced_D1_D0_D0_SK_ENABLED || getReplaced_D1_D0_D1_SK_ENABLED || \
    1401             :             setReplaced_D1_D0_D0_SK_ENABLED || setReplaced_D1_D0_D1_SK_ENABLED
    1402             :             character(*,SKC), intent(in)    :: Segment, pattern
    1403             : #elif       getReplaced_D1_D0_D0_IK_ENABLED || getReplaced_D1_D0_D1_IK_ENABLED || \
    1404             :             setReplaced_D1_D0_D0_IK_ENABLED || setReplaced_D1_D0_D1_IK_ENABLED
    1405             :             integer(IKC)    , intent(in)    :: Segment, pattern
    1406             : #elif       getReplaced_D1_D0_D0_LK_ENABLED || getReplaced_D1_D0_D1_LK_ENABLED || \
    1407             :             setReplaced_D1_D0_D0_LK_ENABLED || setReplaced_D1_D0_D1_LK_ENABLED
    1408             :             logical(LKC)    , intent(in)    :: Segment, pattern
    1409             : #elif       getReplaced_D1_D0_D0_CK_ENABLED || getReplaced_D1_D0_D1_CK_ENABLED || \
    1410             :             setReplaced_D1_D0_D0_CK_ENABLED || setReplaced_D1_D0_D1_CK_ENABLED
    1411             :             complex(CKC)    , intent(in)    :: Segment, pattern
    1412             : #elif       getReplaced_D1_D0_D0_RK_ENABLED || getReplaced_D1_D0_D1_RK_ENABLED || \
    1413             :             setReplaced_D1_D0_D0_RK_ENABLED || setReplaced_D1_D0_D1_RK_ENABLED
    1414             :             real(RKC)       , intent(in)    :: Segment, pattern
    1415             : #endif
    1416             :             logical(LK) :: equivalent
    1417       79290 :             equivalent = Segment IS_EQUAL pattern
    1418       79290 :         end function
    1419             : #elif   getReplaced_D1_D1_D0_ENABLED || getReplaced_D1_D1_D1_ENABLED || \
    1420             :         setReplaced_D1_D1_D0_ENABLED || setReplaced_D1_D1_D1_ENABLED
    1421       34766 :         function iseq(Segment, pattern, lenPattern) result(equivalent)
    1422             :             logical(LK)             :: equivalent
    1423             :             integer(IK), intent(in) :: lenPattern
    1424             : #if         getReplaced_D1_D1_D0_SK_ENABLED || getReplaced_D1_D1_D1_SK_ENABLED || \
    1425             :             setReplaced_D1_D1_D0_SK_ENABLED || setReplaced_D1_D1_D1_SK_ENABLED
    1426             :             character(*,SKC), intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1427             : #elif       getReplaced_D1_D1_D0_IK_ENABLED || getReplaced_D1_D1_D1_IK_ENABLED || \
    1428             :             setReplaced_D1_D1_D0_IK_ENABLED || setReplaced_D1_D1_D1_IK_ENABLED
    1429             :             integer(IKC)    , intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1430             : #elif       getReplaced_D1_D1_D0_LK_ENABLED || getReplaced_D1_D1_D1_LK_ENABLED || \
    1431             :             setReplaced_D1_D1_D0_LK_ENABLED || setReplaced_D1_D1_D1_LK_ENABLED
    1432             :             logical(LKC)    , intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1433             : #elif       getReplaced_D1_D1_D0_CK_ENABLED || getReplaced_D1_D1_D1_CK_ENABLED || \
    1434             :             setReplaced_D1_D1_D0_CK_ENABLED || setReplaced_D1_D1_D1_CK_ENABLED
    1435             :             complex(CKC)    , intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1436             : #elif       getReplaced_D1_D1_D0_RK_ENABLED || getReplaced_D1_D1_D1_RK_ENABLED || \
    1437             :             setReplaced_D1_D1_D0_RK_ENABLED || setReplaced_D1_D1_D1_RK_ENABLED
    1438             :             real(RKC)       , intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1439             : #endif
    1440       48925 :             equivalent = all(Segment IS_EQUAL pattern)
    1441       34766 :         end function
    1442             : #else
    1443             : #error  "Unrecognized interface."
    1444             : #endif
    1445             : 
    1446             : #if     getReplaced_D1_D0_D0_ENABLED || getReplaced_D1_D0_D1_ENABLED || getReplaced_D1_D1_D0_ENABLED || \
    1447             :         setReplaced_D1_D0_D0_ENABLED || setReplaced_D1_D0_D1_ENABLED || setReplaced_D1_D1_D0_ENABLED
    1448       91584 :         function iseqVec(Segment, pattern, lenPattern) result(equivalent)
    1449             :             logical(LK)             :: equivalent
    1450             :             integer(IK), intent(in) :: lenPattern
    1451             : #if         getReplaced_D1_D0_D0_SK_ENABLED || getReplaced_D1_D0_D1_SK_ENABLED || getReplaced_D1_D1_D0_SK_ENABLED || \
    1452             :             setReplaced_D1_D0_D0_SK_ENABLED || setReplaced_D1_D0_D1_SK_ENABLED || setReplaced_D1_D1_D0_SK_ENABLED
    1453             :             character(*,SKC), intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1454             : #elif       getReplaced_D1_D0_D0_IK_ENABLED || getReplaced_D1_D0_D1_IK_ENABLED || getReplaced_D1_D1_D0_IK_ENABLED || \
    1455             :             setReplaced_D1_D0_D0_IK_ENABLED || setReplaced_D1_D0_D1_IK_ENABLED || setReplaced_D1_D1_D0_IK_ENABLED
    1456             :             integer(IKC)    , intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1457             : #elif       getReplaced_D1_D0_D0_LK_ENABLED || getReplaced_D1_D0_D1_LK_ENABLED || getReplaced_D1_D1_D0_LK_ENABLED || \
    1458             :             setReplaced_D1_D0_D0_LK_ENABLED || setReplaced_D1_D0_D1_LK_ENABLED || setReplaced_D1_D1_D0_LK_ENABLED
    1459             :             logical(LKC)    , intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1460             : #elif       getReplaced_D1_D0_D0_CK_ENABLED || getReplaced_D1_D0_D1_CK_ENABLED || getReplaced_D1_D1_D0_CK_ENABLED || \
    1461             :             setReplaced_D1_D0_D0_CK_ENABLED || setReplaced_D1_D0_D1_CK_ENABLED || setReplaced_D1_D1_D0_CK_ENABLED
    1462             :             complex(CKC)    , intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1463             : #elif       getReplaced_D1_D0_D0_RK_ENABLED || getReplaced_D1_D0_D1_RK_ENABLED || getReplaced_D1_D1_D0_RK_ENABLED || \
    1464             :             setReplaced_D1_D0_D0_RK_ENABLED || setReplaced_D1_D0_D1_RK_ENABLED || setReplaced_D1_D1_D0_RK_ENABLED
    1465             :             real(RKC)       , intent(in)    :: Segment(lenPattern), pattern(lenPattern)
    1466             : #endif
    1467      115632 :             equivalent = all(Segment IS_EQUAL pattern)
    1468       91584 :         end function
    1469             : #endif
    1470             : 
    1471             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1472             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1473             : 
    1474             : #undef  IS_EQUAL
    1475             : #undef  GET_SIZE
    1476             : #undef  ALL

ParaMonte: Parallel Monte Carlo and Machine Learning Library 
The Computational Data Science Lab
© Copyright 2012 - 2024