@@ -2,6 +2,7 @@ module string_test_m
22 use sourcery_m, only : test_t, test_result_t, string_t
33 implicit none
44
5+
56 private
67 public :: string_test_t
78
@@ -24,7 +25,8 @@ function results() result(test_results)
2425 test_results = [ &
2526 test_result_t(" is_allocated() result .true. if & only if the string_t component(s) is/are allocated" , check_allocation()), &
2627 test_result_t(" extracting key string from colon-separated key/value pair" , extracts_key()), &
27- test_result_t(" extracting string value from colon-separated key/value pair" , extracts_string_scalar_value()) &
28+ test_result_t(" extracting string value from colon-separated key/value pair" , extracts_string_scalar_value()), &
29+ test_result_t(" extracting logical value from colon-separated key/value pair" , extracts_logical_scalar_value()) &
2830 ]
2931 end function
3032
@@ -54,4 +56,22 @@ function extracts_string_scalar_value() result(passed)
5456 end associate
5557 end function
5658
59+ function extracts_logical_scalar_value () result(passed)
60+ logical passed
61+
62+ associate( &
63+ key_true_pair = > string_t(' "yada yada" : true' ), &
64+ key_false_pair = > string_t(' "blah blah" : false' ), &
65+ trailing_comma = > string_t(' "trailing comma" : true,' ) &
66+ )
67+ associate( &
68+ true = > key_true_pair% get_json_value(key= string_t(" yada yada" ), mold= .true. ), &
69+ false = > key_false_pair% get_json_value(key= string_t(" blah blah" ), mold= .true. ), &
70+ true_too = > trailing_comma% get_json_value(key= string_t(" trailing comma" ), mold= .true. ) &
71+ )
72+ passed = true .and. true_too .and. .not. false
73+ end associate
74+ end associate
75+ end function
76+
5777end module string_test_m
0 commit comments