Created
February 10, 2012 02:42
-
-
Save soutaro/1785776 to your computer and use it in GitHub Desktop.
Test codes for unification
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
require "test_helper" | |
require "unifier_assertion" | |
class UnifierAssertionTest < ActiveSupport::TestCase | |
include UnifierAssertion | |
test "unifier" do | |
assert_equal({:"'a" => 1 }, | |
unify([[ | |
[1,2,3], | |
[:"'a",2,3] | |
]])) | |
assert_equal({:"'a" => "':b" }, | |
unify([[ | |
["':b",2,3], | |
[:"'a",2,3] | |
]])) | |
assert_equal({:"'a" => [1]}, | |
unify([ | |
[:"'a", [1]] | |
])) | |
assert_equal({:"'a" => [1], :"'b" => [1]}, | |
unify([ | |
[:"'a", [1]], | |
[:"'b", :"'a"]])) | |
assert_equal({:"'a" => Time.new(2011,1,1) }, | |
unify([[ | |
{ :created_at => :a, :updated_at => :"'a", }, | |
{ :created_at => Time.new(2011,1,1), :updated_at => Time.new(2011,1,1) }, | |
]])) | |
assert_nil(unify([[ | |
{ :created_at => :"'a", :updated_at => :"'a", }, | |
{ :created_at => Time.new(2011,1,1), :updated_at => Time.new(2011,1,2) }, | |
]])) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment