Skip to content

Commit

Permalink
Add LooseGrammar, improved but slow tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Oct 6, 2012
1 parent f7b55cd commit 2770655
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
8 changes: 6 additions & 2 deletions Makefile
@@ -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/

2 changes: 1 addition & 1 deletion bin/step-scan.pl
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion lib/ISO_10303_21/Grammar.pm
Expand Up @@ -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 }
}
16 changes: 14 additions & 2 deletions t/04-read-files.t
Expand Up @@ -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";
Expand All @@ -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.