Better splitting regexp for test_ordinals
[openssl.git] / test / recipes / 01-test_ordinals.t
index 3e28641813d67c548e6427c2cd1f77a97e83b54c..0a05d90d666f2817f28b509dfd1fa5c8a495d06f 100755 (executable)
@@ -73,28 +73,28 @@ sub testordinals
 
     open(my $fh, '<', $filename);
     while (my $line = <$fh>) {
-        my @tokens = split(/( |\t|:)+/, $line);
+        my @tokens = split(/(?:\s+|\s*:\s*)/, $line);
         #Check the line looks sane
-        if ($#tokens < 8 || $#tokens > 10) {
+        if ($#tokens < 4 || $#tokens > 5) {
             print STDERR "Invalid line:\n$line\n";
             $ret = 0;
             last;
         }
-        if ($tokens[4] eq "NOEXIST") {
+        if ($tokens[2] eq "NOEXIST") {
             #Ignore this line
             next;
         }
         #Some ordinals can be repeated, e.g. if one is VMS and another is !VMS
-        $newqual = $tokens[6];
+        $newqual = $tokens[3];
         $newqual =~ s/!//g;
-        if ($cnt > $tokens[2]
-                || ($cnt == $tokens[2] && ($qualifier ne $newqual
+        if ($cnt > $tokens[1]
+                || ($cnt == $tokens[1] && ($qualifier ne $newqual
                                            || $qualifier eq "FUNCTION"))) {
-            print STDERR "Invalid ordinal detected: ".$tokens[2]."\n";
+            print STDERR "Invalid ordinal detected: ".$tokens[1]."\n";
             $ret = 0;
             last;
         }
-        $cnt = $tokens[2];
+        $cnt = $tokens[1];
         $qualifier = $newqual;
         $lastfunc = $tokens[0];
     }