#!/usr/bin/ruby -w -d require "reg" require "regarray" require "reglogic" require "reghash" require "regvar" require "assert" require 'getoptlong' #require 'test/unit' class TC_Reg #< Test::Unit::TestCase class <:b), {:a=>:b} #=> true assert_ene Reg(:a=>:b), {:a=>:c} #=> false assert_ene Reg(:a=>:b), {} #=> false h={} h.default=:b assert_eee Reg(:a=>:b), h #=> true assert_eee Reg(/^(a|b)$/=>33), {"a"=>33} #=> true assert_eee Reg(/^(a|b)$/=>33), {"b"=>33} #=> true assert_ene Reg(/^(a|b)$/=>33), {"a"=>133} #=> false assert_ene Reg(/^(a|b)$/=>33), {"b"=>133} #=> false assert_ene Reg(/^(a|b)$/=>33), {"c"=>33} #=> false assert_eee Reg(/^(a|b)$/=>33), {"a"=>33,"b"=>33} #=> true assert_ene Reg(/^(a|b)$/=>33), {"a"=>33,"b"=>133} #=> false assert_ene Reg(/^(a|b)$/=>33), {"a"=>133,"b"=>33} #=> false assert_ene Reg(/^(a|b)$/=>33), {"a"=>133,"b"=>133} #=> false assert_eee Reg("a"=>33)|{"b"=>33}, {"a"=>33,"b"=>33} #=> true assert_eee Reg("a"=>33)|{"b"=>33}, {"a"=>33,"b"=>133} #=> true assert_ene Reg("a"=>33)|{"b"=>33}, {"a"=>133,"b"=>33} #=> false assert_ene Reg("a"=>33)|{"b"=>33}, {"a"=>133,"b"=>133} #=> false assert_eee Reg("a"=>33)|{"b"=>33}, {"b"=>33} #=> true assert_eee Reg(:a.reg|:b => 44), {:a => 44} #=> true assert_eee Reg(:a.reg|:b => 44), {:b => 44} #=> true assert_ene Reg(:a.reg|:b => 44), {:a => 144} #=> false assert_ene Reg(:a.reg|:b => 44), {:b => 144} #=> false print "\n" end def assert_eee(left,right,message='assert_eee failed') assert( left===right, message+" left=#{left.inspect} right=#{right.inspect}" ) print ".";$stdout.flush end def assert_ene(left,right,message='assert_ene failed') assert( !(left===right), message+" left=#{left.inspect} right=#{right.inspect}" ) print ",";$stdout.flush end end end srand;seed=srand opts=GetoptLong.new(["--seed", "-s", GetoptLong::REQUIRED_ARGUMENT]) opts.each{|opt,arg| opt=='--seed' or raise :impossible seed=arg } print "random seed is #{seed}\n" srand seed TC_Reg.test_reg