// File: swxlion[P]swxJson/tests/swxJsonAdvancedTest_fetch_v2.cpp
// Function: test_array()
void test_array()
{
	cout<<endl<<"[Test array] ..."<<endl;

	try {

		JsonPtr json = Json::parse(arrayDemo.c_str());
		cout<<"get json:"<<endl;
		cout<<json<<endl<<endl;

		cout<<endl<<"[Test array] Length matched testing ..."<<endl;

		test_array<std::string, 3>(json, "strArray", "--- string array: length matched version.", false);
		test_array<int, 5>(json, "intArray", "--- int array: length matched version.", false);

		cout<<endl<<"[Test array] Length miss matched ** without ** compatible testing ..."<<endl;

		try {
			test_array<std::string, 5>(json, "strArray", "--- string array: more length version.", false);
		}
		catch (const JsonNodeTypeMissMatchError &e)
		{
			cout<<"[Expectant error]: Type miss match."<<endl;
		}
		try {
			test_array<std::string, 2>(json, "strArray", "--- string array: less length version.", false);
		}
		catch (const JsonNodeTypeMissMatchError &e)
		{
			cout<<"[Expectant error]: Type miss match."<<endl;
		}

		try {
			test_array<int, 7>(json, "intArray", "--- int array: more length version.", false);
		}
		catch (const JsonNodeTypeMissMatchError &e)
		{
			cout<<"[Expectant error]: Type miss match."<<endl;
		}

		try {
			test_array<int, 3>(json, "intArray", "--- int array: less length version.", false);
		}
		catch (const JsonNodeTypeMissMatchError &e)
		{
			cout<<"[Expectant error]: Type miss match."<<endl;
		}

		cout<<endl<<"[Test array] Length miss matched ** with ** compatible testing ..."<<endl;

		test_array<std::string, 5>(json, "strArray", "--- string array: more length version.", true);
		test_array<std::string, 2>(json, "strArray", "--- string array: less length version.", true);

		test_array<int, 7>(json, "intArray", "--- int array: more length version.", true);
		test_array<int, 3>(json, "intArray", "--- int array: less length version.", true);

	}
	catch (const JsonError &e)
	{
		cout<<"[Error]: "<<e.message()<<" line: "<<e.lineNumber()<<", fun: "<<e.function()<<endl;
	}
}

