// File: /workspace/github_cpp_makefile_star2_O2/jswaff[P]prophet3/test/utils__test.cpp
// Function: test_str_to_move()
void test_str_to_move() {
    position pos;
    reset_pos(&pos);
    move actual = str_to_move("e2e4",&pos);
    move expected = to_move(PAWN,E2,E4);

    assert(actual==expected);

    apply_move(&pos,actual,gundos);
    actual = str_to_move("g8f6",&pos);
    expected = to_move(KNIGHT,G8,F6);
    assert(actual==expected);
    apply_move(&pos,actual,gundos);

    // illegal move
    actual = str_to_move("b1d2", &pos);
    expected = BADMOVE;
    assert(actual==expected);

    // capture
    apply_move(&pos,to_move(PAWN,D2,D4),gundos);
    actual = str_to_move("f6e4",&pos);
    expected = to_capture(KNIGHT,F6,E4,PAWN);
    assert(actual==expected);
    assert(get_captured_piece(actual)==PAWN);

    // ep
    set_pos(&pos,"4k3/8/8/8/3pP3/8/7p/R3K3 b Q e3");
    actual = str_to_move("d4e3",&pos);
    expected = to_capture(PAWN,D4,E3,PAWN);
    set_epcapture(&expected);
    assert(actual==expected);
    assert(get_captured_piece(actual)==PAWN);
    apply_move(&pos,actual,gundos);

    // castle
    actual = str_to_move("e1c1",&pos);
    expected = to_move(KING,E1,C1);
    set_castle(&expected);
    assert(actual==expected);
    apply_move(&pos,actual,gundos);

    // promotion
    actual = str_to_move("h2h1r",&pos);
    expected = to_move(PAWN,H2,H1);
    set_promopiece(&expected,ROOK);
    assert(actual==expected);

    // some bogus move
    actual = str_to_move("f3f4",&pos);
    expected = BADMOVE;
    assert(actual==expected);

    //
    set_pos(&pos,"rnb1k2r/ppq1n3/2pppp2/6pp/2PP3N/P2BP3/2PB1PPP/R2Q1RK1 w kq - -");
    actual = str_to_move("h4g6",&pos);
    expected = to_move(KNIGHT,H4,G6);
    assert(actual==expected);

    set_pos(&pos,"r2r2k1/1p2p1b1/1pp1b1pp/4P2n/PP3p1p/2P2N2/5PP1/R3KBNR b KQ b3 -");
    actual = str_to_move("e6b3",&pos);
    expected = to_move(BISHOP,E6,B3);
    assert(actual==expected);

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xa187
leaq 0xd8b7(%rip), %rdi      # 0x32bb5
movq %rbx, %rsi
callq 0xd66a
movq %rax, %rbx
pushq $0x1
popq %rdi
pushq $0x34
popq %rsi
pushq $0x24
popq %rdx
callq 0x7284
cmpq %rax, %rbx
jne 0x255a4
leaq 0xa67c9(%rip), %rdx     # 0xcbaf0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2fa5
leaq 0x10f51(%rip), %rdi     # 0x3628f
movq %r14, %rsi
callq 0xd66a
movq %rax, %rbx
pushq $0x2
popq %rdi
pushq $0x6
popq %rsi
pushq $0x15
popq %rdx
callq 0x7284
cmpq %rax, %rbx
jne 0x255c0
leaq 0xa6789(%rip), %rdx     # 0xcbaf0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2fa5
leaq 0x10f16(%rip), %rdi     # 0x36294
movq %r14, %rsi
callq 0xd66a
testq %rax, %rax
jne 0x255dc
pushq $0x1
popq %rbx
pushq $0x33
popq %rsi
pushq $0x23
popq %rdx
movl %ebx, %edi
callq 0x7284
leaq 0xa674a(%rip), %rdx     # 0xcbaf0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x2fa5
leaq 0x10edc(%rip), %rdi     # 0x36299
movq %r14, %rsi
callq 0xd66a
movq %rax, %r14
pushq $0x2
popq %rdi
pushq $0x15
popq %rsi
pushq $0x24
popq %rdx
movl %ebx, %ecx
callq 0x72a3
cmpq %rax, %r14
jne 0x255f8
movq %r14, %rdi
callq 0x7390
cmpl $0x1, %eax
jne 0x25614
leaq 0x10ec6(%rip), %rsi     # 0x362bf
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
leaq 0x10ed2(%rip), %rdi     # 0x362df
movq %rbx, %rsi
callq 0xd66a
movq %rax, %rbx
pushq $0x23
popq %rsi
pushq $0x2c
popq %rdx
pushq $0x1
popq %rcx
movl %ecx, %edi
callq 0x72a3
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x7352
cmpq (%r14), %rbx
jne 0x25630
movq %rbx, %rdi
callq 0x7390
cmpl $0x1, %eax
jne 0x2564c
leaq 0xa6697(%rip), %rdx     # 0xcbaf0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2fa5
leaq 0x10e74(%rip), %rdi     # 0x362e4
movq %r14, %rsi
callq 0xd66a
movq %rax, %rbx
pushq $0x6
popq %rdi
pushq $0x3c
popq %rsi
pushq $0x3a
popq %rdx
callq 0x7284
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x7366
cmpq (%r14), %rbx
jne 0x25665
leaq 0xa6647(%rip), %rdx     # 0xcbaf0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2fa5
leaq 0x10e29(%rip), %rdi     # 0x362e9
movq %r14, %rsi
callq 0xd66a
movq %rax, %rbx
pushq $0x1
popq %rdi
pushq $0x37
popq %rsi
pushq $0x3f
popq %rdx
callq 0x7284
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x733b
cmpq (%r14), %rbx
jne 0x2567e
leaq 0x10df3(%rip), %rdi     # 0x362ef
leaq 0x10(%rsp), %rsi
callq 0xd66a
andq $0x0, 0x8(%rsp)
testq %rax, %rax
jne 0x25697
leaq 0xce4d(%rip), %rsi      # 0x32369
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
leaq 0x10dc4(%rip), %rdi     # 0x362f4
movq %rbx, %rsi
callq 0xd66a
movq %rax, %rbx
pushq $0x2
popq %rdi
pushq $0x27
popq %rsi
pushq $0x16
popq %rdx
callq 0x7284
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x256b0
leaq 0xce74(%rip), %rsi      # 0x323d2
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xa1b8
leaq 0x10d87(%rip), %rdi     # 0x362f9
movq %rbx, %rsi
callq 0xd66a
movq %rax, %rbx
pushq $0x3
popq %rdi
pushq $0x14
popq %rsi
pushq $0x29
popq %rdx
callq 0x7284
movq %rax, 0x8(%rsp)
cmpq %rax, %rbx
jne 0x256c9
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
retq
leaq 0x10cbb(%rip), %rdi     # 0x36266
leaq 0x10b39(%rip), %rsi     # 0x360eb
leaq 0x10cbe(%rip), %rcx     # 0x36277
pushq $0x3c
jmp 0x256e0
leaq 0x10c9f(%rip), %rdi     # 0x36266
leaq 0x10b1d(%rip), %rsi     # 0x360eb
leaq 0x10ca2(%rip), %rcx     # 0x36277
pushq $0x41
jmp 0x256e0
leaq 0x10c83(%rip), %rdi     # 0x36266
leaq 0x10b01(%rip), %rsi     # 0x360eb
leaq 0x10c86(%rip), %rcx     # 0x36277
pushq $0x47
jmp 0x256e0
leaq 0x10c67(%rip), %rdi     # 0x36266
leaq 0x10ae5(%rip), %rsi     # 0x360eb
leaq 0x10c6a(%rip), %rcx     # 0x36277
pushq $0x4d
jmp 0x256e0
leaq 0x10c83(%rip), %rdi     # 0x3629e
leaq 0x10ac9(%rip), %rsi     # 0x360eb
leaq 0x10c4e(%rip), %rcx     # 0x36277
pushq $0x4e
jmp 0x256e0
leaq 0x10c2f(%rip), %rdi     # 0x36266
leaq 0x10aad(%rip), %rsi     # 0x360eb
leaq 0x10c32(%rip), %rcx     # 0x36277
pushq $0x55
jmp 0x256e0
leaq 0x10c4b(%rip), %rdi     # 0x3629e
leaq 0x10a91(%rip), %rsi     # 0x360eb
leaq 0x10c16(%rip), %rcx     # 0x36277
pushq $0x56
jmp 0x256e0
leaq 0x10bfa(%rip), %rdi     # 0x36266
leaq 0x10a78(%rip), %rsi     # 0x360eb
leaq 0x10bfd(%rip), %rcx     # 0x36277
pushq $0x5d
jmp 0x256e0
leaq 0x10be1(%rip), %rdi     # 0x36266
leaq 0x10a5f(%rip), %rsi     # 0x360eb
leaq 0x10be4(%rip), %rcx     # 0x36277
pushq $0x64
jmp 0x256e0
leaq 0x10bc8(%rip), %rdi     # 0x36266
leaq 0x10a46(%rip), %rsi     # 0x360eb
leaq 0x10bcb(%rip), %rcx     # 0x36277
pushq $0x69
jmp 0x256e0
leaq 0x10baf(%rip), %rdi     # 0x36266
leaq 0x10a2d(%rip), %rsi     # 0x360eb
leaq 0x10bb2(%rip), %rcx     # 0x36277
pushq $0x6f
jmp 0x256e0
leaq 0x10b96(%rip), %rdi     # 0x36266
leaq 0x10a14(%rip), %rsi     # 0x360eb
leaq 0x10b99(%rip), %rcx     # 0x36277
pushq $0x74
popq %rdx
callq 0x20c0