// File: fjamour[P]icentral/src/unit_tests.h
// Function: test__iCentral()
bool test__iCentral()
{
    bool passed = false;
    printf("Testing [iCentral] ...\t");
    
    edge_t e = make_pair(3, 18);
    graph_t g;
    g.read_graph(string("Erdos02.lcc.net"));
    //fill_test_graph(g);
    vector<double> BC_vec;
    fast_brandes_BC(g, BC_vec);
    
    component_t comp;
    comp.comp_type = GRAPH;
    comp.subgraph.fill_graph(g);
    vector<double> dBC_vec;
    iCentral(dBC_vec, comp, e);
    for(int i = 0; i < dBC_vec.size(); ++i) {
        BC_vec[i] += dBC_vec[i];
    }
    
    g.insert_edge(e.first, e.second);
    vector<double> ref_BC_vec = brandes_bc(g);
    passed = true;
    for(node_id_t v = 0; v < BC_vec.size(); ++v) {
        if(abs((BC_vec[v] - ref_BC_vec[v])) > EPS) {
            passed = false;
        }
        //printf("[%f]\t\t[%f]\n", BC_vec[v], ref_BC_vec[v]);
    }
    if(passed) {
        printf("PASSED\n");
    } else {
        printf("FAILED\n");
    }
    
    return passed;
}

// Assembly:
subq $0x458, %rsp            # imm = 0x458
movb $0x0, 0x457(%rsp)
leaq 0x21e04(%rip), %rdi     # 0x7bd2a
xorl %eax, %eax
callq 0x9040
movl $0x3, 0x440(%rsp)
movl $0x12, 0x43c(%rsp)
leaq 0x440(%rsp), %rdi
leaq 0x43c(%rsp), %rsi
callq 0x5f060
movq %rax, 0x444(%rsp)
leaq 0x44c(%rsp), %rdi
leaq 0x444(%rsp), %rsi
callq 0x5f090
leaq 0x310(%rsp), %rdi
callq 0x5eda0
leaq 0x2ef(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x9d00
movq 0x40(%rsp), %rdx
leaq 0x21d6a(%rip), %rsi     # 0x7bd0a
leaq 0x2f0(%rsp), %rdi
callq 0x5ef00
jmp 0x59faf
leaq 0x310(%rsp), %rdi
leaq 0x2f0(%rsp), %rsi
callq 0x56b50
jmp 0x59fc6
leaq 0x2f0(%rsp), %rdi
callq 0x9410
leaq 0x2ef(%rsp), %rdi
callq 0x97d0
leaq 0x2c0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0xfa00
movq 0x38(%rsp), %rsi
leaq 0x310(%rsp), %rdi
callq 0xa2d0
jmp 0x5a006
leaq 0x90(%rsp), %rdi
callq 0xf7c0
jmp 0x5a015
movl $0x2, 0x2b8(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x310(%rsp), %rsi
callq 0x78110
jmp 0x5a037
leaq 0x78(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xfa00
movq 0x30(%rsp), %rdi
movq 0x44c(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rdx
leaq 0x90(%rsp), %rsi
xorl %ecx, %ecx
callq 0xa9c0
jmp 0x5a06e
movl $0x0, 0x6c(%rsp)
movslq 0x6c(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x78(%rsp), %rdi
callq 0xfa10
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jae 0x5a175
movslq 0x6c(%rsp), %rsi
leaq 0x78(%rsp), %rdi
callq 0xfa30
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movslq 0x6c(%rsp), %rsi
leaq 0x2c0(%rsp), %rdi
callq 0xfa30
movsd 0x20(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0x5a076
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e0(%rsp)
movl %eax, 0x2dc(%rsp)
jmp 0x5a118
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e0(%rsp)
movl %eax, 0x2dc(%rsp)
leaq 0x2f0(%rsp), %rdi
callq 0x9410
leaq 0x2ef(%rsp), %rdi
callq 0x97d0
jmp 0x5a323
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e0(%rsp)
movl %eax, 0x2dc(%rsp)
jmp 0x5a316
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e0(%rsp)
movl %eax, 0x2dc(%rsp)
jmp 0x5a309
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e0(%rsp)
movl %eax, 0x2dc(%rsp)
jmp 0x5a2ff
movl 0x44c(%rsp), %esi
movl 0x450(%rsp), %edx
leaq 0x310(%rsp), %rdi
callq 0x56720
jmp 0x5a192
leaq 0x50(%rsp), %rdi
leaq 0x310(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x28720
jmp 0x5a1ab
movb $0x1, 0x457(%rsp)
movl $0x0, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
movq %rax, 0x18(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0xfa10
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x5a27d
movl 0x4c(%rsp), %eax
movl %eax, %esi
leaq 0x2c0(%rsp), %rdi
callq 0xfa30
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, %esi
leaq 0x50(%rsp), %rdi
callq 0xfa30
movsd 0x8(%rsp), %xmm0
movsd (%rax), %xmm1
subsd %xmm1, %xmm0
callq 0x5f0c0
movsd %xmm0, 0x10(%rsp)
jmp 0x5a22a
movsd 0x10(%rsp), %xmm0
movsd 0x21aa0(%rip), %xmm1    # 0x7bcd8
ucomisd %xmm1, %xmm0
jbe 0x5a26b
movb $0x0, 0x457(%rsp)
jmp 0x5a26b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2e0(%rsp)
movl %eax, 0x2dc(%rsp)
leaq 0x50(%rsp), %rdi
callq 0xfa50
jmp 0x5a2ff
jmp 0x5a26d
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x5a1bb
testb $0x1, 0x457(%rsp)
je 0x5a299
leaq 0x21a8c(%rip), %rdi     # 0x7bd1a
xorl %eax, %eax
callq 0x9040
jmp 0x5a297
jmp 0x5a2ab
leaq 0x21a82(%rip), %rdi     # 0x7bd22
xorl %eax, %eax
callq 0x9040
jmp 0x5a2a9
jmp 0x5a2ab
movb 0x457(%rsp), %al
movb %al, 0x7(%rsp)
leaq 0x50(%rsp), %rdi
callq 0xfa50
leaq 0x78(%rsp), %rdi
callq 0xfa50
leaq 0x90(%rsp), %rdi
callq 0xf9d0
leaq 0x2c0(%rsp), %rdi
callq 0xfa50
leaq 0x310(%rsp), %rdi
callq 0x5efc0
movb 0x7(%rsp), %al
andb $0x1, %al
addq $0x458, %rsp            # imm = 0x458
retq
leaq 0x78(%rsp), %rdi
callq 0xfa50
leaq 0x90(%rsp), %rdi
callq 0xf9d0
leaq 0x2c0(%rsp), %rdi
callq 0xfa50
leaq 0x310(%rsp), %rdi
callq 0x5efc0
movq 0x2e0(%rsp), %rdi
callq 0x9cf0
nopl (%rax)