mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-02 04:13:44 +07:00
arc
This commit is contained in:
parent
beec1eeaba
commit
158d11d3ba
@ -10,4 +10,4 @@ kapt.include.compile.classpath=false
|
||||
kotlin.stdlib.default.dependency=false
|
||||
#needed for android compilation
|
||||
android.useAndroidX=true
|
||||
archash=1eae35c804b2dd46d6755f750867925f894f5818
|
||||
archash=4b1c4b4565f24298c9c5c7e9b40d94957d4aa226
|
||||
|
@ -20,7 +20,7 @@ import mindustry.io.SaveIO.*;
|
||||
import mindustry.maps.*;
|
||||
import mindustry.mod.*;
|
||||
import mindustry.mod.Mods.*;
|
||||
import mindustry.net.Net;
|
||||
import mindustry.net.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
@ -28,6 +28,7 @@ import org.junit.jupiter.api.*;
|
||||
import org.junit.jupiter.params.*;
|
||||
import org.junit.jupiter.params.provider.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@ -134,13 +135,32 @@ public class ApplicationTests{
|
||||
@NullSource
|
||||
@ValueSource(strings = {
|
||||
"asd asd asd asd asdagagasasjakbgeah;jwrej 23424234",
|
||||
"这个服务器可以用自己的语言说话"
|
||||
"这个服务器可以用自己的语言说话",
|
||||
"\uD83D\uDEA3"
|
||||
})
|
||||
void writeStringTest(String string){
|
||||
ByteBuffer buffer = ByteBuffer.allocate(500);
|
||||
TypeIO.writeString(buffer, string);
|
||||
buffer.position(0);
|
||||
assertEquals(TypeIO.readString(buffer), string);
|
||||
|
||||
ByteArrayOutputStream ba = new ByteArrayOutputStream();
|
||||
|
||||
TypeIO.writeString(new Writes(new DataOutputStream(ba)), string);
|
||||
assertEquals(TypeIO.readString(new Reads(new DataInputStream(new ByteArrayInputStream(ba.toByteArray())))), string);
|
||||
|
||||
SendChatMessageCallPacket pack = new SendChatMessageCallPacket();
|
||||
pack.message = string;
|
||||
|
||||
buffer.position(0);
|
||||
pack.write(new Writes(new ByteBufferOutput(buffer)));
|
||||
int len = buffer.position();
|
||||
buffer.position(0);
|
||||
pack.message = "INVALID";
|
||||
pack.read(new Reads(new ByteBufferInput(buffer)), len);
|
||||
pack.handled();
|
||||
|
||||
assertEquals(string, pack.message);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user