// File: jswaff[P]prophet3/test/see__test.cpp
// Function: test_see()
void test_see() {
    test_queen_takes_undefended_pawn();
    test_queen_takes_defended_pawn();
    test_rook_takes_undefended_pawn();
    test_with_xrays();
    test_rook_xrays();
    test_knight_takes_defended_pawn_as_white();
    test_knight_takes_defended_pawn_as_black();
    test_crazy_rooks();
    test_crazy_rooks2();
    test_knight_takes_defended_pawn();
    test_bishop_takes_defended_pawn();
    test_knight_takes_defended_pawn_with_crazy_bishops();

    test_case_see("4R3/2r3p1/5bk1/1p1r3p/p2PR1P1/P1BK1P2/1P6/8 b - -","hxg4",0);
    test_case_see("4R3/2r3p1/5bk1/1p1r1p1p/p2PR1P1/P1BK1P2/1P6/8 b - -","hxg4",0);
    test_case_see("4r1k1/5pp1/nbp4p/1p2p2q/1P2P1b1/1BP2N1P/1B2QPPK/3R4 b - -","Bxf3",knight_val-bishop_val);
    test_case_see("2r1r1k1/pp1bppbp/3p1np1/q3P3/2P2P2/1P2B3/P1N1B1PP/2RQ1RK1 b - -","dxe5",pawn_val);
    test_case_see("7r/5qpk/p1Qp1b1p/3r3n/BB3p2/5p2/P1P2P2/4RK1R w - -","Re8",0);
    test_case_see("7R/4bP2/8/8/1q6/3K4/5p2/4k3 w - -","f8=R",10004);
    test_case_see("8/4kp2/2npp3/1Nn5/1p2PQP1/7q/1PP1B3/4KR1r b - -","Rxf1+",0);
    test_case_see("2r2r1k/6bp/p7/2q2p1Q/3PpP2/1B6/P5PP/2RR3K b - -","Qxc1",2*rook_val-queen_val);
    test_case_see("r2qk1nr/pp2ppbp/2b3p1/2p1p3/8/2N2N2/PPPP1PPP/R1BQR1K1 w kq -","Nxe5",pawn_val);
    test_case_see("6r1/4kq2/b2p1p2/p1pPb3/p1P2B1Q/2P4P/2B1R1P1/6K1 w - -","Bxe5",0);
    test_case_see("3q2nk/pb1r1p2/np6/3P2Pp/2p1P3/2R4B/PQ3P1P/3R2K1 w - h6","gxh6",0);
    test_case_see("3q2nk/pb1r1p2/np6/3P2Pp/2p1P3/2R1B2B/PQ3P1P/3R2K1 w - h6","gxh6",pawn_val);
    test_case_see("2r4r/1P4pk/p2p1b1p/7n/BB3p2/2R2p2/P1P2P2/4RK2 w - -","Rxc8",rook_val);

    // Arasan says +rook for this, but RxR then BxR then PxB ==> Bishop Val
    // Note the last pawn capture is also a promotion so that could be added
    test_case_see("2r5/1P4pk/p2p1b1p/5b1n/BB3p2/2R2p2/P1P2P2/4RK2 w - -","Rxc8",bishop_val);

    test_case_see("2r4k/2r4p/p7/2b2p1b/4pP2/1BR5/P1R3PP/2Q4K w - -","Rxc5",bishop_val);
    test_case_see("8/pp6/2pkp3/4bp2/2R3b1/2P5/PP4B1/1K6 w - -","Bxc6",pawn_val-bishop_val);
    test_case_see("4q3/1p1pr1k1/1B2rp2/6p1/p3PP2/P3R1P1/1P2R1K1/4Q3 b - -","Rxe4",pawn_val-rook_val);
    test_case_see("4q3/1p1pr1kb/1B2rp2/6p1/p3PP2/P3R1P1/1P2R1K1/4Q3 b - -","Bxe4",pawn_val);

/*
    // not captures
    //test_case_see("6rr/6pk/p1Qp1b1p/2n5/1B3p2/5p2/P1P2P2/4RK1R w - -","Re8",-Eval.ROOK_VAL);
    //test_case_see("7r/5qpk/2Qp1b1p/1N1r3n/BB3p2/5p2/P1P2P2/4RK1R w - -","Re8",-Eval.ROOK_VAL);

    // promotion that doesn't capture
    //test_case_see("6RR/4bP2/8/8/5r2/3K4/5p2/4k3 w - -","f8=Q",Eval.BISHOP_VAL-Eval.PAWN_VAL);
    //test_case_see("6RR/4bP2/8/8/5r2/3K4/5p2/4k3 w - -","f8=N",Eval.KNIGHT_VAL-Eval.PAWN_VAL);
    //test_case_see("7R/5P2/8/8/8/3K2r1/5p2/4k3 w - -","f8=Q",Eval.QUEEN_VAL-Eval.PAWN_VAL);
    //test_case_see("7R/5P2/8/8/8/3K2r1/5p2/4k3 w - -","f8=B",Eval.BISHOP_VAL-Eval.PAWN_VAL);
*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x30ce0
callq 0x30dc0
callq 0x30eb0
callq 0x30f90
callq 0x31080
callq 0x31160
callq 0x31240
callq 0x31320
callq 0x31410
callq 0x314f0
callq 0x315d0
callq 0x316b0
leaq 0x12109(%rip), %rdi     # 0x43a80
leaq 0x12134(%rip), %rsi     # 0x43ab2
xorl %edx, %edx
callq 0x317a0
leaq 0x1212b(%rip), %rdi     # 0x43ab7
leaq 0x1211f(%rip), %rsi     # 0x43ab2
xorl %edx, %edx
callq 0x317a0
leaq 0x1214a(%rip), %rdi     # 0x43aeb
leaq 0x1217d(%rip), %rsi     # 0x43b25
movl $0xffffffec, %edx       # imm = 0xFFFFFFEC
callq 0x317a0
leaq 0x12171(%rip), %rdi     # 0x43b2a
leaq 0x121aa(%rip), %rsi     # 0x43b6a
movl $0x64, %edx
callq 0x317a0
leaq 0x1219e(%rip), %rdi     # 0x43b6f
leaq 0x121ca(%rip), %rsi     # 0x43ba2
xorl %edx, %edx
callq 0x317a0
leaq 0x121c0(%rip), %rdi     # 0x43ba6
leaq 0x121db(%rip), %rsi     # 0x43bc8
movl $0x2714, %edx           # imm = 0x2714
callq 0x317a0
leaq 0x121cf(%rip), %rdi     # 0x43bcd
leaq 0x121f8(%rip), %rsi     # 0x43bfd
xorl %edx, %edx
callq 0x317a0
leaq 0x121f0(%rip), %rdi     # 0x43c03
leaq 0x12219(%rip), %rsi     # 0x43c33
movl $0x64, %edx
callq 0x317a0
leaq 0x1220d(%rip), %rdi     # 0x43c38
leaq 0x12243(%rip), %rsi     # 0x43c75
movl $0x64, %edx
callq 0x317a0
leaq 0x12237(%rip), %rdi     # 0x43c7a
leaq 0x12266(%rip), %rsi     # 0x43cb0
xorl %edx, %edx
callq 0x317a0
leaq 0x1225d(%rip), %rdi     # 0x43cb5
leaq 0x1228d(%rip), %rsi     # 0x43cec
xorl %edx, %edx
callq 0x317a0
leaq 0x12284(%rip), %rdi     # 0x43cf1
leaq 0x12278(%rip), %rsi     # 0x43cec
movl $0x64, %edx
callq 0x317a0
leaq 0x122a5(%rip), %rdi     # 0x43d2a
leaq 0x122d2(%rip), %rsi     # 0x43d5e
movl $0x1f4, %edx            # imm = 0x1F4
callq 0x317a0
leaq 0x122c6(%rip), %rdi     # 0x43d63
leaq 0x122ba(%rip), %rsi     # 0x43d5e
movl $0x140, %edx            # imm = 0x140
callq 0x317a0
leaq 0x122e3(%rip), %rdi     # 0x43d98
leaq 0x1230c(%rip), %rsi     # 0x43dc8
movl $0x140, %edx            # imm = 0x140
callq 0x317a0
leaq 0x12300(%rip), %rdi     # 0x43dcd
leaq 0x12324(%rip), %rsi     # 0x43df8
movl $0xffffff24, %edx       # imm = 0xFFFFFF24
callq 0x317a0
leaq 0x12318(%rip), %rdi     # 0x43dfd
leaq 0x12348(%rip), %rsi     # 0x43e34
movl $0xfffffe70, %edx       # imm = 0xFFFFFE70
callq 0x317a0
leaq 0x1233c(%rip), %rdi     # 0x43e39
leaq 0x1236c(%rip), %rsi     # 0x43e70
movl $0x64, %edx
callq 0x317a0
popq %rbp
retq