// File: chuckwolber[P]Cube/test/test_algorithm.cpp
// Function: test_sequences()
void test_sequences() {
    std::cout << "Testing sequences... ";

    Algorithm alg;
    std::vector<Turn> results;
    std::vector<Turn> expected = {
       {Layer::F, true}, {Layer::F, false}, {Layer::U, true}, {Layer::U, false},
       {Layer::R, true}, {Layer::R, false}, {Layer::D, true}, {Layer::D, false},
       {Layer::L, true}, {Layer::L, false}, {Layer::B, true}, {Layer::B, false},

       {Layer::F, true}, {Layer::F,  true}, {Layer::F, true}, {Layer::F, false},
       {Layer::F, true}, {Layer::U,  true}, {Layer::F, true}, {Layer::U, false},
       {Layer::F, true}, {Layer::R,  true}, {Layer::F, true}, {Layer::R, false},
       {Layer::F, true}, {Layer::D,  true}, {Layer::F, true}, {Layer::D, false},
       {Layer::F, true}, {Layer::L,  true}, {Layer::F, true}, {Layer::L, false},
       {Layer::F, true}, {Layer::B,  true}, {Layer::F, true}, {Layer::B, false}
    };

    std::cout << " t1 ";
    for (int i = 0; i < 24; i++) {
        for (Turn t : alg.getAlgorithm())
            results.push_back(t);
        alg++;
    }
    verify_turns(results, expected);
    results.clear();
    alg.reset();

    std::cout << " t2 ";
    for (int i = 0; i < 24; i++) {
        for (Turn t : alg.getAlgorithm())
            results.push_back(t);
        ++alg;
    }
    verify_turns(results, expected);
    results.clear();
    alg.reset();

    std::cout << " t3 ";
    for (int i = 0; i < 24; i++) {
        for (Turn t : alg.getAlgorithm())
            results.push_back(t);
        alg += 1;
    }
    verify_turns(results, expected);
    results.clear();
    alg.reset();
   
    std::cout << "Passed" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq 0xb8e6(%rip), %rdi      # 0x15fd8
leaq 0x5d69(%rip), %rsi      # 0x10462
callq 0x2190
leaq -0x28(%rbp), %rdi
callq 0x2420
leaq -0x40(%rbp), %rdi
callq 0x50a0
leaq 0x6311(%rip), %rsi      # 0x10a28
leaq -0x188(%rbp), %rdi
movq %rdi, -0x320(%rbp)
movl $0x120, %edx            # imm = 0x120
callq 0x2150
movq -0x320(%rbp), %rax
movq %rax, -0x68(%rbp)
movq $0x24, -0x60(%rbp)
leaq -0x189(%rbp), %rdi
movq %rdi, -0x318(%rbp)
callq 0x51f0
movq -0x318(%rbp), %rcx
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0xf130
jmp 0xa76f
leaq -0x189(%rbp), %rdi
callq 0x54d0
movq 0xb856(%rip), %rdi      # 0x15fd8
leaq 0x5cef(%rip), %rsi      # 0x10478
callq 0x2190
jmp 0xa790
movl $0x0, -0x1a0(%rbp)
cmpl $0x18, -0x1a0(%rbp)
jge 0xa8e1
leaq -0x1c0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x33e0
jmp 0xa7b9
leaq -0x1c0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rdi
callq 0x7830
movq %rax, -0x1c8(%rbp)
movq -0x1a8(%rbp), %rdi
callq 0x7680
movq %rax, -0x1d0(%rbp)
leaq -0x1c8(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0xf1b0
testb $0x1, %al
jne 0xa84f
leaq -0x1c0(%rbp), %rdi
callq 0x4920
jmp 0xa8ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x189(%rbp), %rdi
callq 0x54d0
jmp 0xad69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xad60
leaq -0x1c8(%rbp), %rdi
callq 0x7ac0
movq (%rax), %rax
movq %rax, -0x1d8(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xf1f0
jmp 0xa877
jmp 0xa879
leaq -0x1c8(%rbp), %rdi
callq 0xf260
jmp 0xa7ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x4920
jmp 0xad60
leaq -0x200(%rbp), %rdi
leaq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x2b50
jmp 0xa8c1
leaq -0x200(%rbp), %rdi
callq 0x4bd0
movl -0x1a0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a0(%rbp)
jmp 0xa79a
leaq -0x218(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4830
jmp 0xa8f3
leaq -0x230(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4830
jmp 0xa905
leaq -0x218(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0xecb0
jmp 0xa91a
leaq -0x230(%rbp), %rdi
callq 0x4920
leaq -0x218(%rbp), %rdi
callq 0x4920
leaq -0x40(%rbp), %rdi
callq 0xf280
leaq -0x28(%rbp), %rdi
callq 0x3030
jmp 0xa946
movq 0xb68b(%rip), %rdi      # 0x15fd8
leaq 0x5b29(%rip), %rsi      # 0x1047d
callq 0x2190
jmp 0xa95b
movl $0x0, -0x234(%rbp)
cmpl $0x18, -0x234(%rbp)
jge 0xaaa2
leaq -0x258(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x33e0
jmp 0xa984
leaq -0x258(%rbp), %rax
movq %rax, -0x240(%rbp)
movq -0x240(%rbp), %rdi
callq 0x7830
movq %rax, -0x260(%rbp)
movq -0x240(%rbp), %rdi
callq 0x7680
movq %rax, -0x268(%rbp)
leaq -0x260(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0xf1b0
testb $0x1, %al
jne 0xaa23
leaq -0x258(%rbp), %rdi
callq 0x4920
jmp 0xaa81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xaa12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x4920
leaq -0x218(%rbp), %rdi
callq 0x4920
jmp 0xad60
leaq -0x260(%rbp), %rdi
callq 0x7ac0
movq (%rax), %rax
movq %rax, -0x270(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xf1f0
jmp 0xaa4b
jmp 0xaa4d
leaq -0x260(%rbp), %rdi
callq 0xf260
jmp 0xa9b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x4920
jmp 0xad60
leaq -0x28(%rbp), %rdi
callq 0x29d0
jmp 0xaa8c
jmp 0xaa8e
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0xa965
leaq -0x288(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4830
jmp 0xaab4
leaq -0x2a0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4830
jmp 0xaac6
leaq -0x288(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0xecb0
jmp 0xaadb
leaq -0x2a0(%rbp), %rdi
callq 0x4920
leaq -0x288(%rbp), %rdi
callq 0x4920
leaq -0x40(%rbp), %rdi
callq 0xf280
leaq -0x28(%rbp), %rdi
callq 0x3030
jmp 0xab07
movq 0xb4ca(%rip), %rdi      # 0x15fd8
leaq 0x596d(%rip), %rsi      # 0x10482
callq 0x2190
jmp 0xab1c
movl $0x0, -0x2a4(%rbp)
cmpl $0x18, -0x2a4(%rbp)
jge 0xac68
leaq -0x2c8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x33e0
jmp 0xab45
leaq -0x2c8(%rbp), %rax
movq %rax, -0x2b0(%rbp)
movq -0x2b0(%rbp), %rdi
callq 0x7830
movq %rax, -0x2d0(%rbp)
movq -0x2b0(%rbp), %rdi
callq 0x7680
movq %rax, -0x2d8(%rbp)
leaq -0x2d0(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0xf1b0
testb $0x1, %al
jne 0xabe4
leaq -0x2c8(%rbp), %rdi
callq 0x4920
jmp 0xac42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xabd3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x4920
leaq -0x288(%rbp), %rdi
callq 0x4920
jmp 0xad60
leaq -0x2d0(%rbp), %rdi
callq 0x7ac0
movq (%rax), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0xf1f0
jmp 0xac0c
jmp 0xac0e
leaq -0x2d0(%rbp), %rdi
callq 0xf260
jmp 0xab79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x4920
jmp 0xad60
leaq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x2bd0
jmp 0xac52
jmp 0xac54
movl -0x2a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a4(%rbp)
jmp 0xab26
leaq -0x2f8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4830
jmp 0xac7a
leaq -0x310(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4830
jmp 0xac8c
leaq -0x2f8(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0xecb0
jmp 0xaca1
leaq -0x310(%rbp), %rdi
callq 0x4920
leaq -0x2f8(%rbp), %rdi
callq 0x4920
leaq -0x40(%rbp), %rdi
callq 0xf280
leaq -0x28(%rbp), %rdi
callq 0x3030
jmp 0xaccd
movq 0xb304(%rip), %rdi      # 0x15fd8
leaq 0x56db(%rip), %rsi      # 0x103b6
callq 0x2190
movq %rax, -0x328(%rbp)
jmp 0xace9
movq -0x328(%rbp), %rdi
movq 0xb2d1(%rip), %rsi      # 0x15fc8
callq 0x21c0
jmp 0xacfe
leaq -0x58(%rbp), %rdi
callq 0x4920
leaq -0x40(%rbp), %rdi
callq 0x4920
leaq -0x28(%rbp), %rdi
callq 0x4bd0
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0xad54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x4920
leaq -0x2f8(%rbp), %rdi
callq 0x4920
leaq -0x58(%rbp), %rdi
callq 0x4920
leaq -0x40(%rbp), %rdi
callq 0x4920
leaq -0x28(%rbp), %rdi
callq 0x4bd0
movq -0x198(%rbp), %rdi
callq 0x22a0
nopw (%rax,%rax)