// File: Barath-Kannan[P]SignalsAndSlots/test/SignalTest.cpp
// Function: SignalTest_DeferredSynchronousSignal_Test::TestBody()
TEST_F(SignalTest, DeferredSynchronousSignal) {
    cout << "Instantiating signal object" << endl;

    Signal<int, int> testSignal;

    BasicTimer bt;
    cout << "Connecting signal" << endl;
    bt.start();
    testSignal.connectSlot(ExecutorScheme::DEFERRED_SYNCHRONOUS, staticSumFunction);
    bt.stop();
    cout << "Time to connect: " << bt.getElapsedMilliseconds() << "ms" << endl;

    cout << "Emitting signal" << endl;

    bt.start();
    testSignal(1, 2);
    bt.stop();
    cout << "Time to emit: " << bt.getElapsedMilliseconds() << "ms" << endl;

    ASSERT_NE(globalStaticIntX, 3);
    
    testSignal.invokeDeferred();
    
    ASSERT_EQ(globalStaticIntX, 3);

    testSignal.disconnectSlot(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x8(%rbp)
movq 0xe2a52(%rip), %rdi     # 0xfafb8
leaq 0x8d152(%rip), %rsi     # 0xa56bf
callq 0xd640
movq %rax, %rdi
movq 0xe2a14(%rip), %rsi     # 0xfaf90
callq 0xd6e0
leaq -0x120(%rbp), %rdi
callq 0x1c140
leaq -0x138(%rbp), %rdi
callq 0xfc20
jmp 0x1859b
movq 0xe2a16(%rip), %rdi     # 0xfafb8
leaq 0x8d15e(%rip), %rsi     # 0xa5707
callq 0xd640
movq %rax, -0x1d0(%rbp)
jmp 0x185b7
movq -0x1d0(%rbp), %rdi
movq 0xe29cb(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x185cc
leaq -0x138(%rbp), %rdi
callq 0xfde0
jmp 0x185da
leaq -0x871(%rip), %rsi      # 0x17d70
leaq -0x168(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x1c3d0
movq -0x1d8(%rbp), %rdx
leaq -0x120(%rbp), %rdi
movl $0x1, %esi
callq 0x1c350
jmp 0x1860e
leaq -0x168(%rbp), %rdi
callq 0x1c460
leaq -0x138(%rbp), %rdi
callq 0xfe30
jmp 0x18628
movq 0xe2989(%rip), %rdi     # 0xfafb8
leaq 0x8d0e3(%rip), %rsi     # 0xa5719
callq 0xd640
movq %rax, -0x1e0(%rbp)
jmp 0x18644
leaq -0x138(%rbp), %rdi
callq 0xfd00
movsd %xmm0, -0x1e8(%rbp)
jmp 0x1865a
movsd -0x1e8(%rbp), %xmm0
movq -0x1e0(%rbp), %rdi
callq 0xddc0
movq %rax, -0x1f0(%rbp)
jmp 0x18677
movq -0x1f0(%rbp), %rdi
leaq 0x8eb16(%rip), %rsi     # 0xa719b
callq 0xd640
movq %rax, -0x1f8(%rbp)
jmp 0x18693
movq -0x1f8(%rbp), %rdi
movq 0xe28ef(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x186a8
movq 0xe2909(%rip), %rdi     # 0xfafb8
leaq 0x8d075(%rip), %rsi     # 0xa572b
callq 0xd640
movq %rax, -0x200(%rbp)
jmp 0x186c4
movq -0x200(%rbp), %rdi
movq 0xe28be(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x186d9
leaq -0x138(%rbp), %rdi
callq 0xfde0
jmp 0x186e7
movl $0x1, -0x16c(%rbp)
movl $0x2, -0x170(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x16c(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x1c480
jmp 0x18717
leaq -0x138(%rbp), %rdi
callq 0xfe30
jmp 0x18725
movq 0xe288c(%rip), %rdi     # 0xfafb8
leaq 0x8d008(%rip), %rsi     # 0xa573b
callq 0xd640
movq %rax, -0x208(%rbp)
jmp 0x18741
leaq -0x138(%rbp), %rdi
callq 0xfd00
movsd %xmm0, -0x210(%rbp)
jmp 0x18757
movsd -0x210(%rbp), %xmm0
movq -0x208(%rbp), %rdi
callq 0xddc0
movq %rax, -0x218(%rbp)
jmp 0x18774
movq -0x218(%rbp), %rdi
leaq 0x8ea19(%rip), %rsi     # 0xa719b
callq 0xd640
movq %rax, -0x220(%rbp)
jmp 0x18790
movq -0x220(%rbp), %rdi
movq 0xe27f2(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x187a5
movl $0x3, -0x184(%rbp)
leaq 0x8cf94(%rip), %rsi     # 0xa574a
leaq 0x8cf9e(%rip), %rdx     # 0xa575b
leaq 0x1350b0(%rip), %rcx    # 0x14d874
leaq -0x180(%rbp), %rdi
leaq -0x184(%rbp), %r8
callq 0x1c640
jmp 0x187d9
leaq -0x180(%rbp), %rdi
callq 0x1c500
movb %al, -0x221(%rbp)
jmp 0x187ed
movb -0x221(%rbp), %al
testb $0x1, %al
jne 0x187f9
jmp 0x1884f
jmp 0x18914
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x18ae8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x1c460
jmp 0x18ae8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x189a1
leaq -0x190(%rbp), %rdi
callq 0x6f130
jmp 0x1885d
leaq -0x180(%rbp), %rdi
callq 0x1c520
movq %rax, -0x230(%rbp)
jmp 0x18872
movq -0x230(%rbp), %r8
leaq 0x8ce2b(%rip), %rdx     # 0xa56ab
leaq -0x198(%rbp), %rdi
movl $0x2, %esi
movl $0x67, %ecx
callq 0x6c7e0
jmp 0x18898
leaq -0x198(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x6c8a0
jmp 0x188ad
leaq -0x198(%rbp), %rdi
callq 0x6c860
leaq -0x190(%rbp), %rdi
callq 0x1c540
movl $0x1, -0x19c(%rbp)
jmp 0x1891e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x18903
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x6c860
leaq -0x190(%rbp), %rdi
callq 0x1c540
jmp 0x189a1
movl $0x0, -0x19c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x1c560
movl -0x19c(%rbp), %eax
testl %eax, %eax
jne 0x18ac7
jmp 0x1893a
leaq -0x120(%rbp), %rdi
callq 0x1c6b0
jmp 0x18948
movl $0x3, -0x1b4(%rbp)
leaq 0x8cdf1(%rip), %rsi     # 0xa574a
leaq 0x8cdfb(%rip), %rdx     # 0xa575b
leaq 0x134f0d(%rip), %rcx    # 0x14d874
leaq -0x1b0(%rbp), %rdi
leaq -0x1b4(%rbp), %r8
callq 0x1c4b0
jmp 0x1897c
leaq -0x1b0(%rbp), %rdi
callq 0x1c500
movb %al, -0x231(%rbp)
jmp 0x18990
movb -0x231(%rbp), %al
testb $0x1, %al
jne 0x1899c
jmp 0x189c9
jmp 0x18a8b
leaq -0x180(%rbp), %rdi
callq 0x1c560
jmp 0x18ae8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x18adc
leaq -0x1c0(%rbp), %rdi
callq 0x6f130
jmp 0x189d7
leaq -0x1b0(%rbp), %rdi
callq 0x1c520
movq %rax, -0x240(%rbp)
jmp 0x189ec
movq -0x240(%rbp), %r8
leaq 0x8ccb1(%rip), %rdx     # 0xa56ab
leaq -0x1c8(%rbp), %rdi
movl $0x2, %esi
movl $0x6b, %ecx
callq 0x6c7e0
jmp 0x18a12
leaq -0x1c8(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x6c8a0
jmp 0x18a27
leaq -0x1c8(%rbp), %rdi
callq 0x6c860
leaq -0x1c0(%rbp), %rdi
callq 0x1c540
movl $0x1, -0x19c(%rbp)
jmp 0x18a95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x18a7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x6c860
leaq -0x1c0(%rbp), %rdi
callq 0x1c540
jmp 0x18adc
movl $0x0, -0x19c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x1c560
movl -0x19c(%rbp), %eax
testl %eax, %eax
jne 0x18ac7
jmp 0x18aad
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
callq 0x1c5d0
jmp 0x18abd
movl $0x0, -0x19c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x1c2f0
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
leaq -0x1b0(%rbp), %rdi
callq 0x1c560
leaq -0x120(%rbp), %rdi
callq 0x1c2f0
movq -0x140(%rbp), %rdi
callq 0xdcb0