[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r2901 - in freeway: . src src/org/gnu/freeway/cwrappers
From: |
mdonoughe |
Subject: |
[GNUnet-SVN] r2901 - in freeway: . src src/org/gnu/freeway/cwrappers |
Date: |
Fri, 26 May 2006 08:31:34 -0700 (PDT) |
Author: mdonoughe
Date: 2006-05-26 08:31:28 -0700 (Fri, 26 May 2006)
New Revision: 2901
Added:
freeway/src/org/gnu/freeway/cwrappers/CIntTest.java
Removed:
freeway/src/CIntTest.java
Modified:
freeway/.classpath
Log:
Destroyed the old CIntTest in favor of a new JUnit test.
Modified: freeway/.classpath
===================================================================
--- freeway/.classpath 2006-05-26 15:30:24 UTC (rev 2900)
+++ freeway/.classpath 2006-05-26 15:31:28 UTC (rev 2901)
@@ -3,7 +3,12 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="etc/support"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib"
path="/Users/svallee/Dev/Projects/freeway/lib/concurrent.jar"/>
- <classpathentry kind="lib"
path="/Users/svallee/Dev/Projects/freeway/lib/batik-all.jar"/>
+ <classpathentry kind="lib" path="lib/concurrent.jar"/>
+ <classpathentry kind="lib" path="lib/batik-all.jar"/>
+ <classpathentry kind="lib" path="lib/serializer.jar"/>
+ <classpathentry kind="lib" path="lib/xalan.jar"/>
+ <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
+ <classpathentry kind="lib" path="lib/xml-apis.jar"/>
+ <classpathentry
sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.1/src/org.junit_3.8.1/junitsrc.zip"
kind="var" path="JUNIT_HOME/junit.jar"/>
<classpathentry kind="output" path=".build"/>
</classpath>
Deleted: freeway/src/CIntTest.java
===================================================================
--- freeway/src/CIntTest.java 2006-05-26 15:30:24 UTC (rev 2900)
+++ freeway/src/CIntTest.java 2006-05-26 15:31:28 UTC (rev 2901)
@@ -1,21 +0,0 @@
-import org.gnu.freeway.cwrappers.CInt;
-
-public class CIntTest {
- public static void main(String[] args) {
- CInt test = new CInt(1234567890);
- test.deserializeFromByteArray(test.serializeToByteArray());
- System.out.println((Integer) (test.getObject()));
-
- test = new CInt(-1234567890);
- test.deserializeFromByteArray(test.serializeToByteArray());
- System.out.println((Integer) (test.getObject()));
-
- test = new CInt(987654321);
- test.deserializeFromByteArray(test.serializeToByteArray());
- System.out.println((Integer) (test.getObject()));
-
- test = new CInt(-987654321);
- test.deserializeFromByteArray(test.serializeToByteArray());
- System.out.println((Integer) (test.getObject()));
- }
-}
Added: freeway/src/org/gnu/freeway/cwrappers/CIntTest.java
===================================================================
--- freeway/src/org/gnu/freeway/cwrappers/CIntTest.java 2006-05-26 15:30:24 UTC
(rev 2900)
+++ freeway/src/org/gnu/freeway/cwrappers/CIntTest.java 2006-05-26 15:31:28 UTC
(rev 2901)
@@ -0,0 +1,62 @@
+ /*
+ This file is part of Freeway
+
+ Freeway is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ Freeway is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Freeway; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+
+package org.gnu.freeway.cwrappers;
+
+import junit.framework.TestCase;
+
+/**
+ * @file freeway/src/org/gnu/freeway/cwrappers/CIntTest.java
+ * @brief A JUnit test for CInt
+ * @author mdonoughe
+ */
+public class CIntTest extends TestCase {
+
+ /*
+ * Test method for
'org.gnu.freeway.cwrappers.CInt.serializeToByteArray()'
+ */
+ public void testSerializeToByteArray() {
+ CInt cInt = new CInt(0x075BCD15);
+ byte[] byteArray = cInt.serializeToByteArray();
+ assertTrue(byteArray[0] == 0x07 && byteArray[1] == 0x5B &&
byteArray[2] == -51 && byteArray[3] == 0x15);
+ cInt = new CInt(0xC521974F);
+ byteArray = cInt.serializeToByteArray();
+ assertTrue(byteArray[0] == -59 && byteArray[1] == 0x21 &&
byteArray[2] == -105 && byteArray[3] == 0x4F);
+ cInt = new CInt(0x9534D2B7);
+ byteArray = cInt.serializeToByteArray();
+ assertTrue(byteArray[0] == -107 && byteArray[1] == 0x34 &&
byteArray[2] == -46 && byteArray[3] == -73);
+ }
+
+ /*
+ * Test method for
'org.gnu.freeway.cwrappers.CInt.deserializeFromByteArray(byte[])'
+ */
+ public void testDeserializeFromByteArray() {
+ CInt cInt = new CInt(0);
+ byte[] byteArray1 = {0x7B, 0x2D, 0x43, 0x59};
+ cInt.deserializeFromByteArray(byteArray1);
+ assertTrue(cInt.getValue() == 0x7B2D4359);
+ byte[] byteArray2 = {-107, 0x34, -46, -73};
+ cInt.deserializeFromByteArray(byteArray2);
+ assertTrue(cInt.getValue() == 0x9534D2B7);
+ byte[] byteArray3 = {-59, 0x21, -105, 0x4F};
+ cInt.deserializeFromByteArray(byteArray3);
+ assertTrue(cInt.getValue() == 0xC521974F);
+ }
+
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r2901 - in freeway: . src src/org/gnu/freeway/cwrappers,
mdonoughe <=