mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-30 22:49:17 +07:00
removed some unnecessary files
This commit is contained in:
5
core/test/gdx/diablo/net/GameLogonPacketTest.java
Normal file
5
core/test/gdx/diablo/net/GameLogonPacketTest.java
Normal file
@ -0,0 +1,5 @@
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class GameLogonPacketTest {
|
||||
|
||||
}
|
49
core/test/gdx/diablo/net/d2gs/WalkToEntityPacketTest.java
Normal file
49
core/test/gdx/diablo/net/d2gs/WalkToEntityPacketTest.java
Normal file
@ -0,0 +1,49 @@
|
||||
package gdx.diablo.net.d2gs;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import gdx.diablo.util.DebugUtils;
|
||||
|
||||
public class WalkToLocationPacketTest {
|
||||
private static final int X = 0xFF;
|
||||
private static final int Y = 0xFFFF;
|
||||
private static final byte[] BYTES = new byte[]{(byte) 0xFF, 0x00, (byte) 0xFF, (byte) 0xFF};
|
||||
|
||||
@Test
|
||||
public void encode() {
|
||||
WalkToLocationPacket packet = new WalkToLocationPacket() {{
|
||||
x = X;
|
||||
y = Y;
|
||||
}};
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(WalkToLocationPacket.SIZE);
|
||||
try {
|
||||
packet.encode(out);
|
||||
} catch (Throwable t) {
|
||||
System.err.println(t.getMessage());
|
||||
}
|
||||
|
||||
byte[] bytes = out.toByteArray();
|
||||
System.out.println(packet + " -> " + DebugUtils.toByteArray(bytes));
|
||||
Assert.assertArrayEquals(BYTES, bytes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void decode() {
|
||||
WalkToLocationPacket packet = new WalkToLocationPacket();
|
||||
try {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(BYTES);
|
||||
packet.decode(in);
|
||||
} catch (Throwable t) {
|
||||
System.out.println(t.getMessage());
|
||||
}
|
||||
|
||||
System.out.println(DebugUtils.toByteArray(BYTES) + " -> " + packet);
|
||||
Assert.assertEquals(X, packet.x);
|
||||
Assert.assertEquals(Y, packet.y);
|
||||
}
|
||||
}
|
46
core/test/gdx/diablo/net/d2gs/WalkToLocationPacketTest.java
Normal file
46
core/test/gdx/diablo/net/d2gs/WalkToLocationPacketTest.java
Normal file
@ -0,0 +1,46 @@
|
||||
package gdx.diablo.net.d2gs;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import gdx.diablo.util.DebugUtils;
|
||||
|
||||
public class MoveToLocationPacketTest {
|
||||
|
||||
@Test
|
||||
public void encode() {
|
||||
MoveToLocationPacket packet = new MoveToLocationPacket() {{
|
||||
x = 31;
|
||||
y = 63;
|
||||
}};
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(MoveToLocationPacket.SIZE);
|
||||
try {
|
||||
packet.encode(out);
|
||||
} catch (Throwable t) {
|
||||
System.err.println(t.getMessage());
|
||||
}
|
||||
|
||||
byte[] bytes = out.toByteArray();
|
||||
System.out.println(DebugUtils.toByteArray(bytes));
|
||||
Assert.assertArrayEquals(new byte[]{0x1F, 0x00, 0x3F, 0x00}, bytes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void decode() {
|
||||
MoveToLocationPacket packet = new MoveToLocationPacket();
|
||||
try {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(new byte[]{0x1F, 0x00, 0x3F, 0x00});
|
||||
packet.decode(in);
|
||||
} catch (Throwable t) {
|
||||
System.out.println(t.getMessage());
|
||||
}
|
||||
|
||||
System.out.println(packet);
|
||||
Assert.assertEquals(31, packet.x);
|
||||
Assert.assertEquals(63, packet.y);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user