From: Simon Strandgaard Date: 2004-04-27T22:06:10+09:00 Subject: Re: [ann] regexp engine 0.9 ts wrote: > >>>>> "S" == Simon Strandgaard writes: > S> Gained 0.66% more, so it now passes 96.66%. Version 0.8 only > S> passed 96.025 % of the rubicon tests (1560). > > Be carefull with this rubicon test. > > I can say you how it was build : I've retrieved tests from P languages, > RX, ... adapted for ruby and run it. > > Each time that I've found a difference, I've tried to see if I can call it > a bug or if it was just a different choice made by ruby. > > Because I was never able to say that it was a bug, I've adapted the test > to make ruby pass all its tests even if sometimes I was surprised by the > result :-)) Agree there is a bunch of oddities in the rubicon testdata. At the moment I have ~50 tests which is kind of odd. I don't intend to be 100% bug-per-bug compatible. Just want to be compatible with the good things in GNU. There is ~20 tests where GNU has some empty sub-captures, where I have chosen that these sub-captures actually should contain some text. At least these 20 will never pass ok, so the theoretical limit is (1560 - 20) / 1560 => 98.7% Besides Rubicon, I have my own blackbox tests.. 341 to be precise, these are somewhat more verbose than the rubicon tests. Furhter more I have some whitebox tests too. I use the original rubicon 'regexp.test' file, unmodified. In order to use it I must do heavy substitution, because I cannot overload $&, $1, $2... def make_result(registers, repl) s = repl.clone reg = registers reg.map!{|i| i || ""} reg.fill("", reg.size..12) s.gsub!(/([^\\])\\\#\{\$&\}/, '\1REG0') # hack to find slash prefixes s.gsub!(/([^\\])\\\#\{\$1\}/, '\1REG1') # hack to find slash prefixes s.gsub!(/\#\{\$&\}/, reg[0]) 1.upto(10){|i| s.gsub!(/#\{\$#{i}\}/, reg[i]) } s.gsub!(/\\\\/, '\\') s.gsub!(/REG0/, '#{$&}') # hack to replace slash prefixes s.gsub!(/REG1/, '#{$1}') # hack to replace slash prefixes s end Regexp as we all love it.. It works :-) BTW: thanks for the 1560 tests ;-) -- Simon Strandgaard