I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 775188a3 authored by zzz's avatar zzz
Browse files

I2NP: Fix DI test

parent 21fe962a
No related branches found
No related tags found
No related merge requests found
...@@ -9,17 +9,39 @@ package net.i2p.data.i2np; ...@@ -9,17 +9,39 @@ package net.i2p.data.i2np;
*/ */
import net.i2p.data.DataFormatException; import net.i2p.data.DataFormatException;
import net.i2p.data.DataHelper;
import net.i2p.data.DataStructure; import net.i2p.data.DataStructure;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import net.i2p.data.StructureTest; import net.i2p.data.StructureTest;
import net.i2p.data.TunnelId; import net.i2p.data.TunnelId;
import org.junit.Test;
/** /**
* Test harness for loading / storing DeliveryInstructions objects * Test harness for loading / storing DeliveryInstructions objects
* *
* @author jrandom * @author jrandom
*/ */
public class DeliveryInstructionsTest extends StructureTest { public class DeliveryInstructionsTest extends StructureTest {
/**
* Override because DI doesn't support input/output streams any more
*/
@Override
@Test
public void testStructure() throws Exception{
DeliveryInstructions orig = (DeliveryInstructions) createDataStructure();
byte[] temp = new byte[100];
int len = orig.writeBytes(temp, 0);
DeliveryInstructions ds = (DeliveryInstructions) createStructureToRead();
ds.readBytes(temp, 0);
byte[] temp2 = new byte[100];
int len2 = ds.writeBytes(temp2, 0);
assert(len2 == len);
assert(DataHelper.eq(temp, 0, temp2, 0, len));
}
public DataStructure createDataStructure() throws DataFormatException { public DataStructure createDataStructure() throws DataFormatException {
DeliveryInstructions instructions = new DeliveryInstructions(); DeliveryInstructions instructions = new DeliveryInstructions();
//instructions.setDelayRequested(true); //instructions.setDelayRequested(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment