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

    StarData starData1;
    StarData starData2;

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

    starData2.az = 10;
    starData2.el = 3.;
    starData2.ra = 30;
    starData2.dec = 40;
    starData2.time = 5;

    Data data(starData1, starData2);

    data.setEncoderReadRate(100000); //100 Khz
    data.setEncoderResolution(10000, 10000);

    //Set by user.
    //Look up in the dico to find RA and DEC of the target
    data.setTarget(50, 60);
    data.setStarName("target star name");

    data.applyAlignmentData();

    data.updateCurrentAzEl(2000, 3000);
    data.calculateTargetAzEl();

    std::cout << "is aligned " << data.isAligned() << std::endl;
    std::cout << "target AZ = " << data.getTargetAz() << std::endl;
    std::cout << "target EL = " << data.getTargetEl() << std::endl;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4e0, %rsp            # imm = 0x4E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x488(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x480(%rbp)
callq 0x3550
movq -0x480(%rbp), %rdx
leaq 0x9381(%rip), %rsi      # 0x3dd89
leaq -0x28(%rbp), %rdi
callq 0x5b40
jmp 0x34a13
movq -0x488(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x35710
jmp 0x34a25
leaq -0x28(%rbp), %rdi
callq 0x31c0
leaq -0x29(%rbp), %rdi
callq 0x3370
leaq -0x70(%rbp), %rdi
callq 0x325d0
leaq -0xa0(%rbp), %rdi
callq 0x325d0
jmp 0x34a4e
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x68(%rbp)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, -0x60(%rbp)
movabsq $0x4008000000000000, %rcx # imm = 0x4008000000000000
movq %rcx, -0x58(%rbp)
movabsq $0x4010000000000000, %rax # imm = 0x4010000000000000
movq %rax, -0x50(%rbp)
movabsq $0x4014000000000000, %rax # imm = 0x4014000000000000
movq %rax, -0x48(%rbp)
movabsq $0x4024000000000000, %rdx # imm = 0x4024000000000000
movq %rdx, -0x98(%rbp)
movq %rcx, -0x90(%rbp)
movabsq $0x403e000000000000, %rcx # imm = 0x403E000000000000
movq %rcx, -0x88(%rbp)
movabsq $0x4044000000000000, %rcx # imm = 0x4044000000000000
movq %rcx, -0x80(%rbp)
movq %rax, -0x78(%rbp)
leaq -0x450(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x5e90
jmp 0x34ae8
leaq -0x450(%rbp), %rdi
movl $0x186a0, %esi          # imm = 0x186A0
callq 0x61e0
jmp 0x34afb
leaq -0x450(%rbp), %rdi
movl $0x2710, %edx           # imm = 0x2710
movl %edx, %esi
callq 0x61b0
jmp 0x34b10
leaq -0x450(%rbp), %rdi
movsd 0x90f9(%rip), %xmm0     # 0x3dc18
movsd 0x90f9(%rip), %xmm1     # 0x3dc20
callq 0x6030
jmp 0x34b2e
leaq -0x471(%rbp), %rdi
movq %rdi, -0x490(%rbp)
callq 0x3550
movq -0x490(%rbp), %rdx
leaq 0x924f(%rip), %rsi      # 0x3dd9e
leaq -0x470(%rbp), %rdi
callq 0x5b40
jmp 0x34b5d
leaq -0x450(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x6180
jmp 0x34b72
leaq -0x470(%rbp), %rdi
callq 0x31c0
leaq -0x471(%rbp), %rdi
callq 0x3370
leaq -0x450(%rbp), %rdi
callq 0x5f90
jmp 0x34b98
leaq -0x450(%rbp), %rdi
movl $0x7d0, %esi            # imm = 0x7D0
movl $0xbb8, %edx            # imm = 0xBB8
callq 0x6260
jmp 0x34bb0
leaq -0x450(%rbp), %rdi
callq 0x63a0
jmp 0x34bbe
movq 0x13403(%rip), %rdi     # 0x47fc8
leaq 0x91e3(%rip), %rsi      # 0x3ddaf
callq 0x3320
movq %rax, -0x498(%rbp)
jmp 0x34bda
leaq -0x450(%rbp), %rdi
callq 0x6120
movb %al, -0x499(%rbp)
jmp 0x34bee
movq -0x498(%rbp), %rdi
movb -0x499(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x3560
movq %rax, -0x4a8(%rbp)
jmp 0x34c0f
movq -0x4a8(%rbp), %rdi
movq 0x1338b(%rip), %rsi     # 0x47fa8
callq 0x3350
jmp 0x34c24
movq 0x1339d(%rip), %rdi     # 0x47fc8
leaq 0x9189(%rip), %rsi      # 0x3ddbb
callq 0x3320
movq %rax, -0x4b0(%rbp)
jmp 0x34c40
leaq -0x450(%rbp), %rdi
callq 0x60e0
movsd %xmm0, -0x4b8(%rbp)
jmp 0x34c56
movsd -0x4b8(%rbp), %xmm0
movq -0x4b0(%rbp), %rdi
callq 0x35f0
movq %rax, -0x4c0(%rbp)
jmp 0x34c73
movq -0x4c0(%rbp), %rdi
movq 0x13327(%rip), %rsi     # 0x47fa8
callq 0x3350
jmp 0x34c88
movq 0x13339(%rip), %rdi     # 0x47fc8
leaq 0x9132(%rip), %rsi      # 0x3ddc8
callq 0x3320
movq %rax, -0x4c8(%rbp)
jmp 0x34ca4
leaq -0x450(%rbp), %rdi
callq 0x6100
movsd %xmm0, -0x4d0(%rbp)
jmp 0x34cba
movsd -0x4d0(%rbp), %xmm0
movq -0x4c8(%rbp), %rdi
callq 0x35f0
movq %rax, -0x4d8(%rbp)
jmp 0x34cd7
movq -0x4d8(%rbp), %rdi
movq 0x132c3(%rip), %rsi     # 0x47fa8
callq 0x3350
jmp 0x34cec
leaq -0x450(%rbp), %rdi
callq 0x60b0
leaq -0xa0(%rbp), %rdi
callq 0x32620
leaq -0x70(%rbp), %rdi
callq 0x32620
addq $0x4e0, %rsp            # imm = 0x4E0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x34d39
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 0x34dc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x34db8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x34dac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x34da0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x34d94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x31c0
leaq -0x471(%rbp), %rdi
callq 0x3370
leaq -0x450(%rbp), %rdi
callq 0x60b0
leaq -0xa0(%rbp), %rdi
callq 0x32620
leaq -0x70(%rbp), %rdi
callq 0x32620
movq -0x38(%rbp), %rdi
callq 0x3540
nopw (%rax,%rax)