// File: /workspace/github_cpp_makefile_star2_O2/pranavmodx[P]modlang/test/parser_test.cpp
// Function: TestIntegerLiteralExpression()
void TestIntegerLiteralExpression()
{
	std::string input = "5;";

	Lexer lexer;
	lexer.New(input);

	Parser parser;
	parser.New(lexer);

	Program *program = parser.ParseProgram();

	checkParserErrors(parser);

	if (program == nullptr)
		std::cout << "ParseProgram() returned null" << std::endl;

	if (program->statements.size() != 1)
		std::cout << "program->statements does not contain 1 statements, got " << program->statements.size() << std::endl;

	Statement *stmt;
	ExpressionStatement *expStmt;
	IntegerLiteral *intLit;

	for (int i = 0; i < program->statements.size(); i++)
	{
		stmt = program->statements[i];

		expStmt = ((ExpressionStatement *)stmt);

		if (expStmt->tokenLiteral() != "5")
			std::cout << "stmt->tokenLiteral() not '5'"
					  << ", got " << stmt->tokenLiteral() << std::endl;

		intLit = ((IntegerLiteral *)expStmt->expression);

		if (intLit->value != 5)
			std::cout << "intLit->value not '5'"
					  << ", got " << stmt->tokenLiteral() << std::endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
leaq 0xa2cb(%rip), %rsi      # 0x1126d
leaq 0x58(%rsp), %rbx
leaq 0x78(%rsp), %rdx
movq %rbx, %rdi
callq 0x7470
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x83a6
leaq 0x78(%rsp), %rdi
callq 0xb630
leaq 0x78(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xb9cc
leaq 0x78(%rsp), %rdi
callq 0xd1ee
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x71d4
testq %rbx, %rbx
jne 0x7022
movq 0x12fc2(%rip), %rdi     # 0x19fd0
leaq 0xa0e4(%rip), %rsi      # 0x110f9
callq 0x41b0
movq %rax, %rdi
callq 0x40e0
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
cmpq $0x8, %rax
je 0x705f
movq 0x12f99(%rip), %rdi     # 0x19fd0
leaq 0xa1bb(%rip), %rsi      # 0x111f9
callq 0x41b0
movq 0x10(%rbx), %rsi
subq 0x8(%rbx), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x4130
movq %rax, %rdi
callq 0x40e0
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
leaq 0xa1bc(%rip), %rbp      # 0x1122a
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jbe 0x7157
movq (%rax,%r12,8), %r13
movq (%r13), %rax
movq %r14, %rdi
movq %r13, %rsi
callq *(%rax)
movq %r14, %rdi
leaq 0xa1d0(%rip), %rsi      # 0x11270
callq 0x7557
movl %eax, %r15d
movq %r14, %rdi
callq 0x4368
testb %r15b, %r15b
je 0x70fd
movq 0x12f14(%rip), %rdi     # 0x19fd0
leaq 0xa1af(%rip), %rsi      # 0x11272
callq 0x41b0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x41b0
movq %rax, %r15
movq (%r13), %rax
movq %r14, %rdi
movq %r13, %rsi
callq *(%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x41a0
movq %rax, %rdi
callq 0x40e0
movq %r14, %rdi
callq 0x4368
movq 0x48(%r13), %rax
cmpl $0x5, 0x48(%rax)
je 0x714f
movq 0x12ec2(%rip), %rdi     # 0x19fd0
leaq 0xa17a(%rip), %rsi      # 0x1128f
callq 0x41b0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x41b0
movq %rax, %r15
movq (%r13), %rax
movq %r14, %rdi
movq %r13, %rsi
callq *(%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x41a0
movq %rax, %rdi
callq 0x40e0
movq %r14, %rdi
callq 0x4368
incq %r12
jmp 0x706e
leaq 0x78(%rsp), %rdi
callq 0x7508
leaq 0x28(%rsp), %rdi
callq 0x4368
leaq 0x58(%rsp), %rdi
callq 0x4368
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x71ab
jmp 0x718b
movq %rax, %rbx
jmp 0x71b8
jmp 0x71ab
jmp 0x71ab
jmp 0x71ab
jmp 0x71ab
jmp 0x719c
jmp 0x719c
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4368
jmp 0x71ae
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x7508
leaq 0x28(%rsp), %rdi
callq 0x4368
leaq 0x58(%rsp), %rdi
callq 0x4368
movq %rbx, %rdi
callq 0x4320