Permalink
Browse files

Add LooseGrammar, improved but slow tests.

  • Loading branch information...
1 parent f7b55cd commit 2770655cecb30dc0fba866b26e15c2c97ce74bce @colomon committed Oct 6, 2012
Showing with 26 additions and 6 deletions.
  1. +6 −2 Makefile
  2. +1 −1 bin/step-scan.pl
  3. +5 −1 lib/ISO_10303_21/Grammar.pm
  4. +14 −2 t/04-read-files.t
View
@@ -1,8 +1,12 @@
+HOME=/Users/colomon
+RAKUDO=$(HOME)/tools/rakudo/perl6
+NIECZA=mono $(HOME)/tools/niecza/run/Niecza.exe
+
test: rakudo-test niecza-test
rakudo-test:
- prove -e "/home/colomon/tools/rakudo/perl6 -Ilib" --verbose t/
+ prove -e "$(RAKUDO) -Ilib" --verbose t/
niecza-test:
- prove -e "mono /home/colomon/tools/niecza/run/Niecza.exe -Ilib" --verbose t/
+ prove -e "$(NIECZA) -Ilib" --verbose t/
View
@@ -5,7 +5,7 @@
say "Reading $file";
my $file-data = slurp($file);
$file-data .= subst(/"/*" .*? "*/"/, " ", :global);
- my $match = ISO_10303_21::Grammar.parse($file-data, :rule<exchange_file>);
+ my $match = ISO_10303_21::LooseGrammar.parse($file-data, :rule<exchange_file>);
if $match ~~ Match && $match {
say " read correctly!";
} else {
@@ -77,4 +77,8 @@ grammar ISO_10303_21::Grammar
<header_section> <data_section>+
"END-ISO-10303-21;"
}
-}
+}
+
+grammar ISO_10303_21::LooseGrammar is ISO_10303_21::Grammar {
+ token non_q_char { <special> | <digit> | <space> | <lower> | <upper> | \v }
+}
View
@@ -2,8 +2,8 @@ use v6;
use Test;
use ISO_10303_21::Grammar;
-# my @files = <t/CAx/conrod.stp>;
-my @files = qx[find /Users/colomon/Harmonyware/CAD_Files/samples/CAx -iname "*.s*p" -print].lines;
+my @files = qx[find t/CAx -iname "*.s*p" -print].lines;
+@files .= grep(none /boot.stp/, /clamp.stp/, /"s1-ug-203.stp"/);
for @files -> $file {
say "Reading $file";
@@ -14,4 +14,16 @@ for @files -> $file {
ok $match, "<exchange_file> matches $file - 2";
}
+@files .= pick(3);
+@files.push('t/CAx/boot.stp', 't/CAx/clamp.stp', 't/CAx/s1-ug-203.stp');
+
+for @files -> $file {
+ say "Reading $file";
+ my $file-data = slurp($file);
+ $file-data .= subst(/"/*" .*? "*/"/, " ", :global);
+ my $match = ISO_10303_21::LooseGrammar.parse($file-data, :rule<exchange_file>);
+ isa_ok $match, Match, "<exchange_file> matches $file - 1";
+ ok $match, "<exchange_file> matches $file - 2";
+}
+
done;

0 comments on commit 2770655

Please sign in to comment.