#import "../game.typ": apply-moves #import "testutil.typ": assert-eq // Queen blocked by own pawn on d2 #assert-eq(apply-moves(("Qd3",)).last().error, "Qd3: illegal move") #assert-eq(apply-moves(("qd3",)).last().error, "qd3: illegal move") // knight can't reach e4 from g8 #let st = apply-moves(("e4", "e5", "Nc3", "c6", "Ne4")).last() #assert-eq(st.error, "Ne4: illegal move") // pawn move to occupied square #let st = apply-moves(("e4", "e5", "e4")).last() #assert-eq(st.error, "e4: illegal move") // bishop capture with no target #let st = apply-moves(("d4", "d5", "Bxe5")).last() #assert-eq(st.error, "Bxe5: illegal move") // eook on h1 after castling #let st = apply-moves(("e4", "e5", "Nf3", "Nc6", "Bc4", "Bc5", "O-O", "Rh1")).last() #assert-eq(st.error, "Rh1: illegal move") // moving while in check without addressing it #let st = apply-moves(("e4", "e5", "Qh5", "a6", "Qe5", "a5")).last() #assert-eq(st.error, "a5: illegal move") // error clears on next valid move #let st = apply-moves(("zzz", "e4")).last() #assert-eq(st.error, none)