// File: philipperemy[P]digital-setting-circles/Test.cpp
// Function: Test::test_Util()
void Test::test_Util()
{
    setUpErrorMessage("test_Util() - failed");

    long long tmp = Util::getEffectiveTime();
    Util::sleep(1000);
    assertEquals(tmp + 1, Util::getEffectiveTime());

    assertEquals(0.0, Util::diff180(360.0, 360.0));
    //360=0 -> 170, diff = 170
    assertEquals(170.0, Util::diff180(170.0, 360.0));
    assertEquals(0.0, Util::diff180(0.0, 360.0));
    assertEquals(0.0, Util::diff180(-180.0, 180.0));
    //40 -> 90, diff = -50
    assertEquals(-50.0, Util::diff180(40.0, 90.0));
    //-20 -> 80 = -100
    assertEquals(-100.0, Util::diff180(-20.0, 80.0));

    StarData starData1;
    StarData starData2;

    starData1.az = 1;
    starData1.el = 2;
    starData1.ra = 3;
    starData1.dec = 4;
    starData1.time = 5;

    starData2.az = 1;
    starData2.el = 2;
    starData2.ra = 3;
    starData2.dec = 4;
    starData2.time = 5;

    assertTrue(!Util::goodAlignmentGeometry(starData1, starData2));

    starData1.az = 1;
    starData1.el = 2;
    starData1.ra = 3;
    starData1.dec = 4;
    starData1.time = 5;

    starData2.az = 1;
    starData2.el = 50;
    starData2.ra = 3;
    starData2.dec = 4;
    starData2.time = 5;

    assertTrue(!Util::goodAlignmentGeometry(starData1, starData2));


    starData1.az = 1;
    starData1.el = 2;
    starData1.ra = 3;
    starData1.dec = 4;
    starData1.time = 5;

    starData2.az = 100;
    starData2.el = 50;
    starData2.ra = 3;
    starData2.dec = 4;
    starData2.time = 5;

    assertTrue(Util::goodAlignmentGeometry(starData1, starData2));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x3550
movq -0xb0(%rbp), %rdx
leaq 0x9954(%rip), %rsi      # 0x3dd5c
leaq -0x28(%rbp), %rdi
callq 0x5b40
jmp 0x34413
movq -0xb8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x35710
jmp 0x34425
leaq -0x28(%rbp), %rdi
callq 0x31c0
leaq -0x29(%rbp), %rdi
callq 0x3370
callq 0x37140
movq %rax, -0x48(%rbp)
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x371b0
movq -0x48(%rbp), %rax
incq %rax
movq %rax, -0xd8(%rbp)
callq 0x37140
movq -0xd8(%rbp), %rsi
movq -0xb8(%rbp), %rdi
movq %rax, %rdx
callq 0x35f30
movsd 0x3bed(%rip), %xmm1     # 0x38068
movsd %xmm1, -0xc8(%rbp)
movaps %xmm1, %xmm0
callq 0x36ef0
movq -0xb8(%rbp), %rdi
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
movsd %xmm0, -0xc0(%rbp)
callq 0x35d20
movsd -0xc8(%rbp), %xmm1
movsd 0x9723(%rip), %xmm0     # 0x3dbd8
movsd %xmm0, -0xd0(%rbp)
callq 0x36ef0
movq -0xb8(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0xd0(%rbp), %xmm0
callq 0x35d20
movsd -0xc8(%rbp), %xmm1
movsd -0xc0(%rbp), %xmm0
callq 0x36ef0
movq -0xb8(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0xc0(%rbp), %xmm0
callq 0x35d20
movsd 0x96d3(%rip), %xmm0     # 0x3dbe0
movsd 0x96d3(%rip), %xmm1     # 0x3dbe8
callq 0x36ef0
movq -0xb8(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0xc0(%rbp), %xmm0
callq 0x35d20
movsd 0x96b7(%rip), %xmm0     # 0x3dbf0
movsd 0x96b7(%rip), %xmm1     # 0x3dbf8
callq 0x36ef0
movq -0xb8(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x96a8(%rip), %xmm0     # 0x3dc00
callq 0x35d20
movsd 0x96a3(%rip), %xmm0     # 0x3dc08
movsd 0x9543(%rip), %xmm1     # 0x3dab0
callq 0x36ef0
movq -0xb8(%rbp), %rdi
movaps %xmm0, %xmm1
movsd 0x968c(%rip), %xmm0     # 0x3dc10
callq 0x35d20
leaq -0x78(%rbp), %rdi
callq 0x325d0
leaq -0xa8(%rbp), %rdi
callq 0x325d0
jmp 0x345a0
movabsq $0x3ff0000000000000, %rdi # imm = 0x3FF0000000000000
movq %rdi, -0x70(%rbp)
movabsq $0x4000000000000000, %rsi # imm = 0x4000000000000000
movq %rsi, -0x68(%rbp)
movabsq $0x4008000000000000, %rdx # imm = 0x4008000000000000
movq %rdx, -0x60(%rbp)
movabsq $0x4010000000000000, %rcx # imm = 0x4010000000000000
movq %rcx, -0x58(%rbp)
movabsq $0x4014000000000000, %rax # imm = 0x4014000000000000
movq %rax, -0x50(%rbp)
movq %rdi, -0xa0(%rbp)
movq %rsi, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x37080
movb %al, -0xd9(%rbp)
jmp 0x3461e
movq -0xb8(%rbp), %rdi
movb -0xd9(%rbp), %al
notb %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x35b40
jmp 0x3463a
movabsq $0x3ff0000000000000, %rsi # imm = 0x3FF0000000000000
movq %rsi, -0x70(%rbp)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, -0x68(%rbp)
movabsq $0x4008000000000000, %rdx # imm = 0x4008000000000000
movq %rdx, -0x60(%rbp)
movabsq $0x4010000000000000, %rcx # imm = 0x4010000000000000
movq %rcx, -0x58(%rbp)
movabsq $0x4014000000000000, %rax # imm = 0x4014000000000000
movq %rax, -0x50(%rbp)
movq %rsi, -0xa0(%rbp)
movabsq $0x4049000000000000, %rsi # imm = 0x4049000000000000
movq %rsi, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x37080
movb %al, -0xda(%rbp)
jmp 0x346c2
movq -0xb8(%rbp), %rdi
movb -0xda(%rbp), %al
notb %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x35b40
jmp 0x346de
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x70(%rbp)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, -0x68(%rbp)
movabsq $0x4008000000000000, %rdx # imm = 0x4008000000000000
movq %rdx, -0x60(%rbp)
movabsq $0x4010000000000000, %rcx # imm = 0x4010000000000000
movq %rcx, -0x58(%rbp)
movabsq $0x4014000000000000, %rax # imm = 0x4014000000000000
movq %rax, -0x50(%rbp)
movabsq $0x4059000000000000, %rsi # imm = 0x4059000000000000
movq %rsi, -0xa0(%rbp)
movabsq $0x4049000000000000, %rsi # imm = 0x4049000000000000
movq %rsi, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x37080
movb %al, -0xdb(%rbp)
jmp 0x34770
movq -0xb8(%rbp), %rdi
movb -0xdb(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x35b40
jmp 0x3478a
leaq -0xa8(%rbp), %rdi
callq 0x32620
leaq -0x78(%rbp), %rdi
callq 0x32620
addq $0xe0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x347cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x31c0
leaq -0x29(%rbp), %rdi
callq 0x3370
jmp 0x34805
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x347fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x32620
leaq -0x78(%rbp), %rdi
callq 0x32620
movq -0x38(%rbp), %rdi
callq 0x3540
nop