// File: nmmmnu[P]HM3/hm3/test/test_pair.cc
// Function: pair_test(char const*)
static void pair_test(const char *module){
	const char *key = "abcdef";
	const char *val = "1234567890";

	const Pair p = { key, val };

	const Pair t = Pair::tombstone(key);

	PRINTF_TEST("null bool",	p == true			);
	PRINTF_TEST("null bool tomb",	p == true			);

	PRINTF_TEST("tombstone",	t.isTombstone()			);

	//PRINTF_TEST("isNULL",		! p.isNULL()			);

	PRINTF_TEST("key",		p.getKey() == key		);
	PRINTF_TEST("val",		p.getVal() == val		);

	PRINTF_TEST("cmp",		p.cmp(key) == 0			);
	PRINTF_TEST("cmp",		p.cmp("~~~ non existent") < 0	);
	PRINTF_TEST("cmp",		p.cmp("!!! non existent") > 0	);

	PRINTF_TEST("cmp",		p.cmp(t) == 0			);

	PRINTF_TEST("cmp null",		p.cmp((char *) nullptr)		);

	PRINTF_TEST("eq",		p.equals(key)			);
	PRINTF_TEST("!eq",		! p.equals("something")		);

	PRINTF_TEST("valid",		p.valid()			);
	PRINTF_TEST("valid",		p.valid(t)			);

	{
	const Pair p2 = { "__smaller", "val"};
	PRINTF_TEST("cmp pair",		p.cmp(p) == 0			);
	PRINTF_TEST("cmp pair",		p2.cmp(p) < 0			);
	PRINTF_TEST("cmp pair",		p.cmp(p2) > 0			);

	PRINTF_TEST("eq pair",		p.equals(p)			);
	PRINTF_TEST("eq pair",		! p.equals(p2)			);
	PRINTF_TEST("!eq pair",		! p2.equals(p)			);
	}

	{
	Pair m1 = { key, val };

	const Pair m2 = std::move(m1);
	PRINTF_TEST("move c-tor",	m2.getKey() == key		);

	const Pair m3 = m2;
	PRINTF_TEST("copy c-tor",	m2.getKey() == key		);
	PRINTF_TEST("copy c-tor",	m3.getKey() == key		);

	m1 = m2;
	PRINTF_TEST("copy assign",	m1.getKey() == key		);
	}

	p.print();
	t.print();
}

