aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2012-10-03 15:23:39 +0000
committerFlorian Dold <florian.dold@gmail.com>2012-10-03 15:23:39 +0000
commit83312e60b02b21e8d767bb2ecea9f08868f239be (patch)
tree72b80e38c6282ac92dcafe8916026b0b809a7c31 /test
parent7047adeda8921df36a3bd591ade4b211e8754c92 (diff)
downloadgnunet-java-83312e60b02b21e8d767bb2ecea9f08868f239be.tar.gz
gnunet-java-83312e60b02b21e8d767bb2ecea9f08868f239be.zip
added documentation for the voting protocol,
fixed some bugs detected by coverty, implemented most of the cryptographic primitives for voting
Diffstat (limited to 'test')
-rw-r--r--test/org/gnunet/construct/ConstructTest.java4
-rw-r--r--test/org/gnunet/construct/FixedSizeTest.java2
-rw-r--r--test/org/gnunet/construct/StringTuple.java8
-rw-r--r--test/org/gnunet/util/getopt/GetoptTest.java3
4 files changed, 12 insertions, 5 deletions
diff --git a/test/org/gnunet/construct/ConstructTest.java b/test/org/gnunet/construct/ConstructTest.java
index 8853b1d..ed6ac51 100644
--- a/test/org/gnunet/construct/ConstructTest.java
+++ b/test/org/gnunet/construct/ConstructTest.java
@@ -45,7 +45,7 @@ public class ConstructTest {
45 45
46 byte[] data = Construct.toBinary(im); 46 byte[] data = Construct.toBinary(im);
47 47
48 IntMessage im_new = Construct.parseAs(data, IntMessage.class); 48 Construct.parseAs(data, IntMessage.class);
49 49
50 Assert.assertEquals((1+2+4+8)*2, data.length); 50 Assert.assertEquals((1+2+4+8)*2, data.length);
51 Assert.assertEquals((1+2+4+8)*2, Construct.getStaticSize(im)); 51 Assert.assertEquals((1+2+4+8)*2, Construct.getStaticSize(im));
@@ -55,7 +55,7 @@ public class ConstructTest {
55 public void test_PrivateMemberMessage() { 55 public void test_PrivateMemberMessage() {
56 PrivateMemberMessage m1 = new PrivateMemberMessage(); 56 PrivateMemberMessage m1 = new PrivateMemberMessage();
57 byte[] data = Construct.toBinary(m1); 57 byte[] data = Construct.toBinary(m1);
58 PrivateMemberMessage m2 = Construct.parseAs(data, PrivateMemberMessage.class); 58 Construct.parseAs(data, PrivateMemberMessage.class);
59 } 59 }
60 60
61 61
diff --git a/test/org/gnunet/construct/FixedSizeTest.java b/test/org/gnunet/construct/FixedSizeTest.java
index 573e120..4439ad4 100644
--- a/test/org/gnunet/construct/FixedSizeTest.java
+++ b/test/org/gnunet/construct/FixedSizeTest.java
@@ -47,6 +47,6 @@ public class FixedSizeTest {
47 public void test_sizeMismatch() { 47 public void test_sizeMismatch() {
48 FixedSizeTestMessage m = new FixedSizeTestMessage(); 48 FixedSizeTestMessage m = new FixedSizeTestMessage();
49 m.msgs = new Msg[]{new Msg(1), new Msg(2)}; 49 m.msgs = new Msg[]{new Msg(1), new Msg(2)};
50 byte[] bytes = Construct.toBinary(m); 50 Construct.toBinary(m);
51 } 51 }
52} 52}
diff --git a/test/org/gnunet/construct/StringTuple.java b/test/org/gnunet/construct/StringTuple.java
index 085b7a9..1820ae1 100644
--- a/test/org/gnunet/construct/StringTuple.java
+++ b/test/org/gnunet/construct/StringTuple.java
@@ -1,5 +1,8 @@
1package org.gnunet.construct; 1package org.gnunet.construct;
2 2
3import com.google.common.base.Objects;
4import com.google.common.hash.HashCodes;
5
3/** 6/**
4* ... 7* ...
5* 8*
@@ -26,4 +29,9 @@ public class StringTuple implements Message {
26 StringTuple otherT = (StringTuple) other; 29 StringTuple otherT = (StringTuple) other;
27 return otherT.str1.equals(this.str1) && otherT.str2.equals(this.str2); 30 return otherT.str1.equals(this.str1) && otherT.str2.equals(this.str2);
28 } 31 }
32
33 @Override
34 public int hashCode() {
35 return Objects.hashCode(str1, str2);
36 }
29} 37}
diff --git a/test/org/gnunet/util/getopt/GetoptTest.java b/test/org/gnunet/util/getopt/GetoptTest.java
index e60757e..010c240 100644
--- a/test/org/gnunet/util/getopt/GetoptTest.java
+++ b/test/org/gnunet/util/getopt/GetoptTest.java
@@ -258,9 +258,8 @@ public class GetoptTest {
258 Target t = new Target(); 258 Target t = new Target();
259 Parser p = new Parser(t); 259 Parser p = new Parser(t);
260 260
261 String[] rest;
262 261
263 rest = p.parse(new String[]{"-w", "abc"}); 262 p.parse(new String[]{"-w", "abc"});
264 Assert.assertEquals(5, t.intVal); 263 Assert.assertEquals(5, t.intVal);
265 } 264 }
266 265