aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGOTOU Yuuzou <gotoyuzo@notwork.org>2003-07-03 19:01:09 +0000
committerGOTOU Yuuzou <gotoyuzo@notwork.org>2003-07-03 19:01:09 +0000
commitb68cbcb6366a6f231613fdb6440795b530fd0361 (patch)
treef3ff5d5762d4a5f41e4df47441094bf7a3d69593
parent6abcebc1d131b538af0679f127cbd9e0404531ae (diff)
downloadruby-openssl-history-b68cbcb6366a6f231613fdb6440795b530fd0361.tar.gz
*** empty log message ***
-rw-r--r--ChangeLog4
-rw-r--r--ossl_x509name.c2
-rwxr-xr-xtest/tc_x509name.rb20
3 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 229a09a..14bb1de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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