aboutsummaryrefslogtreecommitdiffstats
path: root/test/jake2/qcommon/TestMSG.java
diff options
context:
space:
mode:
authorHolger Zickner <[email protected]>2004-07-07 19:59:59 +0000
committerHolger Zickner <[email protected]>2004-07-07 19:59:59 +0000
commit6e23fc1074d1f0c2c2812f4c2e663f5a21a43c20 (patch)
tree46ecc6d0255c874ba4cd26dc3d0733f785019896 /test/jake2/qcommon/TestMSG.java
import of Jake2 version sunrisesunrise
Diffstat (limited to 'test/jake2/qcommon/TestMSG.java')
-rw-r--r--test/jake2/qcommon/TestMSG.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/jake2/qcommon/TestMSG.java b/test/jake2/qcommon/TestMSG.java
new file mode 100644
index 0000000..d6dee32
--- /dev/null
+++ b/test/jake2/qcommon/TestMSG.java
@@ -0,0 +1,66 @@
+/*
+ * Created on 30.01.2004
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code Template
+ */
+package jake2.qcommon;
+
+/**
+ * @author rst
+ */
+public class TestMSG extends MSG {
+ public static void main(String[] args) {
+
+ byte buf_data[] = new byte[MAX_MSGLEN];
+ sizebuf_t buf = new sizebuf_t();
+
+ SZ.Init(buf, buf_data, MAX_MSGLEN);
+
+ MSG.WriteInt(buf, 0x80000000);
+ MSG.WriteInt(buf, 0x12345678);
+ MSG.WriteInt(buf, 0x7fffffff);
+ MSG.WriteInt(buf, 0xffffffff);
+
+
+ MSG.WriteByte(buf, 1);
+ MSG.WriteByte(buf, 2);
+ MSG.WriteByte(buf, 3);
+ MSG.WriteByte(buf, 4);
+ SZ.Print(buf, "[einz]\n");
+ SZ.Print(buf, "[zwei]...");
+
+ MSG.WriteByte(buf, 0xfe);
+ MSG.WriteByte(buf, 4);
+
+ MSG.WriteShort(buf, 32766);
+ MSG.WriteShort(buf, 16384);
+ MSG.WriteShort(buf, -32768);
+
+
+
+ MSG.WriteFloat(buf, (float) Math.PI);
+
+ System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf)));
+ System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf)));
+ System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf)));
+ System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf)));
+
+ System.out.println("Read:" + MSG.ReadByte(buf));
+ System.out.println("Read:" + MSG.ReadByte(buf));
+ System.out.println("Read:" + MSG.ReadByte(buf));
+ System.out.println("Read:" + MSG.ReadByte(buf));
+ System.out.println("Read:<" + MSG.ReadString(buf) + ">");
+
+ System.out.println("Read:" + MSG.ReadByte(buf));
+ System.out.println("Read:" + MSG.ReadByte(buf));
+
+ System.out.println("Read:" + MSG.ReadShort(buf));
+ System.out.println("Read:" + MSG.ReadShort(buf));
+ System.out.println("Read:" + MSG.ReadShort(buf));
+
+
+ System.out.println("Read:" + MSG.ReadFloat(buf));
+ }
+
+}