mirror of
https://github.com/open-goal/jak-project
synced 2026-09-09 20:21:28 -04:00
Fix remaining failing tests
This commit is contained in:
@@ -77,3 +77,42 @@ TEST_F(FunctionTests, Anonymous) {
|
||||
runner.run_static_test(env, testCategory, "declare-inline.static.gc", {"32\n"});
|
||||
runner.run_static_test(env, testCategory, "lambda-1.static.gc", {"2\n"});
|
||||
}
|
||||
|
||||
TEST_F(FunctionTests, InlineIsInline) {
|
||||
auto code = compiler.get_goos().reader.read_from_file(
|
||||
{"test/goalc/source_templates/functions/declare-inline.static.gc"});
|
||||
auto compiled = compiler.compile_object_file("test-code", code, true);
|
||||
EXPECT_EQ(compiled->functions().size(), 2);
|
||||
auto& ir = compiled->top_level_function().code();
|
||||
bool got_mult = false;
|
||||
for (auto& x : ir) {
|
||||
EXPECT_EQ(dynamic_cast<IR_FunctionCall*>(x.get()), nullptr);
|
||||
auto as_im = dynamic_cast<IR_IntegerMath*>(x.get());
|
||||
if (as_im) {
|
||||
EXPECT_EQ(as_im->get_kind(), IntegerMathKind::IMUL_32);
|
||||
got_mult = true;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(got_mult);
|
||||
}
|
||||
|
||||
TEST_F(FunctionTests, AllowInline) {
|
||||
auto code = compiler.get_goos().reader.read_from_file(
|
||||
{"test/goalc/source_templates/functions/inline-call.static.gc"});
|
||||
auto compiled = compiler.compile_object_file("test-code", code, true);
|
||||
EXPECT_EQ(compiled->functions().size(), 2);
|
||||
auto& ir = compiled->top_level_function().code();
|
||||
int got_mult = 0;
|
||||
int got_call = 0;
|
||||
for (auto& x : ir) {
|
||||
if (dynamic_cast<IR_FunctionCall*>(x.get())) {
|
||||
got_call++;
|
||||
}
|
||||
auto as_im = dynamic_cast<IR_IntegerMath*>(x.get());
|
||||
if (as_im && as_im->get_kind() == IntegerMathKind::IMUL_32) {
|
||||
got_mult++;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(got_mult, 1);
|
||||
EXPECT_EQ(got_call, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user