| 89 | } |
| 90 | |
| 91 | TEST_F(WhileLoopTest, Basic) { |
| 92 | // Create loop: while (i < 10) i += 1 |
| 93 | Init(1); |
| 94 | CreateLoop(LessThanTenCond, AddOneBody); |
| 95 | |
| 96 | // Verify some output invariants |
| 97 | WhileContext* while_ctx; |
| 98 | for (int i = 0; i < outputs_.size(); ++i) { |
| 99 | Node* node = outputs_[i].node(); |
| 100 | ASSERT_TRUE(node->IsExit()) << "Output node " << i << ":\n" |
| 101 | << node->DebugString(); |
| 102 | ASSERT_TRUE(node->while_ctx() != nullptr) << i; |
| 103 | if (i == 0) { |
| 104 | while_ctx = node->while_ctx(); |
| 105 | EXPECT_EQ(while_ctx->frame_name(), kFrameName); |
| 106 | } else { |
| 107 | EXPECT_EQ(node->while_ctx(), while_ctx) << i; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // Run the loop and test we get the expected results |
| 112 | Run<int>({1}, {10}); |
| 113 | Run<int>({11}, {11}); |
| 114 | } |
| 115 | |
| 116 | TEST_F(WhileLoopTest, WrongCondOutputType) { |
| 117 | Init(1); |
nothing calls this directly
no test coverage detected