Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/web/test/cpp/TestTileGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,10 @@ TEST_F(TileGeneratorTest, TechResponseReportsTheFullOrientation)
break;
}
}
ASSERT_NE(die_entry, nullptr);
if (die_entry == nullptr) {
ADD_FAILURE() << "tech response has no chiplet " << die0->getName();
return;
}
Comment on lines +2171 to +2174

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In Google Test, FAIL() is a fatal assertion macro that automatically generates a failure and returns from the current function. Using FAIL() is more concise and idiomatic than combining ADD_FAILURE() with an explicit return; statement.

  if (die_entry == nullptr) {
    FAIL() << "tech response has no chiplet " << die0->getName();
  }

EXPECT_EQ(die_entry->at("orient").as_string(), "MZ")
<< "the 3D orientation collapsed to its 2D half, losing the flip";
EXPECT_TRUE(die_entry->at("mirror_z").as_bool());
Expand Down Expand Up @@ -4946,8 +4949,10 @@ TEST_F(TileGeneratorTest, LayerHierarchyBacksideCategory)
break;
}
}
ASSERT_NE(backside_node, nullptr)
<< "layer_hierarchy missing Backside category node";
if (backside_node == nullptr) {
ADD_FAILURE() << "layer_hierarchy missing Backside category node";
return;
}
Comment on lines +4952 to +4955

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similarly, FAIL() can be used here to simplify the fatal failure and return logic into a single idiomatic Google Test macro call.

  if (backside_node == nullptr) {
    FAIL() << "layer_hierarchy missing Backside category node";
  }

EXPECT_EQ(backside_node->at("type").as_string(), "category");

// The backside node should contain exactly metal1 and via1.
Expand Down
Loading