directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r159206 - in directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1: ber/ ldap/codec/utils/DNUtilsTest.java ldap/codec/utils/LdapDNTest.java
Date Sun, 27 Mar 2005 23:06:17 GMT
Author: elecharny
Date: Sun Mar 27 15:06:17 2005
New Revision: 159206

URL: http://svn.apache.org/viewcvs?view=rev&rev=159206
Log:
Deleted tlv subdir

Removed:
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ber/
Modified:
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/DNUtilsTest.java
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/DNUtilsTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/DNUtilsTest.java?view=diff&r1=159205&r2=159206
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/DNUtilsTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/DNUtilsTest.java
Sun Mar 27 15:06:17 2005
@@ -24,18 +24,28 @@
 
 /**
  * Test the class DNUtils
+ * 
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  */
 public class DNUtilsTest extends TestCase
 {
     //~ Methods ------------------------------------------------------------------------------------
 
-    /**
+	private char[] getChars(String value)
+	{
+		char[] charArray = new char[value.length()];
+		
+		value.getChars(0, value.length(), charArray, 0);
+		return charArray;
+	}
+
+	/**
      * Test the DNUtils AreEquals method
      */
     public void testAreEqualsFull()
     {
         // Full compare
-        Assert.assertEquals( 6, DNUtils.areEquals( "azerty".getBytes(), 0, "azerty" ) );
+        Assert.assertEquals( 6, DNUtils.areEquals( getChars("azerty"), 0, "azerty" ) );
     }
 
     /**
@@ -44,7 +54,7 @@
     public void testAreEqualsDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, DNUtils.areEquals( "azerty".getBytes(), 0, "Azerty" ) );
+        Assert.assertEquals( -1, DNUtils.areEquals( getChars("azerty"), 0, "Azerty" ) );
     }
 
     /**
@@ -53,7 +63,7 @@
     public void testAreEqualsEmpty()
     {
         // Compare to an empty string
-        Assert.assertEquals( -1, DNUtils.areEquals( "azerty".getBytes(), 0, "" ) );
+        Assert.assertEquals( -1, DNUtils.areEquals( getChars("azerty"), 0, "" ) );
     }
 
     /**
@@ -62,7 +72,7 @@
     public void testAreEqualsFirstCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, DNUtils.areEquals( "azerty".getBytes(), 0, "Azerty" ) );
+        Assert.assertEquals( -1, DNUtils.areEquals( getChars("azerty"), 0, "Azerty" ) );
     }
     
     /**
@@ -71,7 +81,7 @@
     public void testAreEqualsMiddleCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, DNUtils.areEquals( "azerty".getBytes(), 0, "azeRty" ) );
+        Assert.assertEquals( -1, DNUtils.areEquals( getChars("azerty"), 0, "azeRty" ) );
     }
     
     /**
@@ -80,7 +90,7 @@
     public void testAreEqualsLastCharDiff()
     {
         // First character is !=
-        Assert.assertEquals( -1, DNUtils.areEquals( "azerty".getBytes(), 0, "azertY" ) );
+        Assert.assertEquals( -1, DNUtils.areEquals( getChars("azerty"), 0, "azertY" ) );
     }
     
     /**
@@ -89,12 +99,12 @@
     public void testAreEqualsCharByChar()
     {
         // Index must be incremented after each comparison
-        Assert.assertEquals( 1, DNUtils.areEquals( "azerty".getBytes(), 0, "a" ) );
-        Assert.assertEquals( 2, DNUtils.areEquals( "azerty".getBytes(), 1, "z" ) );
-        Assert.assertEquals( 3, DNUtils.areEquals( "azerty".getBytes(), 2, "e" ) );
-        Assert.assertEquals( 4, DNUtils.areEquals( "azerty".getBytes(), 3, "r" ) );
-        Assert.assertEquals( 5, DNUtils.areEquals( "azerty".getBytes(), 4, "t" ) );
-        Assert.assertEquals( 6, DNUtils.areEquals( "azerty".getBytes(), 5, "y" ) );
+        Assert.assertEquals( 1, DNUtils.areEquals( getChars("azerty"), 0, "a" ) );
+        Assert.assertEquals( 2, DNUtils.areEquals( getChars("azerty"), 1, "z" ) );
+        Assert.assertEquals( 3, DNUtils.areEquals( getChars("azerty"), 2, "e" ) );
+        Assert.assertEquals( 4, DNUtils.areEquals( getChars("azerty"), 3, "r" ) );
+        Assert.assertEquals( 5, DNUtils.areEquals( getChars("azerty"), 4, "t" ) );
+        Assert.assertEquals( 6, DNUtils.areEquals( getChars("azerty"), 5, "y" ) );
     }
 
     /**
@@ -103,7 +113,7 @@
     public void testAreEqualsTooShort()
     {
         // length too short
-        Assert.assertEquals( -1, DNUtils.areEquals( "azerty".getBytes(), 0, "azertyiop" )
);
+        Assert.assertEquals( -1, DNUtils.areEquals( getChars("azerty"), 0, "azertyiop" )
);
     }
 
     /**
@@ -112,7 +122,7 @@
     public void testAreEqualsTooShortMiddle()
     {
         // length too short
-        Assert.assertEquals( -1, DNUtils.areEquals( "azerty".getBytes(), 0, "ertyiop" ) );
+        Assert.assertEquals( -1, DNUtils.areEquals( getChars("azerty"), 0, "ertyiop" ) );
     }
 
     /**
@@ -121,7 +131,7 @@
     public void testAreEqualsLastChar()
     {
         // last character
-        Assert.assertEquals( 6, DNUtils.areEquals( "azerty".getBytes(), 5, "y" ) );
+        Assert.assertEquals( 6, DNUtils.areEquals( getChars("azerty"), 5, "y" ) );
     }
 
     /**
@@ -130,6 +140,6 @@
     public void testAreEqualsMiddle()
     {
         // In the middle
-        Assert.assertEquals( 4, DNUtils.areEquals( "azerty".getBytes(), 2, "er" ) );
+        Assert.assertEquals( 4, DNUtils.areEquals( getChars("azerty"), 2, "er" ) );
     }
 }

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java?view=diff&r1=159205&r2=159206
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/utils/LdapDNTest.java
Sun Mar 27 15:06:17 2005
@@ -25,6 +25,8 @@
 
 /**
  * Test the class DNUtils
+ * 
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  */
 public class LdapDNTest extends TestCase
 {



Mime
View raw message