Test our streamable tuple changes.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5558 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -28,6 +28,8 @@ import java.io.IOException;
|
|||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import com.threerings.util.StreamableTuple;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the {@link Streamable} class.
|
* Tests the {@link Streamable} class.
|
||||||
*/
|
*/
|
||||||
@@ -116,18 +118,17 @@ public class StreamableTest extends TestCase
|
|||||||
oout.writeObject(w);
|
oout.writeObject(w);
|
||||||
w.string1 = "three";
|
w.string1 = "three";
|
||||||
oout.writeObject(w);
|
oout.writeObject(w);
|
||||||
|
oout.writeObject(StreamableTuple.newTuple("left", "right"));
|
||||||
|
|
||||||
byte[] data = bout.toByteArray();
|
byte[] data = bout.toByteArray();
|
||||||
// System.out.println(data.length + " bytes were written.");
|
// System.out.println(data.length + " bytes were written.");
|
||||||
|
|
||||||
ByteArrayInputStream bin = new ByteArrayInputStream(data);
|
ByteArrayInputStream bin = new ByteArrayInputStream(data);
|
||||||
ObjectInputStream oin = new ObjectInputStream(bin);
|
ObjectInputStream oin = new ObjectInputStream(bin);
|
||||||
// System.out.println(oin.readObject());
|
readObject(oin); // widget
|
||||||
// System.out.println(oin.readObject());
|
readObject(oin); // modified widget
|
||||||
// System.out.println(oin.readObject());
|
readObject(oin); // again modified widget
|
||||||
oin.readObject();
|
readObject(oin); // streamable tuple
|
||||||
oin.readObject();
|
|
||||||
oin.readObject();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -135,6 +136,14 @@ public class StreamableTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Object readObject (ObjectInputStream oin)
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
Object object = oin.readObject();
|
||||||
|
System.out.println(object);
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
public static Test suite ()
|
public static Test suite ()
|
||||||
{
|
{
|
||||||
return new StreamableTest();
|
return new StreamableTest();
|
||||||
|
|||||||
Reference in New Issue
Block a user