// File: rocket323[P]fishdb/tests/test_main.cpp
// Function: test_encode()
MU_TEST(test_encode)
{
    Pager pager;
    int ret = pager.Init("test3.fdb");
    if (ret != 0)
    {
        printf("open test3.fdb failed\n");
        return;
    }
    srand(time(NULL));

    int N = 1;
    std::vector<int64_t> pgno;
    for (int i = 0; i < N; ++i)
    {
        auto mp = pager.NewPage();
        pgno.push_back(mp->header.page_no);
        FillPage(mp);
    }

    for (int i = 0; i < (int)pgno.size(); ++i)
    {
        auto mp = pager.GetPage(pgno[i]);
        printf("children_size[%zu], kvs_size[%zu]\n", mp->children.size(), mp->kvs.size());
        assert((int)mp->children.size() == ks);
        assert((int)mp->kvs.size() == ks);
    }

    pager.Close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
leaq -0x48(%rbp), %rdi
callq 0x5920
leaq -0x71(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x3440
movq -0xf0(%rbp), %rdx
leaq 0x10f17(%rip), %rsi     # 0x15129
leaq -0x70(%rbp), %rdi
callq 0x3350
jmp 0x421d
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x10490
movl %eax, -0xf4(%rbp)
jmp 0x4232
leaq -0x70(%rbp), %rdi
callq 0x3160
leaq -0x71(%rbp), %rdi
callq 0x32b0
movl -0xf4(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x42bd
leaq 0x10ed9(%rip), %rdi     # 0x15133
xorl %eax, %eax
callq 0x3050
jmp 0x4263
movl $0x1, -0x88(%rbp)
jmp 0x4570
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x429b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x3160
leaq -0x71(%rbp), %rdi
callq 0x32b0
jmp 0x458e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x458e
xorl %eax, %eax
movl %eax, %edi
callq 0x3210
movl %eax, %edi
callq 0x3230
movl $0x1, -0x8c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x5940
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jge 0x43d8
leaq -0xc0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x2, %edx
callq 0x109c0
jmp 0x4316
leaq -0xc0(%rbp), %rdi
callq 0x49a0
movq %rax, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x5960
jmp 0x4333
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x100(%rbp)
leaq -0xc0(%rbp), %rsi
callq 0x59d0
movq -0x100(%rbp), %rdi
callq 0x3660
jmp 0x435b
leaq -0xd0(%rbp), %rdi
callq 0x4980
leaq -0xc0(%rbp), %rdi
callq 0x4980
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x42ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x4582
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x43c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x4980
leaq -0xc0(%rbp), %rdi
callq 0x4980
jmp 0x4582
movl $0x0, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x104(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x5a00
movq %rax, %rcx
movl -0x104(%rbp), %eax
cmpl %ecx, %eax
jge 0x454f
movslq -0xd4(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x5a20
movq (%rax), %rdx
leaq -0xe8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
xorl %ecx, %ecx
callq 0x10c20
jmp 0x4435
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x49a0
movq %rax, %rdi
addq $0x48, %rdi
callq 0x5a00
movq -0x118(%rbp), %rdi
movq %rax, -0x110(%rbp)
callq 0x49a0
movq %rax, %rdi
addq $0x60, %rdi
callq 0x5a40
movq -0x110(%rbp), %rsi
movq %rax, %rdx
leaq 0x10cc6(%rip), %rdi     # 0x1514a
xorl %eax, %eax
callq 0x3050
jmp 0x448d
leaq -0xe8(%rbp), %rdi
callq 0x49a0
movq %rax, %rdi
addq $0x48, %rdi
callq 0x5a00
cmpl 0x19d9d(%rip), %eax     # 0x1e248
jne 0x44af
jmp 0x44ee
leaq 0x10cb7(%rip), %rdi     # 0x1516d
leaq 0x10c36(%rip), %rsi     # 0x150f3
movl $0x2f, %edx
leaq 0x10cc3(%rip), %rcx     # 0x1518c
callq 0x3180
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4980
jmp 0x4582
leaq -0xe8(%rbp), %rdi
callq 0x49a0
movq %rax, %rdi
addq $0x60, %rdi
callq 0x5a40
cmpl 0x19d3c(%rip), %eax     # 0x1e248
jne 0x4510
jmp 0x452f
leaq 0x10c88(%rip), %rdi     # 0x1519f
leaq 0x10bd5(%rip), %rsi     # 0x150f3
movl $0x30, %edx
leaq 0x10c62(%rip), %rcx     # 0x1518c
callq 0x3180
leaq -0xe8(%rbp), %rdi
callq 0x4980
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x43e2
leaq -0x48(%rbp), %rdi
callq 0x10650
jmp 0x455a
leaq -0xa8(%rbp), %rdi
callq 0x5a60
movl $0x0, -0x88(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5570
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0xa8(%rbp), %rdi
callq 0x5a60
leaq -0x48(%rbp), %rdi
callq 0x5570
movq -0x80(%rbp), %rdi
callq 0x3430