diff options
author | GOTOU Yuuzou <gotoyuzo@notwork.org> | 2003-07-03 19:01:09 +0000 |
---|---|---|
committer | GOTOU Yuuzou <gotoyuzo@notwork.org> | 2003-07-03 19:01:09 +0000 |
commit | fbd6fe51455d844abb0d12fbb11e72d24f28595c (patch) | |
tree | f3ff5d5762d4a5f41e4df47441094bf7a3d69593 | |
parent | 79145c311e446c0409ee7986d44f9994cd5c6566 (diff) | |
download | ruby-openssl-history-fbd6fe51455d844abb0d12fbb11e72d24f28595c.tar.gz |
*** empty log message ***
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ossl_x509name.c | 2 | ||||
-rwxr-xr-x | test/tc_x509name.rb | 20 |
3 files changed, 25 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Fri, 04 Jul 2003 04:00:13 +0900 -- GOTOU Yuuzou <gotoyuzo@notwork.org> + * ossl_x509name.c: use CLASS_OF() instead of TYPE(). + * test/tc_x509name.rb: add test_eql? + Thu, 03 Jul 2003 20:04:01 +0900 -- GOTOU Yuuzou <gotoyuzo@notwork.org> * examples/gen_cert.rb: added --type option. * examples/ossl_ocsp.rb: check the signature in the response. diff --git a/ossl_x509name.c b/ossl_x509name.c index deb68b5..eab3a5c 100644 --- a/ossl_x509name.c +++ b/ossl_x509name.c @@ -212,7 +212,7 @@ ossl_x509name_eql(VALUE self, VALUE other) { int result; - if(TYPE(other) != cX509Name) return Qfalse; + if(CLASS_OF(other) != cX509Name) return Qfalse; result = ossl_x509name_cmp0(self, other); return (result == 0) ? Qtrue : Qfalse; diff --git a/test/tc_x509name.rb b/test/tc_x509name.rb index 7ef98c0..e45619c 100755 --- a/test/tc_x509name.rb +++ b/test/tc_x509name.rb @@ -43,6 +43,26 @@ class TC_Name < Test::Unit::TestCase assert_equal(s, name.to_s, "to_s") assert_equal(a, name.to_a, "to_a") end + + def test_eql? + a1 = [["C", "JP"], ["O","NotworkOrg"], ["CN", "gotoyuzo"]] + a2 = [["C", "JP"], ["O","NotworkOrg"], ["CN", "gotoyuzo"]] + a3 = [["C", "JP"], ["O","NotworkOrg"], ["CN", "nahi"]] + nm1 = Name.new(a1) + nm2 = Name.new(a2) + nm3 = Name.new(a3) + cert = Certificate.new # T_DATA object + assert_equal(true, nm1.eql?(nm2)) + assert_equal(false, nm1.eql?(nm3)) + assert_equal(false, nm1.eql?(1)) + assert_equal(false, nm1.eql?(cert)) + + hash = { nm1 => 1, nm3 => 2 } + assert_equal(1, hash[nm1]) + assert_equal(1, hash[nm2]) + assert_equal(2, hash[nm3]) + end + def test_cmp ## # TODO |