Skip to content

Commit f2e0457

Browse files
committed
Add test for repeat loop count rounding
1 parent b96ae5b commit f2e0457

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/dev/llvm/llvmcodebuilder_test.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,6 @@ TEST_F(LLVMCodeBuilderTest, IfStatement)
445445
ASSERT_EQ(testing::internal::GetCapturedStdout(), expected);
446446
}
447447

448-
// TODO: Write a test for count rounding
449448
TEST_F(LLVMCodeBuilderTest, RepeatLoop)
450449
{
451450
createBuilder(true);
@@ -466,12 +465,18 @@ TEST_F(LLVMCodeBuilderTest, RepeatLoop)
466465
m_builder->addFunctionCall("test_function_no_args", Compiler::StaticType::Void, {});
467466
m_builder->endLoop();
468467

469-
m_builder->addConstValue("2");
468+
m_builder->addConstValue("2.4");
470469
m_builder->beginRepeatLoop();
471470
m_builder->addConstValue(0);
472471
m_builder->addFunctionCall("test_function_1_arg", Compiler::StaticType::Void, { Compiler::StaticType::String });
473472
m_builder->endLoop();
474473

474+
m_builder->addConstValue("2.5");
475+
m_builder->beginRepeatLoop();
476+
m_builder->addConstValue(1);
477+
m_builder->addFunctionCall("test_function_1_arg", Compiler::StaticType::Void, { Compiler::StaticType::String });
478+
m_builder->endLoop();
479+
475480
// Count returned by function
476481
m_builder->addConstValue(2);
477482
m_builder->addFunctionCall("test_const_number", Compiler::StaticType::Number, { Compiler::StaticType::Number });
@@ -513,6 +518,9 @@ TEST_F(LLVMCodeBuilderTest, RepeatLoop)
513518
"no_args\n"
514519
"1_arg 0\n"
515520
"1_arg 0\n"
521+
"1_arg 1\n"
522+
"1_arg 1\n"
523+
"1_arg 1\n"
516524
"no_args\n"
517525
"no_args\n"
518526
"1_arg 1\n"

0 commit comments

Comments
 (0)