23 package com.realtime.crossfire.jxclient.scripts;
27 import org.junit.Assert;
28 import org.junit.Ignore;
29 import org.junit.Test;
34 @SuppressWarnings(
"JavaDoc")
49 final Thread thread =
new Thread(process,
"ScriptProcess");
54 }
catch (
final InterruptedException ignored) {
64 Assert.assertEquals(
"""
65 readFromScript: request map pos
66 writeToScript: request map pos 0 0
67 readFromScript: @map_scroll 1 -1
68 readFromScript: request map pos
69 writeToScript: request map pos 1 -1
70 readFromScript: @map_scroll -2 3
71 readFromScript: request map pos
72 writeToScript: request map pos -1 2
73 readFromScript: @map_new
74 readFromScript: request map pos
75 writeToScript: request map pos 0 0
86 "", crossfireServerConnection);
88 final Thread thread =
new Thread(process,
"ScriptProcess");
93 }
catch (
final InterruptedException ignored) {
103 Assert.assertEquals(
"""
104 readFromScript: issue mark 123
108 Assert.assertEquals(
"mark 123\n", crossfireServerConnection.toString());
115 "issue lock 1 123\n"+
116 "", crossfireServerConnection);
118 final Thread thread =
new Thread(process,
"ScriptProcess");
123 }
catch (
final InterruptedException ignored) {
133 Assert.assertEquals(
"""
134 readFromScript: issue lock 1 123
138 Assert.assertEquals(
"lock true 123\n", crossfireServerConnection.toString());
141 @Ignore(
"player tag is not known")
147 "", crossfireServerConnection);
149 final Thread thread =
new Thread(process,
"ScriptProcess");
154 }
catch (
final InterruptedException ignored) {
164 Assert.assertEquals(
"""
165 readFromScript: issue take 123
169 Assert.assertEquals(
"move 123 0\n", crossfireServerConnection.toString());
172 @Ignore(
"player tag is not known")
177 "issue take 123 45\n"+
178 "", crossfireServerConnection);
180 final Thread thread =
new Thread(process,
"ScriptProcess");
185 }
catch (
final InterruptedException ignored) {
195 Assert.assertEquals(
"""
196 readFromScript: issue take 123 45
200 Assert.assertEquals(
"move 123 45\n", crossfireServerConnection.toString());
208 "", crossfireServerConnection);
210 final Thread thread =
new Thread(process,
"ScriptProcess");
215 }
catch (
final InterruptedException ignored) {
225 Assert.assertEquals(
"""
226 readFromScript: issue drop 123
230 Assert.assertEquals(
"move 0 123 0\n", crossfireServerConnection.toString());
237 "issue drop 123 45\n"+
238 "", crossfireServerConnection);
240 final Thread thread =
new Thread(process,
"ScriptProcess");
245 }
catch (
final InterruptedException ignored) {
255 Assert.assertEquals(
"""
256 readFromScript: issue drop 123 45
260 Assert.assertEquals(
"move 0 123 45\n", crossfireServerConnection.toString());
268 "", crossfireServerConnection);
270 final Thread thread =
new Thread(process,
"ScriptProcess");
275 }
catch (
final InterruptedException ignored) {
285 Assert.assertEquals(
"""
286 readFromScript: issue apply 123
290 Assert.assertEquals(
"apply 123\n", crossfireServerConnection.toString());
298 "", crossfireServerConnection);
300 final Thread thread =
new Thread(process,
"ScriptProcess");
305 }
catch (
final InterruptedException ignored) {
315 Assert.assertEquals(
"""
316 readFromScript: issue 3 0 north
320 Assert.assertEquals(
"ncom 3 north\n", crossfireServerConnection.toString());
328 "", crossfireServerConnection);
330 final Thread thread =
new Thread(process,
"ScriptProcess");
335 }
catch (
final InterruptedException ignored) {
345 Assert.assertEquals(
"""
346 readFromScript: issue xyz
350 Assert.assertEquals(
"raw xyz\n", crossfireServerConnection.toString());