rewrite: TS monorepo — pi SDK stateless agents, Postgres+pg-boss, SvelteKit themed UI; legacy moved to legacy/
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
from ai_chess.stockfish_engine import StockfishEngine
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
shutil.which("stockfish") is None,
|
||||
reason="stockfish not installed",
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_startpos_eval():
|
||||
eng = StockfishEngine()
|
||||
await eng.start()
|
||||
try:
|
||||
r = await eng.analyze("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", depth=6)
|
||||
assert r["best_uci"] is not None
|
||||
assert r["cp"] is not None or r["mate"] is not None
|
||||
finally:
|
||||
await eng.stop()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_mate_eval():
|
||||
eng = StockfishEngine()
|
||||
await eng.start()
|
||||
try:
|
||||
# Mate in 1: white to move, Qh5#-style position
|
||||
r = await eng.analyze("4k3/8/8/8/8/8/4Q3/4K3 w - - 0 1", depth=10)
|
||||
assert (r["mate"] is not None and r["mate"] > 0) or (r["cp"] is not None and r["cp"] > 500)
|
||||
finally:
|
||||
await eng.stop()
|
||||
Reference in New Issue
Block a user