@@ -153,23 +153,23 @@ program test_sorting
153
153
! test the sorting routines on the test arrays
154
154
ltest = .true.
155
155
156
- call test_int_ord_sorts( ldummy ); ltest = (ltest .and. ldummy)
156
+ call test_int_ord_sorts( ldummy ); ltest = (ltest .and. ldummy)
157
157
158
- call test_char_ord_sorts(ldummy ); ltest = (ltest .and. ldummy)
158
+ call test_char_ord_sorts(ldummy ); ltest = (ltest .and. ldummy)
159
159
160
- call test_string_ord_sorts( ldummy ); ltest = (ltest .and. ldummy)
160
+ call test_string_ord_sorts( ldummy ); ltest = (ltest .and. ldummy)
161
161
162
- call test_int_sorts( ldummy ); ltest = (ltest .and. ldummy)
162
+ call test_int_sorts( ldummy ); ltest = (ltest .and. ldummy)
163
163
164
- call test_char_sorts( ldummy ); ltest = (ltest .and. ldummy)
164
+ call test_char_sorts( ldummy ); ltest = (ltest .and. ldummy)
165
165
166
- call test_string_sorts( ldummy ); ltest = (ltest .and. ldummy)
166
+ call test_string_sorts( ldummy ); ltest = (ltest .and. ldummy)
167
167
168
- call test_int_sort_indexes( )
168
+ call test_int_sort_indexes( ldummy ); ltest = (ltest .and. ldummy )
169
169
170
- call test_char_sort_indexes( )
170
+ call test_char_sort_indexes( ldummy ); ltest = (ltest .and. ldummy )
171
171
172
- call test_string_sort_indexes( )
172
+ call test_string_sort_indexes( ldummy ); ltest = (ltest .and. ldummy )
173
173
174
174
175
175
call check(ltest)
@@ -207,7 +207,7 @@ end subroutine test_int_ord_sorts
207
207
208
208
subroutine test_int_ord_sort ( a , a_name , ltest )
209
209
integer (int32), intent (in ) :: a(:)
210
- character (* ), intent (in ) :: a_name
210
+ character (* ), intent (in ) :: a_name
211
211
logical , intent (out ) :: ltest
212
212
213
213
integer (int64) :: t0, t1, tdiff
@@ -397,7 +397,7 @@ subroutine test_string_ord_sort( a, a_name, ltest )
397
397
write (* ,' (a, 2(1x,a))' ) ' string_dummy(i-1:i) = ' , &
398
398
string_dummy(i-1 :i)
399
399
end if
400
-
400
+
401
401
string_dummy = a
402
402
call ord_sort( string_dummy, reverse = .true. )
403
403
@@ -546,7 +546,7 @@ subroutine test_char_sort( a, a_name, ltest )
546
546
write (* ,* ) ' i = ' , i
547
547
write (* ,' (a17, 2(1x,a4))' ) ' char_dummy(i-1:i) = ' , char_dummy(i-1 :i)
548
548
end if
549
-
549
+
550
550
end subroutine test_char_sort
551
551
552
552
subroutine test_string_sorts ( ltest )
@@ -614,29 +614,46 @@ subroutine test_string_sort( a, a_name, ltest )
614
614
615
615
end subroutine test_string_sort
616
616
617
- subroutine test_int_sort_indexes ( )
617
+ subroutine test_int_sort_indexes ( ltest )
618
+ logical , intent (out ) :: ltest
619
+
620
+ logical :: ldummy
618
621
619
- call test_int_sort_index( blocks, " Blocks" )
620
- call test_int_sort_index( decrease, " Decreasing" )
621
- call test_int_sort_index( identical, " Identical" )
622
- call test_int_sort_index( increase, " Increasing" )
623
- call test_int_sort_index( rand1, " Random dense" )
624
- call test_int_sort_index( rand2, " Random order" )
625
- call test_int_sort_index( rand0, " Random sparse" )
626
- call test_int_sort_index( rand3, " Random 3" )
627
- call test_int_sort_index( rand10, " Random 10" )
622
+ ltest = .true.
623
+
624
+ call test_int_sort_index( blocks, " Blocks" , ldummy )
625
+ ltest = (ltest .and. ldummy)
626
+ call test_int_sort_index( decrease, " Decreasing" , ldummy )
627
+ ltest = (ltest .and. ldummy)
628
+ call test_int_sort_index( identical, " Identical" , ldummy )
629
+ ltest = (ltest .and. ldummy)
630
+ call test_int_sort_index( increase, " Increasing" , ldummy )
631
+ ltest = (ltest .and. ldummy)
632
+ call test_int_sort_index( rand1, " Random dense" , ldummy )
633
+ ltest = (ltest .and. ldummy)
634
+ call test_int_sort_index( rand2, " Random order" , ldummy )
635
+ ltest = (ltest .and. ldummy)
636
+ call test_int_sort_index( rand0, " Random sparse" , ldummy )
637
+ ltest = (ltest .and. ldummy)
638
+ call test_int_sort_index( rand3, " Random 3" , ldummy )
639
+ ltest = (ltest .and. ldummy)
640
+ call test_int_sort_index( rand10, " Random 10" , ldummy )
641
+ ltest = (ltest .and. ldummy)
628
642
629
643
end subroutine test_int_sort_indexes
630
644
631
- subroutine test_int_sort_index ( a , a_name )
645
+ subroutine test_int_sort_index ( a , a_name , ltest )
632
646
integer (int32), intent (inout ) :: a(:)
633
647
character (* ), intent (in ) :: a_name
648
+ logical , intent (out ) :: ltest
634
649
635
650
integer (int64) :: t0, t1, tdiff
636
651
real (dp) :: rate
637
652
integer (int64) :: i
638
653
logical :: valid
639
654
655
+ ltest = .true.
656
+
640
657
tdiff = 0
641
658
do i = 1 , repeat
642
659
dummy = a
@@ -649,6 +666,7 @@ subroutine test_int_sort_index( a, a_name )
649
666
650
667
dummy = a(index)
651
668
call verify_sort( dummy, valid, i )
669
+ ltest = (ltest .and. valid)
652
670
if ( .not. valid ) then
653
671
write ( * , * ) " SORT_INDEX did not sort " // a_name // " ."
654
672
write (* ,* ) ' i = ' , i
@@ -662,6 +680,7 @@ subroutine test_int_sort_index( a, a_name )
662
680
call sort_index( dummy, index, work, iwork, reverse= .true. )
663
681
dummy = a(index)
664
682
call verify_reverse_sort( dummy, valid, i )
683
+ ltest = (ltest .and. valid)
665
684
if ( .not. valid ) then
666
685
write ( * , * ) " SORT_INDEX did not reverse sort " // &
667
686
a_name // " ."
@@ -671,23 +690,34 @@ subroutine test_int_sort_index( a, a_name )
671
690
672
691
end subroutine test_int_sort_index
673
692
674
- subroutine test_char_sort_indexes ( )
693
+ subroutine test_char_sort_indexes ( ltest )
694
+ logical , intent (out ) :: ltest
675
695
676
- call test_char_sort_index( char_decrease, " Char. Decrease" )
677
- call test_char_sort_index( char_increase, " Char. Increase" )
678
- call test_char_sort_index( char_rand, " Char. Random" )
696
+ logical :: ldummy
697
+
698
+ ltest = .true.
699
+
700
+ call test_char_sort_index( char_decrease, " Char. Decrease" , ldummy )
701
+ ltest = (ltest .and. ldummy)
702
+ call test_char_sort_index( char_increase, " Char. Increase" , ldummy )
703
+ ltest = (ltest .and. ldummy)
704
+ call test_char_sort_index( char_rand, " Char. Random" , ldummy )
705
+ ltest = (ltest .and. ldummy)
679
706
680
707
end subroutine test_char_sort_indexes
681
708
682
- subroutine test_char_sort_index ( a , a_name )
709
+ subroutine test_char_sort_index ( a , a_name , ltest )
683
710
character (len= 4 ), intent (in ) :: a(0 :)
684
711
character (* ), intent (in ) :: a_name
712
+ logical , intent (out ) :: ltest
685
713
686
714
integer (int64) :: t0, t1, tdiff
687
715
real (dp) :: rate
688
716
integer (int64) :: i
689
717
logical :: valid
690
718
719
+ ltest = .true.
720
+
691
721
tdiff = 0
692
722
do i = 1 , repeat
693
723
char_dummy = a
@@ -699,6 +729,7 @@ subroutine test_char_sort_index( a, a_name )
699
729
tdiff = tdiff/ repeat
700
730
701
731
call verify_char_sort( char_dummy, valid, i )
732
+ ltest = (ltest .and. valid)
702
733
if ( .not. valid ) then
703
734
write ( * , * ) " SORT_INDEX did not sort " // a_name // " ."
704
735
write (* ,* ) ' i = ' , i
@@ -710,23 +741,34 @@ subroutine test_char_sort_index( a, a_name )
710
741
711
742
end subroutine test_char_sort_index
712
743
713
- subroutine test_string_sort_indexes ( )
744
+ subroutine test_string_sort_indexes ( ltest )
745
+ logical , intent (out ) :: ltest
746
+
747
+ logical :: ldummy
714
748
715
- call test_string_sort_index( string_decrease, " String Decrease" )
716
- call test_string_sort_index( string_increase, " String Increase" )
717
- call test_string_sort_index( string_rand, " String Random" )
749
+ ltest = .true.
750
+
751
+ call test_string_sort_index( string_decrease, " String Decrease" , ldummy )
752
+ ltest = (ltest .and. ldummy)
753
+ call test_string_sort_index( string_increase, " String Increase" , ldummy )
754
+ ltest = (ltest .and. ldummy)
755
+ call test_string_sort_index( string_rand, " String Random" , ldummy )
756
+ ltest = (ltest .and. ldummy)
718
757
719
758
end subroutine test_string_sort_indexes
720
759
721
- subroutine test_string_sort_index ( a , a_name )
760
+ subroutine test_string_sort_index ( a , a_name , ltest )
722
761
type (string_type), intent (in ) :: a(0 :)
723
762
character (* ), intent (in ) :: a_name
763
+ logical , intent (out ) :: ltest
724
764
725
765
integer (int64) :: t0, t1, tdiff
726
766
real (dp) :: rate
727
767
integer (int64) :: i
728
768
logical :: valid
729
769
770
+ ltest = .true.
771
+
730
772
tdiff = 0
731
773
do i = 1 , repeat
732
774
string_dummy = a
@@ -738,6 +780,7 @@ subroutine test_string_sort_index( a, a_name )
738
780
tdiff = tdiff/ repeat
739
781
740
782
call verify_string_sort( string_dummy, valid, i )
783
+ ltest = (ltest .and. valid)
741
784
if ( .not. valid ) then
742
785
write ( * , * ) " SORT_INDEX did not sort " // a_name // " ."
743
786
write (* ,* ) ' i = ' , i
0 commit comments