Skip to content

Commit 7e28c7d

Browse files
committed
better builder test
1 parent 1cc81b1 commit 7e28c7d

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

tests/cpp/ir/ir_builder_test.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@ TEST(IRBuilder, Bool) {
1515
IRBuilder builder;
1616
auto *bool_true = builder.get_bool(true);
1717
auto *bool_false = builder.get_bool(false);
18-
auto ir = builder.extract_ir();
19-
// auto *result = builder.create_print(bool_true, "", "");
20-
// auto *print = result->cast<PrintStmt>();
18+
builder.create_and(bool_true, bool_false);
19+
auto block = builder.extract_ir();
20+
2121
auto print = irpass::make_pass_printer(true, true, "", bool_true);
22-
// irpass::re_id(ir);
23-
std::cout << std::flush;
24-
irpass::print(bool_true);
25-
std::cout << std::flush;
26-
std::cout << std::flush;
27-
irpass::print(bool_false);
28-
std::cout << std::flush;
22+
std::string ir_string;
23+
irpass::print(block->get_ir_root(), &ir_string);
24+
EXPECT_STREQ(ir_string.c_str(), R"(kernel {
25+
<u1> $0 = const true
26+
<u1> $1 = const false
27+
$2 = bit_and $0 $1
28+
}
29+
)");
2930
}
3031

3132
TEST(IRBuilder, Basic) {

0 commit comments

Comments
 (0)