@@ -29,7 +29,6 @@ function progress(id,x,total) {
2929// globals to count tests, errors and warnings
3030$ nrTests =0 ;
3131$ nrErrors =0 ;
32- $ nrWarnings =0 ;
3332
3433// test the alphabet conversion routines
3534function alphabet_tests ()
@@ -174,14 +173,14 @@ function test_encode_decode( $str, $y, $x, $localsolutions, $globalsolutions )
174173 $ GLOBALS ['nrErrors ' ]++;
175174 echo '*** ERROR *** decode( ' .$ str .') = ( ' .number_format ($ p ->lat ,14 ).' , ' .number_format ($ p ->lon ,14 ).') which is ' . number_format ($ dm *100 ,2 ).' cm away (> ' .($ maxerror *100 ).' cm) from ( ' . number_format ($ y ,14 ) . ', ' . number_format ($ x ,14 ) . ')<BR> ' ;
176175 }
177- else if ( $ GLOBALS [ ' nrWarnings ' ]< 20 ) {
176+ else {
178177 // see if decode encodes back to the same solution
179178 $ j = strpos ($ str ,' ' );
180179 if ($ j >0 ) $ territory =substr ($ str ,0 ,$ j ); else $ territory ="AAA " ;
181180
182- $ r3 = false ;
181+ $ r3 = '' ;
183182 $ r2 = encodeWithPrecision ( $ p ->lat ,$ p ->lon ,$ precision , $ territory );
184- $ n2 = count ($ r );
183+ $ n2 = count ($ r2 );
185184 $ found =0 ;
186185 for ($ i2 =0 ; $ i2 <$ n2 ; $ i2 ++) {
187186 if ($ r2 [$ i2 ]==$ str ) {
@@ -195,7 +194,7 @@ function test_encode_decode( $str, $y, $x, $localsolutions, $globalsolutions )
195194 if ($ parent >=0 ) {
196195 $ proper = substr ($ str ,strpos ($ str ," " ));
197196 $ r3 = encodeWithPrecision ( $ p ->lat ,$ p ->lon ,$ precision , $ parent );
198- $ n3 = count ($ r );
197+ $ n3 = count ($ r3 );
199198 for ($ i3 =0 ; $ i3 <$ n3 ; $ i3 ++) {
200199 $ r3proper = substr ($ r3 [$ i3 ],strpos ($ r3 [$ i3 ]," " ));
201200 if ($ r3proper ==$ proper ) {
@@ -206,12 +205,11 @@ function test_encode_decode( $str, $y, $x, $localsolutions, $globalsolutions )
206205 }
207206 }
208207 if (!$ found ) {
209- echo '*** WARNING *** decode( ' . $ str . ') = ( ' . number_format ($ p ->lat ,14 ) . ', ' . number_format ($ p ->lon ,14 ) . ', ' .$ territory .') does not re-encode from ( ' . number_format ($ y ,14 ) . ', ' . number_format ($ x ,14 ) . ')<BR> ' ;
210- printGeneratedMapcodes ($ r );
211- printGeneratedMapcodes ($ r2 );
212- if ($ r3 !==false ) printGeneratedMapcodes ($ r3 );
213- $ GLOBALS ['nrWarnings ' ]++;
214- if ($ GLOBALS ['nrWarnings ' ] == 20 ) echo "*** ERROR *** too many warnings<BR> " ;
208+ echo '*** ERROR *** decode( ' . $ str . ') = ( ' . number_format ($ p ->lat ,14 ) . ', ' . number_format ($ p ->lon ,14 ) . ', ' .$ territory .') does not re-encode from ( ' . number_format ($ y ,14 ) . ', ' . number_format ($ x ,14 ) . ')<BR> ' ;
209+ echo 'Globals: ' ; printGeneratedMapcodes ($ r );
210+ echo 'Decoded: ' ; printGeneratedMapcodes ($ r2 );
211+ echo 'Parents: ' ; printGeneratedMapcodes ($ r3 );
212+ $ GLOBALS ['nrErrors ' ]++;
215213 }
216214 }
217215 }
@@ -406,7 +404,8 @@ function test_corner_encodes()
406404 if ($ i >0 ) $ GLOBALS ['next_corner_to_test ' ] = $ i ;
407405 while (test_corner_encodes ()) ;
408406 }
409-
407+
408+ /**/
410409 echo '<HR>Done.<BR> ' ;
411410 echo ' Executed ' ,$ nrTests ,' tests, found ' , $ nrErrors ,' errors<P> ' ;
412411
0 commit comments