You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/09/22 19:10:02 UTC
svn commit: r290987 -
/directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/ber/tlv/ValueTest.java
Author: elecharny
Date: Thu Sep 22 10:09:57 2005
New Revision: 290987
URL: http://svn.apache.org/viewcvs?rev=290987&view=rev
Log:
Added a test of Value GetNbBytes function.
Added:
directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/ber/tlv/ValueTest.java
Added: directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/ber/tlv/ValueTest.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/ber/tlv/ValueTest.java?rev=290987&view=auto
==============================================================================
--- directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/ber/tlv/ValueTest.java (added)
+++ directory/asn1/trunk/ber-new/src/test/org/apache/asn1new/ber/tlv/ValueTest.java Thu Sep 22 10:09:57 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.asn1new.ber.tlv;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * This class is used to test the Value class
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ValueTest extends TestCase {
+
+ /**
+ * Test the getNbBytes method
+ */
+ public void testValueGetNbBytes()
+ {
+ Assert.assertEquals(1, Value.getNbBytes(0));
+ Assert.assertEquals(1, Value.getNbBytes(1));
+ Assert.assertEquals(1, Value.getNbBytes(255));
+ Assert.assertEquals(2, Value.getNbBytes(256));
+ Assert.assertEquals(2, Value.getNbBytes(65535));
+ Assert.assertEquals(3, Value.getNbBytes(65536));
+ Assert.assertEquals(3, Value.getNbBytes(16777215));
+ Assert.assertEquals(4, Value.getNbBytes(16777216));
+ Assert.assertEquals(4, Value.getNbBytes(-1));
+ }
+}