-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add output regression check to "rake test" rake gen - generate .decode for every .rd file rake test - compare decode of .rd with .decode content
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
$:.push(File.join(File.dirname(__FILE__), '..', 'lib')) | ||
require 'ruida' | ||
|
||
# | ||
# generate test results in ../rd | ||
# | ||
task :gen do | ||
rd_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'rd')) | ||
Dir.open(rd_dir).each do |path| | ||
next unless path =~ /(.*)\.rd$/ | ||
name = $1 | ||
puts name | ||
inp = File.open(File.join(rd_dir,path), 'r') | ||
out = File.open(File.join(rd_dir,"#{name}.decode"), 'w+') | ||
inp.binmode | ||
out.binmode | ||
rd = Ruida::Data.new inp.read | ||
begin | ||
parser = Ruida::Parser.new rd | ||
parser.each do |c| | ||
out.puts c | ||
end | ||
rescue Exception => e | ||
STDERR.puts e | ||
end | ||
out.close | ||
inp.close | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters