51 logical(
LK) :: assertion
53 assertion
= assertion
.and. getLocSpace(SK_
"")
== 0_IK
54 call test%assert(assertion,
MODULE_NAME//SK_
': The condition `getLocSpace(SK_"") == 0_IK` must hold.')
55 assertion
= assertion
.and. getLocSpace(SK_
" ")
== 1_IK
56 call test%assert(assertion,
MODULE_NAME//SK_
': The condition `getLocSpace(SK_" ") == 1_IK` must hold.')
57 assertion
= assertion
.and. getLocSpace(SK_
" paramonte")
== 1_IK
58 call test%assert(assertion,
MODULE_NAME//SK_
': The condition `getLocSpace(SK_" paramonte") == 1_IK` must hold.')
59 assertion
= assertion
.and. getLocSpace(SK_
"paramonte ")
== 10_IK
60 call test%assert(assertion,
MODULE_NAME//SK_
': The condition `getLocSpace(SK_"paramonte ") == 10_IK` must hold.')
61 assertion
= assertion
.and. getLocSpace(SK_
"paramonte")
== 0_IK
62 call test%assert(assertion,
MODULE_NAME//SK_
': The condition `getLocSpace(SK_"paramonte") == 0_IK` must hold.')
70 logical(
LK) :: assertion
74 if (
index(SK_
"0123456789",
achar(i,
kind = SK))
> 0)
then
77 assertion
= assertion
.and. .not. isCharDigit(
achar(i))
79 call test%assert(assertion,
MODULE_NAME//SK_
"isCharDigit() must correctly identify "//achar(i)
//SK_
" as a digit or a non-digit.")
81 assertion
= assertion
.and. all(
isCharDigit([SK_
"0", SK_
" ", SK_
"+", SK_
"."])
.eqv. [
.true._LK,
.false._LK,
.false._LK,
.false._LK])
82 call test%assert(assertion,
MODULE_NAME//SK_
'isCharDigit() must correctly identify [SK_"0", SK_" ", SK_"+", SK_"."] as digits or non-digits.')
90 logical(
LK) :: assertion
95 call test%assert(assertion,
MODULE_NAME//SK_
"isStrDigitAll() must correctly identify "//getStr(i)
//SK_
" as numeric.")
98 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrDigitAll() must correctly identify `0123` as numeric.")
100 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrDigitAll() must correctly identify `123.` as not numeric.")
102 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrDigitAll() must correctly identify `123 ` as not numeric.")
104 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrDigitAll() must correctly identify ` ` as not numeric.")
106 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrDigitAll() must correctly identify `-123` as not numeric.")
108 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrDigitAll() must correctly identify `` as not numeric.")
116 logical(
LK) :: assertion
118 assertion
= .true._LK
121 call test%assert(assertion,
MODULE_NAME//SK_
"isStrReal() must correctly identify """//IntSet(i)
%val
//SK_
""" as a real number.")
125 call test%assert(assertion,
MODULE_NAME//SK_
"isStrReal() must correctly identify """//RealSet(i)
%val
//SK_
""" as a real number.")
129 call test%assert(assertion,
MODULE_NAME//SK_
"isStrReal() must correctly identify """//NonRealSet(i)
%val
//SK_
""" as not a real number.")
138 logical(
LK) :: assertion
140 assertion
= .true._LK
143 call test%assert(assertion,
MODULE_NAME//SK_
"isStrInteger() must correctly identify """//IntSet(i)
%val
//SK_
""" as an integer number.")
147 call test%assert(assertion,
MODULE_NAME//SK_
"isStrInteger() must correctly identify """//NonIntSet(i)
%val
//SK_
""" as not an integer number.")
157 logical(
LK) :: assertion
159 assertion
= .true._LK
162 call test%assert(assertion,
MODULE_NAME//SK_
"isStrNumber() must correctly identify "//getStr(i)
//SK_
" as numeric.")
165 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify `0123` as a number.")
167 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify `123.` as a number.")
169 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify `123 ` as a number.")
171 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify ` 13 ` as a number.")
173 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify `-13 ` as a number.")
175 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify `-13.` as a number.")
177 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify `+13.` as a number.")
179 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify ` +3 ` as a number.")
181 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify ` +3 ` as a number.")
182 assertion
= assertion
.and. .not. isStrNumber(SK_
" ")
183 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify ` ` as not numeric.")
185 call test%assert(assertion,
MODULE_NAME//SK_
"@isStrNumber() must correctly identify `-123` as not numeric.")
191 logical(
LK) :: assertion
193 assertion
= .true._LK
196 call test%assert(assertion,
MODULE_NAME//SK_
': isCharLower() must properly recognize lower-case characters.')
203 logical(
LK) :: assertion
205 assertion
= .true._LK
208 call test%assert(assertion,
MODULE_NAME//SK_
': isCharUpper() must properly recognize upper-case characters.')
215 logical(
LK) :: assertion
217 assertion
= .true._LK
219 call test%assert(assertion,
MODULE_NAME//SK_
.not.': The condition ` isStrLowerAll(SK_"")` must hold.')
222 call test%assert(assertion,
MODULE_NAME//SK_
': isStrLowerAll() must properly recognize upper-case characters.')
225 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrLowerAll(SK_"paramonte")` must hold.')
226 assertion
= assertion
.and. .not. isStrLowerAll(SK_
"PARAMONTE ")
227 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrLowerAll(SK_"PARAMONTE ")` must not hold.')
228 assertion
= assertion
.and. .not. isStrLowerAll(SK_
"paramonte ")
229 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrLowerAll(SK_"paramonte ")` must not hold.')
230 assertion
= assertion
.and. .not. isStrLowerAll(SK_
"paraMONTE")
231 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrLowerAll(SK_"paraMONTE")` must not hold.')
232 assertion
= assertion
.and. .not. isStrLowerAll(SK_
"+paramonte1")
233 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrLowerAll(SK_"+paramonte1")` must not hold.')
234 assertion
= assertion
.and. .not. isStrLowerAll(SK_
"paramonte1")
235 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrLowerAll(SK_"paramonte1")` must not hold.')
241 logical(
LK) :: assertion
243 assertion
= .true._LK
245 call test%assert(assertion,
MODULE_NAME//SK_
.not.': The condition ` isStrUpperAll(SK_"")` must hold.')
248 call test%assert(assertion,
MODULE_NAME//SK_
': isStrUpperAll() must properly recognize upper-case characters.')
251 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrUpperAll(SK_"PARAMONTE")` must hold.')
252 assertion
= assertion
.and. .not. isStrUpperAll(SK_
"PARAMONTE ")
253 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrUpperAll(SK_"PARAMONTE ")` must not hold.')
254 assertion
= assertion
.and. .not. isStrUpperAll(SK_
"paramonte ")
255 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrUpperAll(SK_"paramonte ")` must not hold.')
256 assertion
= assertion
.and. .not. isStrUpperAll(SK_
"paraMONTE")
257 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrUpperAll(SK_"paraMONTE")` must not hold.')
258 assertion
= assertion
.and. .not. isStrUpperAll(SK_
"+PARAMONTE1")
259 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrUpperAll(SK_"+PARAMONTE1")` must not hold.')
260 assertion
= assertion
.and. .not. isStrUpperAll(SK_
"PARAMONTE1")
261 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrUpperAll(SK_"PARAMONTE1")` must not hold.')
267 logical(
LK) :: assertion
269 assertion
= .true._LK
271 call test%assert(assertion,
MODULE_NAME//SK_
.not.': The condition ` isStrAlphaNumAll(SK_"")` must hold.')
274 call test%assert(assertion,
MODULE_NAME//SK_
': isStrAlphaNumAll() must properly recognize upper-case characters.')
277 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlphaNumAll(SK_"paramonte")` must hold.')
279 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlphaNumAll(SK_"paramonte1")` must hold.')
281 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlphaNumAll(SK_"paraMONTE1")` must hold.')
283 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlphaNumAll(SK_"PARAMONTE")` must hold.')
285 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlphaNumAll(SK_"012345")` must hold.')
287 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlphaNumAll(SK_"PARAMONTE ")` must not hold.')
289 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlphaNumAll(SK_"paramonte+")` must not hold.')
291 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlphaNumAll(SK_" paraMONTE")` must not hold.')
297 logical(
LK) :: assertion
299 assertion
= .true._LK
300 assertion
= assertion
.and. .not. isStrAlpha(SK_
"")
301 call test%assert(assertion,
MODULE_NAME//SK_
.not.': The condition ` isStrAlpha(SK_"")` must hold.')
304 call test%assert(assertion,
MODULE_NAME//SK_
': isStrAlpha() must properly recognize upper-case characters.')
306 assertion
= assertion
.and. isStrAlpha(SK_
"paramonte")
307 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlpha(SK_"paramonte")` must hold.')
308 assertion
= assertion
.and. isStrAlpha(SK_
"PARAMONTE")
309 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlpha(SK_"PARAMONTE")` must hold.')
310 assertion
= assertion
.and. .not. isStrAlpha(SK_
"012345")
311 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlpha(SK_"012345")` must not hold.')
312 assertion
= assertion
.and. .not. isStrAlpha(SK_
"paramonte1")
313 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlpha(SK_"paramonte1")` must not hold.')
314 assertion
= assertion
.and. .not. isStrAlpha(SK_
"paraMONTE1")
315 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlpha(SK_"paraMONTE1")` must not hold.')
316 assertion
= assertion
.and. .not. isStrAlpha(SK_
"PARAMONTE ")
317 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlpha(SK_"PARAMONTE ")` must not hold.')
318 assertion
= assertion
.and. .not. isStrAlpha(SK_
"paramonte+")
319 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlpha(SK_"paramonte+")` must not hold.')
320 assertion
= assertion
.and. .not. isStrAlpha(SK_
" paraMONTE")
321 call test%assert(assertion,
MODULE_NAME//SK_
': `isStrAlpha(SK_" paraMONTE")` must not hold.')
328 logical(
LK) :: assertion
329 character(:,
SK),
allocatable :: string
330 character(:,
SK),
allocatable :: strout
331 assertion
= .true._LK
333 string
= SK_
" StringString !@#$"
335 assertion
= assertion
.and. strout
== SK_
" stringstring !@#$"
336 call test%assert(assertion,
MODULE_NAME//SK_
': `getStrLower(SK_"'//string
//'")` must yield correct answer.')
340 assertion
= assertion
.and. strout
== SK_
""
341 call test%assert(assertion,
MODULE_NAME//SK_
': `getStrLower(SK_"'//string
//'")` must yield correct answer.')
349 logical(
LK) :: assertion
350 character(:,
SK),
allocatable :: string
351 character(:,
SK),
allocatable :: strout
352 assertion
= .true._LK
354 string
= SK_
" StringString !@#$"
356 assertion
= assertion
.and. strout
== SK_
" STRINGSTRING !@#$"
357 call test%assert(assertion,
MODULE_NAME//SK_
': `getStrUpper(SK_"'//string
//'")` must yield correct answer.')
361 assertion
= assertion
.and. strout
== SK_
""
362 call test%assert(assertion,
MODULE_NAME//SK_
': `getStrUpper(SK_"'//string
//'")` must yield correct answer.')
370 logical(
LK) :: assertion
371 character(:,
SK),
allocatable :: string
372 assertion
= .true._LK
374 string
= SK_
" StringString !@#$"
376 assertion
= assertion
.and. string
== SK_
" stringstring !@#$"
377 call test%assert(assertion,
MODULE_NAME//SK_
': `setStrLower(SK_"'//string
//'")` must yield correct answer.')
381 assertion
= assertion
.and. string
== SK_
""
382 call test%assert(assertion,
MODULE_NAME//SK_
': `setStrLower(SK_"'//string
//'")` must yield correct answer.')
390 logical(
LK) :: assertion
391 character(:,
SK),
allocatable :: string
392 assertion
= .true._LK
394 string
= SK_
" StringString !@#$"
396 assertion
= assertion
.and. string
== SK_
" STRINGSTRING !@#$"
397 call test%assert(assertion,
MODULE_NAME//SK_
': `setStrUpper(SK_"'//string
//'")` must yield correct answer.')
401 assertion
= assertion
.and. string
== SK_
""
402 call test%assert(assertion,
MODULE_NAME//SK_
': `setStrUpper(SK_"'//string
//'")` must yield correct answer.')
466 logical(
LK) :: assertion
467 character(:,
SK),
allocatable :: cmplx
469 assertion
= .true._LK
473 call test%assert(assertion,
MODULE_NAME//SK_
"isStrComplex() must correctly identify """//cmplx
//SK_
""" as a complex number.")
476 call test%assert(assertion,
MODULE_NAME//SK_
"isStrComplex() must correctly identify """//cmplx
//SK_
""" as not a complex number.")
479 call test%assert(assertion,
MODULE_NAME//SK_
"isStrComplex() must correctly identify `""""` as not a complex number.")
480 assertion
= assertion
.and. .not. isStrComplex(SK_
"123")
481 call test%assert(assertion,
MODULE_NAME//SK_
"isStrComplex() must correctly identify `""123""` as not a complex number.")
482 assertion
= assertion
.and. .not. isStrComplex(SK_
"123.0")
483 call test%assert(assertion,
MODULE_NAME//SK_
"isStrComplex() must correctly identify `""123.0""` as not a complex number.")
484 assertion
= assertion
.and. .not. isStrComplex(SK_
"-.01e+5")
485 call test%assert(assertion,
MODULE_NAME//SK_
"isStrComplex() must correctly identify `""-.01e+5""` as not a complex number.")
494 character(
*,
SK),
intent(in),
optional :: lp, rp, sep
495 character(:,
SK),
allocatable :: lm, rm, lp_def, rp_def, sep_def, real, imag, cmplx
499 if (
present(lp)) lp_def
= lp
500 if (
present(rp)) rp_def
= rp
501 if (
present(sep)) sep_def
= sep
506 cmplx
= lm
//lp_def
//real
//sep_def
//imag
//rp_def
//rm
516 character(:,
SK),
allocatable :: cmplx
517 character(:,
SK),
allocatable :: lm, rm, real, imag
518 character(
1,
SK) :: lp, rp, sep
534 cmplx
= lm
//lp
//real
//sep
//imag
//rp
//rm
544 character(:,
SK),
allocatable :: real
559 character(:,
SK),
allocatable :: real
592 , strc(SK_
" -123 ")
&
600 , strc(SK_
"- 123 ")
&
601 , strc(SK_
" - 123 ")
&
602 , strc(SK_
" +1 23 ")
&
603 , strc(SK_
" +1 23 ")
&
604 , strc(SK_
" +123. ")
&
605 , strc(SK_
" +123.1 ")
&
607 , strc(SK_
"-423.1")
&
609 , strc(SK_
"+-3456")
&
615 , strc(SK_
" -.1d-12 ")
&
616 , strc(SK_
" -.1d-123987548756 ")
&
617 , strc(SK_
" 123.e1")
&
618 , strc(SK_
" 123.D1 ")
&
619 , strc(SK_
" 123.D-1")
&
620 , strc(SK_
" 123.D+1")
&
621 , strc(SK_
"-123.D+1 ")
&
622 , strc(SK_
"+123.D+1 ")
&
623 , strc(SK_
" +123.D+1")
&
624 , strc(SK_
" +123.e+12456 ")
&
625 , strc(SK_
" +123.E+12456 ")
&
626 , strc(SK_
" +123.d+12456 ")
&
627 , strc(SK_
" +123.D+12456 ")
&
628 , strc(SK_
" +.1e-12456 ")
&
629 , strc(SK_
" +.12456 ")
&
631 NonRealSet= [ strc(SK_
" -.1.d-123987548756 ")
&
636 , strc(SK_
" 123.+1")
&
637 , strc(SK_
" 123.D 1")
&
638 , strc(SK_
" 123.D +1")
&
639 , strc(SK_
" 123.D + 1")
&
640 , strc(SK_
" 123.D+ 1")
&
641 , strc(SK_
" 123. D+ 1")
&
642 , strc(SK_
" + 123.D+1")
&
643 , strc(SK_
" +123.D+-12456 ")
&
644 , strc(SK_
" +123.D+.12456 ")
&
645 , strc(SK_
" +.d+12456")
&
646 , strc(SK_
" -.1.d-123987548756 ")
&
647 , strc(SK_
" +.e-12456 ")
&
683 call test%summarize()
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
Return a uniform random scalar or contiguous array of arbitrary rank of randomly uniformly distribute...
Generate and return the location of the first occurrence of the whitespace character in the input str...
Generate and return the input string where the uppercase English alphabets are all converted to lower...
Generate and return the input string where the lowercase English alphabets are all converted to upper...
Generate and return .true. if the input character of length 1 is a digit as in DIGIT_VEC_SK.
Generate and return .true. if the input single character contains an lowercase English alphabet ALPHA...
Generate and return .true. if the input single character contains an uppercase English alphabet ALPHA...
Generate and return .true. if the input string is all alphanumeric, containing only digits or the Eng...
Generate and return a logical vector whose elements are .true. if and only if the corresponding chara...
Generate and return .true. if all characters of the input string collectively represent a complex num...
Generate and return .true. if all characters of the input string are numeric (digits as in DIGIT_VEC_...
Generate and return .true. if all characters of the input string collectively represent an integer.
Generate and return .true. if the input string contains only lowercase English alphabets ALPHA_LOWER_...
Generate and return .true. if the input string collectively represents an integer,...
Generate and return .true. if all characters of the input string collectively represent a real number...
Generate and return .true. if the input string contains only uppercase English alphabets ALPHA_UPPER_...
Replace all uppercase English alphabets in the input string with the corresponding lowercase English ...
Replace all lowercase English alphabets in the input string with the corresponding uppercase English ...
Generate and return the conversion of the input value to an output Fortran string,...
This module contains the derived types for generating allocatable containers of scalar,...
This module contains classes and procedures for computing various statistical quantities related to t...
character(*, SK), parameter MODULE_NAME
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
This module contains the uncommon and hardly representable ASCII characters as well as procedures for...
character(1, SK), dimension(*), parameter ALPHA_UPPER_VEC_SK
The constant array of type character of default kind SK containing the uppercase English letters.
character(1, SK), dimension(*), parameter ALPHA_LOWER_VEC_SK
The constant array of type character of default kind SK containing the lowercase English letters.
character(1, SK), dimension(*), parameter ALPHA_VEC_SK
The constant array of type character of default kind SK containing the ASCII uppercase and lowercase ...
character(*, SK), parameter MODULE_NAME
character(1, SK), dimension(*), parameter ALPHANUM_VEC_SK
The constant array of type character of default kind SK containing the English numbers and alphabets.
This module contains a simple unit-testing framework for the Fortran libraries, including the ParaMon...
This module contains the generic procedures for converting values of different types and kinds to For...
This module contains tests of the module pm_strASCII.
logical(LK) function test_isStrInteger_1()
type(strc), dimension(:), allocatable NonRealSet
logical(LK) function test_isStrComplex_1()
type(strc), dimension(:), allocatable RealSet
logical(LK) function test_setStrLower_1()
logical(LK) function test_isCharDigit_1()
logical(LK) function test_getStrLower_1()
character(:, SK) function, allocatable getNonRealStr()
This is a helper function for generating invalid real values in string format, used to verify the fun...
logical(LK) function test_getStrUpper_1()
character(:, SK) function, allocatable getNonComplexStr()
This is a helper function for generating invalid complex values in string format, used to verify the ...
character(:, SK) function, allocatable getComplexStr(lp, rp, sep)
This is a helper function for generating valid complex values in string format, used to verify the fu...
type(strc), dimension(:), allocatable IntSet
subroutine setData()
Define the global testing data.
logical(LK) function test_isStrReal_1()
logical(LK) function test_getLocSpace_1()
logical(LK) function test_isStrNumber_1()
logical(LK) function test_isStrUpperAll_1()
logical(LK) function test_isStrLowerAll_1()
logical(LK) function test_setStrUpper_1()
logical(LK) function test_isCharUpper_1()
logical(LK) function test_isStrAlphaNumAll_1()
character(:, SK) function, allocatable getRealStr()
This is a helper function for generating valid real values in string format, used to verify the funct...
logical(LK) function test_isStrDigitAll_1()
logical(LK) function test_isStrAlpha_1()
type(strc), dimension(:), allocatable NonIntSet
logical(LK) function test_isCharLower_1()
This is the css_pdt parameterized type for generating instances of container of scalar of string obje...
This is the derived type test_type for generating objects that facilitate testing of a series of proc...