// Assembly:
subq $0x1f8, %rsp            # imm = 0x1F8
movq 0x4c6fa(%rip), %rdi     # 0x97fd8
movq 0x4c6cb(%rip), %rsi     # 0x97fb0
movq %rsi, 0xf8(%rsp)
callq 0x4a360
movq %rax, %rdi
leaq 0x3692e(%rip), %rsi     # 0x8222a
callq 0x4a300
movq 0xf8(%rsp), %rsi
movq %rax, %rdi
callq 0x4a360
leaq 0x4ca20(%rip), %rdi     # 0x98338
callq 0x4a100
movq %rax, %rsi
leaq 0x1e8(%rsp), %rdi
callq 0x7d040
jmp 0x4b92f
movq 0x4c6a2(%rip), %rdi     # 0x97fd8
leaq 0x368c9(%rip), %rsi     # 0x82206
callq 0x4a300
movq %rax, 0xf0(%rsp)
jmp 0x4b94c
movq 0xf0(%rsp), %rdi
movq 0x4c655(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4b962
leaq 0x1c8(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0xe0(%rsp), %rsi
movq 0x4c64a(%rip), %rdi     # 0x97fd8
callq 0x69de0
movq %rax, 0xe8(%rsp)
jmp 0x4b99d
movq 0xe8(%rsp), %rdi
movq 0x4c604(%rip), %rsi     # 0x97fb0
callq 0x4a360
movq %rax, 0xd8(%rsp)
jmp 0x4b9bb
movq 0xd8(%rsp), %rdi
movq 0x4c5e6(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4b9d1
leaq 0x1c8(%rsp), %rdi
callq 0x4e270
movq 0x4c5f3(%rip), %rdi     # 0x97fd8
movq 0x4c5c4(%rip), %rsi     # 0x97fb0
callq 0x4a360
movq %rax, 0xd0(%rsp)
jmp 0x4b9fb
movq 0xd0(%rsp), %rdi
leaq 0x36831(%rip), %rsi     # 0x8223b
callq 0x4a300
movq %rax, 0xc8(%rsp)
jmp 0x4ba19
movq 0xc8(%rsp), %rdi
movq 0x4c588(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4ba2f
leaq 0x1b8(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0xc0(%rsp), %rdi
leaq 0x36808(%rip), %rsi     # 0x82263
leaq 0x3680a(%rip), %rdx     # 0x8226c
xorl %ecx, %ecx
callq 0x4e4b0
jmp 0x4ba6b
leaq 0x1b8(%rsp), %rdi
callq 0x4e270
leaq 0x1a8(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0xb8(%rsp), %rdi
leaq 0x367f2(%rip), %rsi     # 0x82296
leaq 0x367f4(%rip), %rdx     # 0x8229f
xorl %ecx, %ecx
callq 0x4e740
jmp 0x4bab4
leaq 0x1a8(%rsp), %rdi
callq 0x4e270
movq 0x4c510(%rip), %rdi     # 0x97fd8
movq 0x4c4e1(%rip), %rsi     # 0x97fb0
callq 0x4a360
movq %rax, 0xb0(%rsp)
jmp 0x4bade
movq 0xb0(%rsp), %rdi
leaq 0x367d9(%rip), %rsi     # 0x822c6
callq 0x4a300
movq %rax, 0xa8(%rsp)
jmp 0x4bafc
movq 0xa8(%rsp), %rdi
movq 0x4c4a5(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4bb12
leaq 0x198(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0xa0(%rsp), %rdi
leaq 0x36725(%rip), %rsi     # 0x82263
leaq 0x367c7(%rip), %rdx     # 0x8230c
xorl %ecx, %ecx
callq 0x4e990
jmp 0x4bb4e
leaq 0x198(%rsp), %rdi
callq 0x4e270
jmp 0x4bc8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
jmp 0x4c17a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x4e270
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x4e270
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x4e270
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x198(%rsp), %rdi
callq 0x4e270
movl 0x1dc(%rsp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x4c16d
movq 0x1e0(%rsp), %rdi
callq 0x4a0f0
movq %rax, 0x190(%rsp)
movq 0x4c383(%rip), %rdi     # 0x97fd8
leaq 0x3653f(%rip), %rsi     # 0x8219b
callq 0x4a300
movq %rax, 0x98(%rsp)
jmp 0x4bc6b
movq 0x98(%rsp), %rdi
movq 0x4c336(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4bc81
callq 0x4a4e0
jmp 0x4bc88
jmp 0x4bc8a
leaq 0x180(%rsp), %rdi
movq %rdi, 0x90(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0x90(%rsp), %rdi
leaq 0x365ad(%rip), %rsi     # 0x82263
leaq 0x36676(%rip), %rdx     # 0x82333
xorl %ecx, %ecx
callq 0x4ec20
jmp 0x4bcc6
leaq 0x180(%rsp), %rdi
callq 0x4e270
jmp 0x4bd7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
callq 0x4a4e0
jmp 0x4bcf3
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x4e270
movl 0x1dc(%rsp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x4c16d
movq 0x1e0(%rsp), %rdi
callq 0x4a0f0
movq %rax, 0x178(%rsp)
movq 0x4c28f(%rip), %rdi     # 0x97fd8
leaq 0x3644b(%rip), %rsi     # 0x8219b
callq 0x4a300
movq %rax, 0x88(%rsp)
jmp 0x4bd5f
movq 0x88(%rsp), %rdi
movq 0x4c242(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4bd75
callq 0x4a4e0
jmp 0x4bd7c
jmp 0x4bd7e
leaq 0x168(%rsp), %rdi
movq %rdi, 0x80(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0x80(%rsp), %rdi
leaq 0x364ec(%rip), %rsi     # 0x82296
leaq 0x365a9(%rip), %rdx     # 0x8235a
xorl %ecx, %ecx
callq 0x4eeb0
jmp 0x4bdba
leaq 0x168(%rsp), %rdi
callq 0x4e270
jmp 0x4be6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
callq 0x4a4e0
jmp 0x4bde7
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x4e270
movl 0x1dc(%rsp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x4c16d
movq 0x1e0(%rsp), %rdi
callq 0x4a0f0
movq %rax, 0x160(%rsp)
movq 0x4c19b(%rip), %rdi     # 0x97fd8
leaq 0x36357(%rip), %rsi     # 0x8219b
callq 0x4a300
movq %rax, 0x78(%rsp)
jmp 0x4be50
movq 0x78(%rsp), %rdi
movq 0x4c154(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4be63
callq 0x4a4e0
jmp 0x4be6a
jmp 0x4be6c
leaq 0x150(%rsp), %rdi
movq %rdi, 0x70(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0x70(%rsp), %rdi
leaq 0x36404(%rip), %rsi     # 0x82296
leaq 0x364e5(%rip), %rdx     # 0x8237e
xorl %ecx, %ecx
callq 0x4f100
jmp 0x4bea2
leaq 0x150(%rsp), %rdi
callq 0x4e270
jmp 0x4bf54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
callq 0x4a4e0
jmp 0x4becf
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x4e270
movl 0x1dc(%rsp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x4c16d
movq 0x1e0(%rsp), %rdi
callq 0x4a0f0
movq %rax, 0x148(%rsp)
movq 0x4c0b3(%rip), %rdi     # 0x97fd8
leaq 0x3626f(%rip), %rsi     # 0x8219b
callq 0x4a300
movq %rax, 0x68(%rsp)
jmp 0x4bf38
movq 0x68(%rsp), %rdi
movq 0x4c06c(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4bf4b
callq 0x4a4e0
jmp 0x4bf52
jmp 0x4bf54
movq 0x4c07d(%rip), %rdi     # 0x97fd8
movq 0x4c04e(%rip), %rsi     # 0x97fb0
callq 0x4a360
movq %rax, 0x60(%rsp)
jmp 0x4bf6e
movq 0x60(%rsp), %rdi
leaq 0x36428(%rip), %rsi     # 0x823a2
callq 0x4a300
movq %rax, 0x58(%rsp)
jmp 0x4bf86
movq 0x58(%rsp), %rdi
movq 0x4c01e(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4bf99
leaq 0x138(%rsp), %rdi
movq %rdi, 0x50(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0x50(%rsp), %rdi
leaq 0x362a4(%rip), %rsi     # 0x82263
leaq 0x36346(%rip), %rdx     # 0x8230c
movl $0x1, %ecx
callq 0x4e990
jmp 0x4bfd2
leaq 0x138(%rsp), %rdi
callq 0x4e270
leaq 0x128(%rsp), %rdi
movq %rdi, 0x48(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0x48(%rsp), %rdi
leaq 0x3625e(%rip), %rsi     # 0x82263
leaq 0x36327(%rip), %rdx     # 0x82333
movl $0x1, %ecx
callq 0x4ec20
jmp 0x4c018
leaq 0x128(%rsp), %rdi
callq 0x4e270
leaq 0x118(%rsp), %rdi
movq %rdi, 0x40(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0x40(%rsp), %rdi
leaq 0x3624b(%rip), %rsi     # 0x82296
leaq 0x36308(%rip), %rdx     # 0x8235a
movl $0x1, %ecx
callq 0x4eeb0
jmp 0x4c05e
leaq 0x118(%rsp), %rdi
callq 0x4e270
leaq 0x108(%rsp), %rdi
movq %rdi, 0x38(%rsp)
leaq 0x1e8(%rsp), %rsi
callq 0x4e240
movq 0x38(%rsp), %rdi
leaq 0x36205(%rip), %rsi     # 0x82296
leaq 0x362e6(%rip), %rdx     # 0x8237e
movl $0x1, %ecx
callq 0x4f100
jmp 0x4c0a4
leaq 0x108(%rsp), %rdi
callq 0x4e270
leaq 0x1e8(%rsp), %rdi
callq 0x4e270
jmp 0x4c267
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
callq 0x4a4e0
jmp 0x4c0de
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x4e270
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x4e270
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4e270
jmp 0x4c16d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
leaq 0x108(%rsp), %rdi
callq 0x4e270
leaq 0x1e8(%rsp), %rdi
callq 0x4e270
movl 0x1dc(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4c28c
movq 0x1e0(%rsp), %rdi
callq 0x4a0f0
movq %rax, 0x100(%rsp)
movq 0x4be2e(%rip), %rdi     # 0x97fd8
leaq 0x3605f(%rip), %rsi     # 0x82210
callq 0x4a300
movq %rax, 0x30(%rsp)
jmp 0x4c1bd
movq 0x100(%rsp), %rdi
callq 0x4e480
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x4a2c0
movq %rax, 0x28(%rsp)
jmp 0x4c1de
movq 0x28(%rsp), %rdi
leaq 0x36030(%rip), %rsi     # 0x8221a
callq 0x4a300
movq %rax, 0x20(%rsp)
jmp 0x4c1f6
movq 0x100(%rsp), %rdi
callq 0x4e490
movq 0x20(%rsp), %rdi
movl %eax, %esi
callq 0x4a510
movq %rax, 0x18(%rsp)
jmp 0x4c216
movq 0x18(%rsp), %rdi
leaq 0x36000(%rip), %rsi     # 0x82222
callq 0x4a300
movq %rax, 0x10(%rsp)
jmp 0x4c22e
movq 0x100(%rsp), %rdi
callq 0x4e4a0
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x4a300
movq %rax, 0x8(%rsp)
jmp 0x4c24f
movq 0x8(%rsp), %rdi
movq 0x4bd55(%rip), %rsi     # 0x97fb0
callq 0x4a360
jmp 0x4c262
callq 0x4a4e0
addq $0x1f8, %rsp            # imm = 0x1F8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1e0(%rsp)
movl %eax, 0x1dc(%rsp)
callq 0x4a4e0
jmp 0x4c28a
jmp 0x4c28c
movq 0x1e0(%rsp), %rdi
callq 0x4a520
movq %rax, %rdi
callq 0x4e020
nopw %cs:(%rax,%rax)