diff options
author | Florian Dold <florian.dold@gmail.com> | 2012-06-13 11:45:41 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2012-06-13 11:45:41 +0000 |
commit | dbb5a4f77d917398d13947128a69d3084f0fe967 (patch) | |
tree | c816cb82b73d90ef32a73b3956c960365e21e8b6 /test | |
parent | 91cfbd8806d90a548238e139dd448449e194d561 (diff) | |
download | gnunet-java-dbb5a4f77d917398d13947128a69d3084f0fe967.tar.gz gnunet-java-dbb5a4f77d917398d13947128a69d3084f0fe967.zip |
parser caching in construct now works again, implemented the new @FillWith syntax
Diffstat (limited to 'test')
-rw-r--r-- | test/org/gnunet/construct/ConstructTest.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/org/gnunet/construct/ConstructTest.java b/test/org/gnunet/construct/ConstructTest.java new file mode 100644 index 0000000..470df5e --- /dev/null +++ b/test/org/gnunet/construct/ConstructTest.java | |||
@@ -0,0 +1,30 @@ | |||
1 | package org.gnunet.construct; | ||
2 | |||
3 | import org.junit.Assert; | ||
4 | import org.junit.Test; | ||
5 | |||
6 | /** | ||
7 | * @author Florian Dold | ||
8 | */ | ||
9 | public class ConstructTest { | ||
10 | public static class ByteFillTestMessage implements Message { | ||
11 | @FrameSize | ||
12 | @UInt32 | ||
13 | public int frameSize; | ||
14 | @ByteFill | ||
15 | public byte[] bytes; | ||
16 | } | ||
17 | |||
18 | @Test | ||
19 | public void test_ByteFill() { | ||
20 | ByteFillTestMessage msg = new ByteFillTestMessage(); | ||
21 | msg.bytes = new byte[]{0,1,2,3}; | ||
22 | Construct.patch(msg); | ||
23 | byte[] bin = Construct.toBinary(msg); | ||
24 | |||
25 | ByteFillTestMessage msg_r = Construct.parseAs(bin, ByteFillTestMessage.class); | ||
26 | |||
27 | Assert.assertArrayEquals(new byte[]{0,1,2,3}, msg_r.bytes); | ||
28 | } | ||
29 | |||
30 | } | ||