// Assembly:
subq $0x218, %rsp            # imm = 0x218
movq %rdi, 0x210(%rsp)
leaq 0x48ae(%rip), %rax      # 0x60d4
movq %rax, 0x208(%rsp)
leaq 0x48a6(%rip), %rax      # 0x60db
movq %rax, 0x200(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x1e8(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
callq 0x2bd0
movq 0x200(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
movq %rdi, 0xe8(%rsp)
callq 0x2bd0
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
leaq 0x1f8(%rsp), %rdi
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x3630
movq 0x208(%rsp), %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x2bd0
jmp 0x18b1
leaq 0x1d0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x3430
jmp 0x18c8
movq 0x210(%rsp), %rax
movq %rax, 0xd8(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x3240
movq 0xd8(%rsp), %rsi
movb %al, %dl
leaq 0x476c(%rip), %rax      # 0x6062
leaq 0x4768(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x4730(%rip), %rdi      # 0x603a
leaq 0x4789(%rip), %rdx      # 0x609a
xorl %eax, %eax
callq 0x1030
jmp 0x191a
movq 0x210(%rsp), %rax
movq %rax, 0xd0(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x3240
movq 0xd0(%rsp), %rsi
movb %al, %dl
leaq 0x471a(%rip), %rax      # 0x6062
leaq 0x4716(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x46de(%rip), %rdi      # 0x603a
leaq 0x4783(%rip), %rdx      # 0x60e6
xorl %eax, %eax
callq 0x1030
jmp 0x196c
movq 0x210(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x3b00
movq 0xc8(%rsp), %rsi
movb %al, %dl
leaq 0x46c8(%rip), %rax      # 0x6062
leaq 0x46c4(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x468c(%rip), %rdi      # 0x603a
leaq 0x4740(%rip), %rdx      # 0x60f5
xorl %eax, %eax
callq 0x1030
jmp 0x19be
movq 0x210(%rsp), %rax
movq %rax, 0xc0(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x37a0
movq %rax, 0x1a0(%rsp)
movq %rdx, 0x1a8(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
callq 0x2c50
movq 0xc0(%rsp), %rsi
movb %al, %dl
leaq 0x4651(%rip), %rax      # 0x6062
leaq 0x464d(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x4615(%rip), %rdi      # 0x603a
leaq 0x468e(%rip), %rdx      # 0x60ba
xorl %eax, %eax
callq 0x1030
jmp 0x1a35
movq 0x210(%rsp), %rax
movq %rax, 0xb8(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x3830
movq %rax, 0x190(%rsp)
movq %rdx, 0x198(%rsp)
movq 0x200(%rsp), %rsi
leaq 0x190(%rsp), %rdi
callq 0x2c50
movq 0xb8(%rsp), %rsi
movb %al, %dl
leaq 0x45da(%rip), %rax      # 0x6062
leaq 0x45d6(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x459e(%rip), %rdi      # 0x603a
leaq 0x4620(%rip), %rdx      # 0x60c3
xorl %eax, %eax
callq 0x1030
jmp 0x1aac
movq 0x210(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x1f8(%rsp), %rdi
callq 0x3970
movq 0xb0(%rsp), %rsi
testl %eax, %eax
leaq 0x4580(%rip), %rax      # 0x6062
leaq 0x457c(%rip), %rcx      # 0x6065
cmoveq %rax, %rcx
leaq 0x4546(%rip), %rdi      # 0x603a
leaq 0x45d1(%rip), %rdx      # 0x60cc
xorl %eax, %eax
callq 0x1030
jmp 0x1b04
movq 0x210(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0x455d(%rip), %rsi      # 0x6078
leaq 0x1f8(%rsp), %rdi
callq 0x3970
movq 0xa8(%rsp), %rsi
testl %eax, %eax
leaq 0x4529(%rip), %rax      # 0x6062
leaq 0x4525(%rip), %rcx      # 0x6065
cmovsq %rax, %rcx
leaq 0x44ef(%rip), %rdi      # 0x603a
leaq 0x457a(%rip), %rdx      # 0x60cc
xorl %eax, %eax
callq 0x1030
jmp 0x1b5b
movq 0x210(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x4517(%rip), %rsi      # 0x6089
leaq 0x1f8(%rsp), %rdi
callq 0x3970
movq 0xa0(%rsp), %rsi
testl %eax, %eax
leaq 0x44d2(%rip), %rax      # 0x6062
leaq 0x44ce(%rip), %rcx      # 0x6065
cmovgq %rax, %rcx
leaq 0x4498(%rip), %rdi      # 0x603a
leaq 0x4523(%rip), %rdx      # 0x60cc
xorl %eax, %eax
callq 0x1030
jmp 0x1bb2
movq 0x210(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0x1f8(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0x34a0
movq 0x98(%rsp), %rsi
testl %eax, %eax
leaq 0x447a(%rip), %rax      # 0x6062
leaq 0x4476(%rip), %rcx      # 0x6065
cmoveq %rax, %rcx
leaq 0x4440(%rip), %rdi      # 0x603a
leaq 0x44cb(%rip), %rdx      # 0x60cc
xorl %eax, %eax
callq 0x1030
jmp 0x1c0a
movq 0x210(%rsp), %rax
movq %rax, 0x88(%rsp)
xorl %eax, %eax
movl %eax, 0x94(%rsp)
movl %eax, %esi
leaq 0x1f8(%rsp), %rdi
callq 0x3970
movq 0x88(%rsp), %rsi
movl %eax, %ecx
movl 0x94(%rsp), %eax
testl %ecx, %ecx
leaq 0x4416(%rip), %rdx      # 0x6062
leaq 0x4412(%rip), %rcx      # 0x6065
cmovneq %rdx, %rcx
leaq 0x43dc(%rip), %rdi      # 0x603a
leaq 0x449a(%rip), %rdx      # 0x60ff
callq 0x1030
jmp 0x1c6c
movq 0x210(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x1f8(%rsp), %rdi
callq 0x3a30
movq 0x80(%rsp), %rsi
movb %al, %dl
leaq 0x43c0(%rip), %rax      # 0x6062
leaq 0x43bc(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x4384(%rip), %rdi      # 0x603a
leaq 0x444c(%rip), %rdx      # 0x6109
xorl %eax, %eax
callq 0x1030
jmp 0x1cc6
movq 0x210(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x4432(%rip), %rsi      # 0x610c
leaq 0x1f8(%rsp), %rdi
callq 0x3a30
movq 0x78(%rsp), %rsi
movb %al, %dl
leaq 0x4370(%rip), %rax      # 0x6065
leaq 0x4366(%rip), %rcx      # 0x6062
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x4331(%rip), %rdi      # 0x603a
leaq 0x43f8(%rip), %rdx      # 0x6108
xorl %eax, %eax
callq 0x1030
jmp 0x1d19
movq 0x210(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x1f8(%rsp), %rdi
xorl %esi, %esi
movl %esi, 0x74(%rsp)
callq 0x3b50
movq 0x68(%rsp), %rsi
movb %al, %dil
movl 0x74(%rsp), %eax
leaq 0x4316(%rip), %rdx      # 0x6062
leaq 0x4312(%rip), %rcx      # 0x6065
testb %dil, %dil
cmovneq %rdx, %rcx
leaq 0x42d9(%rip), %rdi      # 0x603a
leaq 0x4302(%rip), %rdx      # 0x606a
callq 0x1030
jmp 0x1d6f
movq 0x210(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x1f8(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
xorl %edx, %edx
movl %edx, 0x64(%rsp)
callq 0x34e0
movq 0x58(%rsp), %rsi
movb %al, %dil
movl 0x64(%rsp), %eax
leaq 0x42b8(%rip), %rdx      # 0x6062
leaq 0x42b4(%rip), %rcx      # 0x6065
testb %dil, %dil
cmovneq %rdx, %rcx
leaq 0x427b(%rip), %rdi      # 0x603a
leaq 0x42a4(%rip), %rdx      # 0x606a
callq 0x1030
jmp 0x1dcd
leaq 0x4342(%rip), %rsi      # 0x6116
leaq 0x178(%rsp), %rdi
callq 0x2bd0
jmp 0x1de3
leaq 0x42d9(%rip), %rsi      # 0x60c3
leaq 0x168(%rsp), %rdi
callq 0x2bd0
jmp 0x1df9
leaq 0x188(%rsp), %rdi
leaq 0x178(%rsp), %rsi
leaq 0x168(%rsp), %rdx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x3630
jmp 0x1e1e
movq 0x210(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x1f8(%rsp), %rsi
movq %rsi, %rdi
callq 0x34a0
movq 0x50(%rsp), %rsi
testl %eax, %eax
leaq 0x4219(%rip), %rax      # 0x6062
leaq 0x4215(%rip), %rcx      # 0x6065
cmoveq %rax, %rcx
leaq 0x41df(%rip), %rdi      # 0x603a
leaq 0x42be(%rip), %rdx      # 0x6120
xorl %eax, %eax
callq 0x1030
jmp 0x1e6b
movq 0x210(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x188(%rsp), %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x34a0
movq 0x48(%rsp), %rsi
testl %eax, %eax
leaq 0x41c7(%rip), %rax      # 0x6062
leaq 0x41c3(%rip), %rcx      # 0x6065
cmovsq %rax, %rcx
leaq 0x418d(%rip), %rdi      # 0x603a
leaq 0x426c(%rip), %rdx      # 0x6120
xorl %eax, %eax
callq 0x1030
jmp 0x1ebd
movq 0x210(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x1f8(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x34a0
movq 0x40(%rsp), %rsi
testl %eax, %eax
leaq 0x4175(%rip), %rax      # 0x6062
leaq 0x4171(%rip), %rcx      # 0x6065
cmovgq %rax, %rcx
leaq 0x413b(%rip), %rdi      # 0x603a
leaq 0x421a(%rip), %rdx      # 0x6120
xorl %eax, %eax
callq 0x1030
jmp 0x1f0f
movq 0x210(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x1f8(%rsp), %rsi
movq %rsi, %rdi
callq 0x3510
movq 0x38(%rsp), %rsi
movb %al, %dl
leaq 0x4128(%rip), %rax      # 0x6062
leaq 0x4124(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x40ec(%rip), %rdi      # 0x603a
leaq 0x41d5(%rip), %rdx      # 0x612a
xorl %eax, %eax
callq 0x1030
jmp 0x1f5e
movq 0x210(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x1f8(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x3510
movq 0x30(%rsp), %rsi
movb %al, %dl
leaq 0x40d7(%rip), %rax      # 0x6065
leaq 0x40cd(%rip), %rcx      # 0x6062
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x4098(%rip), %rdi      # 0x603a
leaq 0x4181(%rip), %rdx      # 0x612a
xorl %eax, %eax
callq 0x1030
jmp 0x1fb2
movq 0x210(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x188(%rsp), %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x3510
movq 0x28(%rsp), %rsi
movb %al, %dl
leaq 0x4083(%rip), %rax      # 0x6065
leaq 0x4079(%rip), %rcx      # 0x6062
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x4044(%rip), %rdi      # 0x603a
leaq 0x412c(%rip), %rdx      # 0x6129
xorl %eax, %eax
callq 0x1030
jmp 0x2006
leaq 0x188(%rsp), %rdi
callq 0x35c0
movq 0x208(%rsp), %rsi
leaq 0x150(%rsp), %rdi
callq 0x2bd0
jmp 0x202a
movq 0x200(%rsp), %rsi
leaq 0x140(%rsp), %rdi
callq 0x2bd0
jmp 0x2041
leaq 0x160(%rsp), %rdi
leaq 0x150(%rsp), %rsi
leaq 0x140(%rsp), %rdx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x3630
jmp 0x2066
leaq 0x138(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x35d0
jmp 0x207d
movq 0x210(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x37a0
movq %rax, 0x128(%rsp)
movq %rdx, 0x130(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x128(%rsp), %rdi
callq 0x2c50
movq 0x20(%rsp), %rsi
movb %al, %dl
leaq 0x3f98(%rip), %rax      # 0x6062
leaq 0x3f94(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x3f5c(%rip), %rdi      # 0x603a
leaq 0x404d(%rip), %rdx      # 0x6132
xorl %eax, %eax
callq 0x1030
jmp 0x20ee
leaq 0x120(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x36f0
jmp 0x2105
movq 0x210(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x37a0
movq %rax, 0x110(%rsp)
movq %rdx, 0x118(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x2c50
movq 0x18(%rsp), %rsi
movb %al, %dl
leaq 0x3f10(%rip), %rax      # 0x6062
leaq 0x3f0c(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x3ed4(%rip), %rdi      # 0x603a
leaq 0x3fd0(%rip), %rdx      # 0x613d
xorl %eax, %eax
callq 0x1030
jmp 0x2176
movq 0x210(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x37a0
movq %rax, 0x100(%rsp)
movq %rdx, 0x108(%rsp)
movq 0x208(%rsp), %rsi
leaq 0x100(%rsp), %rdi
callq 0x2c50
movq 0x10(%rsp), %rsi
movb %al, %dl
leaq 0x3e9f(%rip), %rax      # 0x6062
leaq 0x3e9b(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x3e63(%rip), %rdi      # 0x603a
leaq 0x3f5f(%rip), %rdx      # 0x613d
xorl %eax, %eax
callq 0x1030
jmp 0x21e7
leaq 0x160(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x3730
jmp 0x21fe
movq 0x210(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x37a0
movq %rax, 0xf0(%rsp)
movq %rdx, 0xf8(%rsp)
movq 0x208(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x2c50
movq 0x8(%rsp), %rsi
movb %al, %dl
leaq 0x3e17(%rip), %rax      # 0x6062
leaq 0x3e13(%rip), %rcx      # 0x6065
testb %dl, %dl
cmovneq %rax, %rcx
leaq 0x3ddb(%rip), %rdi      # 0x603a
leaq 0x3ee2(%rip), %rdx      # 0x6148
xorl %eax, %eax
callq 0x1030
jmp 0x226f
leaq 0x120(%rsp), %rdi
callq 0x35c0
leaq 0x138(%rsp), %rdi
callq 0x35c0
leaq 0x160(%rsp), %rdi
callq 0x35c0
leaq 0x1f8(%rsp), %rdi
callq 0x3c00
leaq 0x1d0(%rsp), %rdi
callq 0x3c00
leaq 0x1d0(%rsp), %rdi
callq 0x35c0
leaq 0x1f8(%rsp), %rdi
callq 0x35c0
addq $0x218, %rsp            # imm = 0x218
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x239b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x238e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
leaq 0x188(%rsp), %rdi
callq 0x35c0
jmp 0x238e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x2381
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x2374
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x35c0
leaq 0x138(%rsp), %rdi
callq 0x35c0
leaq 0x160(%rsp), %rdi
callq 0x35c0
leaq 0x1d0(%rsp), %rdi
callq 0x35c0
leaq 0x1f8(%rsp), %rdi
callq 0x35c0
movq 0x1b8(%rsp), %rdi
callq 0x1170
nopw %cs:(%rax,%rax)