-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
267 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.fathzer.jchess.uci; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import com.fathzer.jchess.uci.util.InstrumentedUCI; | ||
import com.fathzer.jchess.uci.util.InstrumentedEngine; | ||
|
||
class UCITest { | ||
private static InstrumentedUCI uci; | ||
private static InstrumentedEngine engine; | ||
|
||
@BeforeAll | ||
static void init() { | ||
engine = new InstrumentedEngine(); | ||
uci = new InstrumentedUCI(engine); | ||
final Thread uciThread = new Thread(uci); | ||
uciThread.setDaemon(true); | ||
uciThread.start(); | ||
} | ||
|
||
@BeforeEach | ||
void clear() { | ||
uci.clear(); | ||
} | ||
|
||
@Test | ||
void test() { | ||
// assertFalse(uci.post("cjhjhl",500)); | ||
// assertFalse(uci.getDebug().isEmpty()); | ||
|
||
clear(); | ||
assertTrue(uci.post("position", 60000)); | ||
System.out.println(uci.getOutput()); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/test/java/com/fathzer/jchess/uci/util/InstrumentedEngine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.fathzer.jchess.uci.util; | ||
|
||
import com.fathzer.jchess.uci.Engine; | ||
import com.fathzer.jchess.uci.GoReply; | ||
import com.fathzer.jchess.uci.LongRunningTask; | ||
import com.fathzer.jchess.uci.UCIMove; | ||
import com.fathzer.jchess.uci.parameters.GoParameters; | ||
|
||
public class InstrumentedEngine implements Engine { | ||
|
||
@Override | ||
public String getId() { | ||
return "My Engine"; | ||
} | ||
|
||
@Override | ||
public void setStartPosition(String fen) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void move(UCIMove move) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public LongRunningTask<GoReply> go(GoParameters params) { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isPositionSet() { | ||
// TODO Auto-generated method stub | ||
return false; | ||
} | ||
|
||
} |
Oops, something went wrong.