@@ -19,7 +19,7 @@ pure function subject() result(specimen)
1919 specimen = " The csv format"
2020 end function
2121
22- pure function results () result(test_results)
22+ function results () result(test_results)
2323 type (test_result_t), allocatable :: test_results(:)
2424
2525 test_results = [ &
@@ -30,13 +30,31 @@ pure function results() result(test_results)
3030 ]
3131 end function
3232
33- pure function check_csv_reals () result(test_passes)
33+ function check_csv_reals () result(test_passes)
3434 logical test_passes
3535 character (len=* ), parameter :: expected_output = " 0.00000000,1.00000000,2.00000000"
3636 character (len= len (expected_output)) captured_output
3737
3838 write (captured_output, fmt = separated_values(separator= " ," , mold= [integer :: ])) [0 .,1 .,2 .]
39- test_passes = expected_output == captured_output
39+
40+ print * ," fmt = " ,separated_values(separator= " ," , mold= [integer :: ])
41+ print * ,captured_output
42+
43+ block
44+ character (len= :), allocatable :: substring
45+
46+ substring = adjustl (trim (captured_output))
47+ associate(leading_real_zero = > index (substring, " 0." )==1 )
48+ substring = adjustl (substring(index (substring, " ," )+ 1 :)) ! get remaining string after fierst comma
49+ associate(followed_by_real_one = > index (substring, " 1." )==1 )
50+ substring = adjustl (substring(index (substring, " ," )+ 1 :)) ! get remaining string after fierst comma
51+ associate(followed_by_real_two = > index (substring, " 2." )==1 )
52+ test_passes = leading_real_zero .and. followed_by_real_one .and. followed_by_real_two
53+ end associate
54+ end associate
55+ end associate
56+ end block
57+
4058 end function
4159
4260 pure function check_space_separated_complex () result(test_passes)
0 commit comments