update test infra to accomodate std::string instead of const char*
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
This commit is contained in:
parent
5f46ad3dfb
commit
b5f647cb7f
|
|
@ -953,8 +953,8 @@ TEST_F(GraphDesignTest, GraphVerticesAndEdges) {
|
|||
Vertex *vertex = graph->pinDrvrVertex(pin);
|
||||
if (vertex) {
|
||||
// Vertex::name needs network
|
||||
const char *vname = vertex->name(network);
|
||||
EXPECT_NE(vname, nullptr);
|
||||
std::string vname = vertex->name(network);
|
||||
EXPECT_FALSE(vname.empty());
|
||||
found++;
|
||||
}
|
||||
}
|
||||
|
|
@ -979,9 +979,8 @@ TEST_F(GraphDesignTest, VertexName) {
|
|||
if (y_pin) {
|
||||
Vertex *v = graph->pinDrvrVertex(y_pin);
|
||||
if (v) {
|
||||
const char *name = v->name(network);
|
||||
EXPECT_NE(name, nullptr);
|
||||
EXPECT_NE(strlen(name), 0u);
|
||||
std::string name = v->name(network);
|
||||
EXPECT_FALSE(name.empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1076,7 +1075,7 @@ protected:
|
|||
FloatSeq *waveform = new FloatSeq;
|
||||
waveform->push_back(0.0f);
|
||||
waveform->push_back(5.0f);
|
||||
sta_->makeClock("clk", clk_pins, false, 10.0f, waveform, nullptr, sta_->cmdMode());
|
||||
sta_->makeClock("clk", clk_pins, false, 10.0f, waveform, "", sta_->cmdMode());
|
||||
|
||||
Clock *clk = sta_->cmdSdc()->findClock("clk");
|
||||
ASSERT_NE(clk, nullptr);
|
||||
|
|
@ -1456,7 +1455,7 @@ protected:
|
|||
FloatSeq *wave1 = new FloatSeq;
|
||||
wave1->push_back(0.0f);
|
||||
wave1->push_back(5.0f);
|
||||
sta_->makeClock("clk1", clk1_pins, false, 10.0f, wave1, nullptr, sta_->cmdMode());
|
||||
sta_->makeClock("clk1", clk1_pins, false, 10.0f, wave1, "", sta_->cmdMode());
|
||||
|
||||
// Create clock2
|
||||
Pin *clk2_pin = network->findPin(top, "clk2");
|
||||
|
|
@ -1466,7 +1465,7 @@ protected:
|
|||
FloatSeq *wave2 = new FloatSeq;
|
||||
wave2->push_back(0.0f);
|
||||
wave2->push_back(2.5f);
|
||||
sta_->makeClock("clk2", clk2_pins, false, 5.0f, wave2, nullptr, sta_->cmdMode());
|
||||
sta_->makeClock("clk2", clk2_pins, false, 5.0f, wave2, "", sta_->cmdMode());
|
||||
|
||||
// Input delays
|
||||
Clock *clk1 = sta_->cmdSdc()->findClock("clk1");
|
||||
|
|
@ -1665,7 +1664,7 @@ protected:
|
|||
FloatSeq *waveform = new FloatSeq;
|
||||
waveform->push_back(0.0f);
|
||||
waveform->push_back(5.0f);
|
||||
sta_->makeClock("clk", clk_pins, false, 10.0f, waveform, nullptr, sta_->cmdMode());
|
||||
sta_->makeClock("clk", clk_pins, false, 10.0f, waveform, "", sta_->cmdMode());
|
||||
|
||||
Clock *clk = sta_->cmdSdc()->findClock("clk");
|
||||
ASSERT_NE(clk, nullptr);
|
||||
|
|
@ -1930,7 +1929,7 @@ protected:
|
|||
FloatSeq *waveform = new FloatSeq;
|
||||
waveform->push_back(0.0f);
|
||||
waveform->push_back(5.0f);
|
||||
sta_->makeClock("clk", clk_pins, false, 10.0f, waveform, nullptr, sta_->cmdMode());
|
||||
sta_->makeClock("clk", clk_pins, false, 10.0f, waveform, "", sta_->cmdMode());
|
||||
|
||||
Clock *clk = sta_->cmdSdc()->findClock("clk");
|
||||
ASSERT_NE(clk, nullptr);
|
||||
|
|
|
|||
|
|
@ -3031,7 +3031,7 @@ scaleFactorTypeName(ScaleFactorType type)
|
|||
}
|
||||
|
||||
ScaleFactorType
|
||||
findScaleFactorType(const char *name)
|
||||
findScaleFactorType(std::string_view name)
|
||||
{
|
||||
return scale_factor_type_map.find(name, ScaleFactorType::unknown);
|
||||
}
|
||||
|
|
@ -3072,7 +3072,7 @@ EnumNameMap<ScaleFactorPvt> scale_factor_pvt_names =
|
|||
};
|
||||
|
||||
ScaleFactorPvt
|
||||
findScaleFactorPvt(const char *name)
|
||||
findScaleFactorPvt(std::string_view name)
|
||||
{
|
||||
return scale_factor_pvt_names.find(name, ScaleFactorPvt::unknown);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ LibertyParser::makeDefine(const LibertyAttrValueSeq *values,
|
|||
const std::string &value_type_name = (*values)[2]->stringValue();
|
||||
LibertyAttrType value_type = attrValueType(value_type_name);
|
||||
LibertyGroupType group_type = groupType(group_type_name);
|
||||
define = new LibertyDefine(define_name, group_type, value_type, line);
|
||||
define = new LibertyDefine(std::move(define_name), group_type, value_type, line);
|
||||
LibertyGroup *group = this->group();
|
||||
group->addDefine(define);
|
||||
for (auto value : *values)
|
||||
|
|
|
|||
|
|
@ -683,9 +683,8 @@ TEST_F(TableAxisTest, FindAxisIndexExact) {
|
|||
TEST_F(TableAxisTest, VariableString) {
|
||||
auto axis = makeAxis(TableAxisVariable::total_output_net_capacitance,
|
||||
{1.0f});
|
||||
const char *str = axis->variableString();
|
||||
EXPECT_NE(str, nullptr);
|
||||
EXPECT_STREQ(str, "total_output_net_capacitance");
|
||||
auto str = axis->variableString();
|
||||
EXPECT_EQ(str, "total_output_net_capacitance");
|
||||
}
|
||||
|
||||
TEST_F(TableAxisTest, UnitLookup) {
|
||||
|
|
@ -740,12 +739,12 @@ TEST(TableVariableTest, StringTableAxisVariable) {
|
|||
}
|
||||
|
||||
TEST(TableVariableTest, TableVariableString) {
|
||||
EXPECT_STREQ(tableVariableString(TableAxisVariable::total_output_net_capacitance),
|
||||
"total_output_net_capacitance");
|
||||
EXPECT_STREQ(tableVariableString(TableAxisVariable::input_net_transition),
|
||||
"input_net_transition");
|
||||
EXPECT_STREQ(tableVariableString(TableAxisVariable::time),
|
||||
"time");
|
||||
EXPECT_EQ(tableVariableString(TableAxisVariable::total_output_net_capacitance),
|
||||
"total_output_net_capacitance");
|
||||
EXPECT_EQ(tableVariableString(TableAxisVariable::input_net_transition),
|
||||
"input_net_transition");
|
||||
EXPECT_EQ(tableVariableString(TableAxisVariable::time),
|
||||
"time");
|
||||
}
|
||||
|
||||
TEST(TableVariableTest, TableVariableUnit) {
|
||||
|
|
@ -1155,11 +1154,11 @@ TEST(TimingTypeTest, TimingTypeScaleFactorType) {
|
|||
}
|
||||
|
||||
TEST(TimingSenseTest, ToString) {
|
||||
EXPECT_STREQ(to_string(TimingSense::positive_unate), "positive_unate");
|
||||
EXPECT_STREQ(to_string(TimingSense::negative_unate), "negative_unate");
|
||||
EXPECT_STREQ(to_string(TimingSense::non_unate), "non_unate");
|
||||
EXPECT_STREQ(to_string(TimingSense::none), "none");
|
||||
EXPECT_STREQ(to_string(TimingSense::unknown), "unknown");
|
||||
EXPECT_EQ(to_string(TimingSense::positive_unate), "positive_unate");
|
||||
EXPECT_EQ(to_string(TimingSense::negative_unate), "negative_unate");
|
||||
EXPECT_EQ(to_string(TimingSense::non_unate), "non_unate");
|
||||
EXPECT_EQ(to_string(TimingSense::none), "none");
|
||||
EXPECT_EQ(to_string(TimingSense::unknown), "unknown");
|
||||
}
|
||||
|
||||
TEST(TimingSenseTest, Opposite) {
|
||||
|
|
@ -1353,8 +1352,8 @@ TEST(TimingArcAttrsTest, SetSdfCondStartEnd) {
|
|||
TEST(RiseFallTest, BasicProperties) {
|
||||
EXPECT_EQ(RiseFall::rise()->index(), 0);
|
||||
EXPECT_EQ(RiseFall::fall()->index(), 1);
|
||||
EXPECT_STREQ(RiseFall::rise()->name(), "rise");
|
||||
EXPECT_STREQ(RiseFall::fall()->name(), "fall");
|
||||
EXPECT_EQ(RiseFall::rise()->name(), "rise");
|
||||
EXPECT_EQ(RiseFall::fall()->name(), "fall");
|
||||
EXPECT_EQ(RiseFall::rise()->opposite(), RiseFall::fall());
|
||||
EXPECT_EQ(RiseFall::fall()->opposite(), RiseFall::rise());
|
||||
}
|
||||
|
|
@ -1496,7 +1495,7 @@ TEST_F(LinearModelTest, CheckLinearModelCheckDelay) {
|
|||
|
||||
TEST_F(LinearModelTest, CheckLinearModelReportCheckDelay) {
|
||||
CheckLinearModel model(cell_, 2.0f);
|
||||
std::string report = model.reportCheckDelay(nullptr, 0.0f, nullptr,
|
||||
std::string report = model.reportCheckDelay(nullptr, 0.0f, "",
|
||||
0.0f, 0.0f,
|
||||
nullptr, PocvMode::scalar, 3);
|
||||
EXPECT_FALSE(report.empty());
|
||||
|
|
@ -1686,13 +1685,13 @@ TEST(TableModelTest, Order2) {
|
|||
TEST(WireloadTest, BasicConstruction) {
|
||||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
Wireload wl("test_wl", &lib, 0.0f, 1.0f, 2.0f, 3.0f);
|
||||
EXPECT_STREQ(wl.name(), "test_wl");
|
||||
EXPECT_EQ(wl.name(), "test_wl");
|
||||
}
|
||||
|
||||
TEST(WireloadTest, SimpleConstructor) {
|
||||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
Wireload wl("test_wl", &lib);
|
||||
EXPECT_STREQ(wl.name(), "test_wl");
|
||||
EXPECT_EQ(wl.name(), "test_wl");
|
||||
// Set individual properties
|
||||
wl.setArea(10.0f);
|
||||
wl.setResistance(1.5f);
|
||||
|
|
@ -1917,7 +1916,7 @@ TEST_F(LinearModelTest, Table0ReportValue) {
|
|||
Table tbl(42.0f);
|
||||
const Units *units = lib_->units();
|
||||
std::string report = tbl.reportValue("Delay", cell_, nullptr,
|
||||
0.0f, nullptr, 0.0f, 0.0f,
|
||||
0.0f, "", 0.0f, 0.0f,
|
||||
units->timeUnit(), 3);
|
||||
EXPECT_FALSE(report.empty());
|
||||
EXPECT_NE(report.find("Delay"), std::string::npos);
|
||||
|
|
@ -1936,7 +1935,7 @@ TEST_F(LinearModelTest, Table1ReportValue) {
|
|||
|
||||
const Units *units = lib_->units();
|
||||
std::string report = tbl.reportValue("Delay", cell_, nullptr,
|
||||
0.5f, nullptr, 0.0f, 0.0f,
|
||||
0.5f, "", 0.0f, 0.0f,
|
||||
units->timeUnit(), 3);
|
||||
EXPECT_FALSE(report.empty());
|
||||
EXPECT_NE(report.find("Delay"), std::string::npos);
|
||||
|
|
@ -1959,7 +1958,7 @@ TEST_F(LinearModelTest, Table2ReportValue) {
|
|||
|
||||
const Units *units = lib_->units();
|
||||
std::string report = tbl.reportValue("Delay", cell_, nullptr,
|
||||
0.5f, nullptr, 0.5f, 0.0f,
|
||||
0.5f, "", 0.5f, 0.0f,
|
||||
units->timeUnit(), 3);
|
||||
EXPECT_FALSE(report.empty());
|
||||
EXPECT_NE(report.find("Delay"), std::string::npos);
|
||||
|
|
@ -1989,7 +1988,7 @@ TEST_F(LinearModelTest, Table3ReportValue) {
|
|||
|
||||
const Units *units = lib_->units();
|
||||
std::string report = tbl.reportValue("Delay", cell_, nullptr,
|
||||
0.5f, nullptr, 0.5f, 0.5f,
|
||||
0.5f, "", 0.5f, 0.5f,
|
||||
units->timeUnit(), 3);
|
||||
EXPECT_FALSE(report.empty());
|
||||
EXPECT_NE(report.find("Delay"), std::string::npos);
|
||||
|
|
@ -2036,7 +2035,7 @@ TEST_F(LinearModelTest, TableModelReportValue) {
|
|||
|
||||
const Units *units = lib_->units();
|
||||
std::string report = model.reportValue("Delay", cell_, nullptr,
|
||||
0.5f, nullptr, 0.0f, 0.0f,
|
||||
0.5f, "", 0.0f, 0.0f,
|
||||
units->timeUnit(), 3);
|
||||
EXPECT_FALSE(report.empty());
|
||||
EXPECT_NE(report.find("Delay"), std::string::npos);
|
||||
|
|
@ -2116,11 +2115,11 @@ TEST(FuncExprTest, ZeroOneExpressions) {
|
|||
TEST(SequentialTest, BasicConstruction) {
|
||||
// Sequential class is constructed and used during liberty parsing
|
||||
// We can test the StringTableAxisVariable utility
|
||||
const char *var_str = tableVariableString(TableAxisVariable::input_transition_time);
|
||||
EXPECT_STREQ(var_str, "input_transition_time");
|
||||
auto var_str = tableVariableString(TableAxisVariable::input_transition_time);
|
||||
EXPECT_EQ(var_str, "input_transition_time");
|
||||
|
||||
var_str = tableVariableString(TableAxisVariable::total_output_net_capacitance);
|
||||
EXPECT_STREQ(var_str, "total_output_net_capacitance");
|
||||
EXPECT_EQ(var_str, "total_output_net_capacitance");
|
||||
}
|
||||
|
||||
TEST(TableAxisVariableTest, StringToVariable) {
|
||||
|
|
@ -2140,7 +2139,7 @@ TEST(TableAxisVariableTest, StringToVariable) {
|
|||
|
||||
TEST(WireloadSelectionTest, BasicConstruction) {
|
||||
WireloadSelection sel("test_sel");
|
||||
EXPECT_STREQ(sel.name(), "test_sel");
|
||||
EXPECT_EQ(sel.name(), "test_sel");
|
||||
}
|
||||
|
||||
TEST(WireloadSelectionTest, FindWireload) {
|
||||
|
|
@ -2507,7 +2506,7 @@ TEST(TableModelTest, FindValueOrder2) {
|
|||
|
||||
TEST(ScaleFactorsTest, BasicConstruction) {
|
||||
ScaleFactors sf("test_scales");
|
||||
EXPECT_STREQ(sf.name(), "test_scales");
|
||||
EXPECT_EQ(sf.name(), "test_scales");
|
||||
}
|
||||
|
||||
TEST(ScaleFactorsTest, SetAndGetWithRiseFall) {
|
||||
|
|
@ -2541,12 +2540,12 @@ TEST(ScaleFactorsTest, SetAndGetWithoutRiseFall) {
|
|||
////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(OcvDerateTest, BasicConstruction) {
|
||||
OcvDerate derate(stringCopy("test_ocv"));
|
||||
OcvDerate derate("test_ocv");
|
||||
EXPECT_EQ(derate.name(), "test_ocv");
|
||||
}
|
||||
|
||||
TEST(OcvDerateTest, SetAndGetDerateTable) {
|
||||
OcvDerate derate(stringCopy("ocv1"));
|
||||
OcvDerate derate("ocv1");
|
||||
TablePtr tbl = std::make_shared<Table>(0.95f);
|
||||
derate.setDerateTable(RiseFall::rise(), EarlyLate::early(),
|
||||
PathType::data, tbl);
|
||||
|
|
@ -2556,7 +2555,7 @@ TEST(OcvDerateTest, SetAndGetDerateTable) {
|
|||
}
|
||||
|
||||
TEST(OcvDerateTest, NullByDefault) {
|
||||
OcvDerate derate(stringCopy("ocv2"));
|
||||
OcvDerate derate("ocv2");
|
||||
const Table *found = derate.derateTable(RiseFall::fall(), EarlyLate::late(),
|
||||
PathType::clk);
|
||||
EXPECT_EQ(found, nullptr);
|
||||
|
|
@ -2575,7 +2574,7 @@ TEST(LibertyLibraryTest, OcvArcDepth) {
|
|||
TEST(LibertyLibraryTest, DefaultOcvDerate) {
|
||||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
EXPECT_EQ(lib.defaultOcvDerate(), nullptr);
|
||||
OcvDerate *derate = new OcvDerate(stringCopy("default_ocv"));
|
||||
OcvDerate *derate = new OcvDerate("default_ocv");
|
||||
lib.setDefaultOcvDerate(derate);
|
||||
EXPECT_EQ(lib.defaultOcvDerate(), derate);
|
||||
}
|
||||
|
|
@ -2626,7 +2625,7 @@ TEST(LibertyLibraryTest, MakeScaledCell) {
|
|||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
LibertyCell *cell = lib.makeScaledCell("scaled_inv", "test.lib");
|
||||
EXPECT_NE(cell, nullptr);
|
||||
EXPECT_STREQ(cell->name(), "scaled_inv");
|
||||
EXPECT_EQ(cell->name(), "scaled_inv");
|
||||
delete cell;
|
||||
}
|
||||
|
||||
|
|
@ -2666,7 +2665,7 @@ TEST(LibertyLibraryTest, TableTemplates) {
|
|||
TEST(TestCellTest, BasicConstruction) {
|
||||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
TestCell cell(&lib, "INV_X1", "test.lib");
|
||||
EXPECT_STREQ(cell.name(), "INV_X1");
|
||||
EXPECT_EQ(cell.name(), "INV_X1");
|
||||
EXPECT_EQ(cell.libertyLibrary(), &lib);
|
||||
}
|
||||
|
||||
|
|
@ -2834,7 +2833,7 @@ TEST(TestCellTest, CellOcvDerate) {
|
|||
// Without cell-level derate, returns library default
|
||||
EXPECT_EQ(cell.ocvDerate(), nullptr);
|
||||
|
||||
OcvDerate *derate = new OcvDerate(stringCopy("cell_ocv"));
|
||||
OcvDerate *derate = new OcvDerate("cell_ocv");
|
||||
cell.setOcvDerate(derate);
|
||||
EXPECT_EQ(cell.ocvDerate(), derate);
|
||||
}
|
||||
|
|
@ -2873,8 +2872,8 @@ TEST(TestCellTest, TimingArcSetCount) {
|
|||
////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(ScanSignalTypeTest, Names) {
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::enable), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::enable_inverted), nullptr);
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::enable).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::enable_inverted).empty());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -2979,8 +2978,8 @@ TEST(LibertyUtilTest, PortLibertyToSta) {
|
|||
}
|
||||
|
||||
TEST(LibertyUtilTest, PwrGndTypeName) {
|
||||
const char *name = pwrGndTypeName(PwrGndType::primary_power);
|
||||
EXPECT_NE(name, nullptr);
|
||||
const std::string &name = pwrGndTypeName(PwrGndType::primary_power);
|
||||
EXPECT_FALSE(name.empty());
|
||||
}
|
||||
|
||||
TEST(LibertyUtilTest, FindPwrGndType) {
|
||||
|
|
@ -3000,9 +2999,9 @@ TEST(ScaleFactorPvtTest, FindByName) {
|
|||
}
|
||||
|
||||
TEST(ScaleFactorPvtTest, PvtToName) {
|
||||
EXPECT_STREQ(scaleFactorPvtName(ScaleFactorPvt::process), "process");
|
||||
EXPECT_STREQ(scaleFactorPvtName(ScaleFactorPvt::volt), "volt");
|
||||
EXPECT_STREQ(scaleFactorPvtName(ScaleFactorPvt::temp), "temp");
|
||||
EXPECT_EQ(scaleFactorPvtName(ScaleFactorPvt::process), "process");
|
||||
EXPECT_EQ(scaleFactorPvtName(ScaleFactorPvt::volt), "volt");
|
||||
EXPECT_EQ(scaleFactorPvtName(ScaleFactorPvt::temp), "temp");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -3029,16 +3028,16 @@ TEST(ScaleFactorTypeTest, FindByName) {
|
|||
}
|
||||
|
||||
TEST(ScaleFactorTypeTest, TypeToName) {
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::pin_cap), "pin_cap");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::wire_cap), "wire_cap");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::wire_res), "wire_res");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::cell), "cell");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::hold), "hold");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::setup), "setup");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::recovery), "recovery");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::removal), "removal");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::transition), "transition");
|
||||
EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::min_pulse_width), "min_pulse_width");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::pin_cap), "pin_cap");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::wire_cap), "wire_cap");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::wire_res), "wire_res");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::cell), "cell");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::hold), "hold");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::setup), "setup");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::recovery), "recovery");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::removal), "removal");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::transition), "transition");
|
||||
EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::min_pulse_width), "min_pulse_width");
|
||||
}
|
||||
|
||||
TEST(ScaleFactorTypeTest, RiseFallSuffix) {
|
||||
|
|
@ -3097,13 +3096,16 @@ TEST(PvtTest, Setters) {
|
|||
|
||||
TEST(OperatingConditionsTest, NameOnlyConstructor) {
|
||||
OperatingConditions opcond("typical");
|
||||
EXPECT_STREQ(opcond.name(), "typical");
|
||||
EXPECT_EQ(opcond.name(), "typical");
|
||||
}
|
||||
|
||||
TEST(OperatingConditionsTest, FullConstructor) {
|
||||
OperatingConditions opcond("worst", 1.0f, 0.9f, 125.0f,
|
||||
WireloadTree::worst_case);
|
||||
EXPECT_STREQ(opcond.name(), "worst");
|
||||
OperatingConditions opcond("worst");
|
||||
opcond.setProcess(1.0f);
|
||||
opcond.setVoltage(0.9f);
|
||||
opcond.setTemperature(125.0f);
|
||||
opcond.setWireloadTree(WireloadTree::worst_case);
|
||||
EXPECT_EQ(opcond.name(), "worst");
|
||||
EXPECT_FLOAT_EQ(opcond.process(), 1.0f);
|
||||
EXPECT_FLOAT_EQ(opcond.voltage(), 0.9f);
|
||||
EXPECT_FLOAT_EQ(opcond.temperature(), 125.0f);
|
||||
|
|
@ -3201,8 +3203,10 @@ TEST(ModeDefTest, DefineAndFindValue) {
|
|||
EXPECT_NE(mode, nullptr);
|
||||
|
||||
FuncExpr *cond = FuncExpr::makeOne();
|
||||
ModeValueDef *valdef = mode->defineValue("test_value", cond, "A==1");
|
||||
ModeValueDef *valdef = mode->defineValue("test_value");
|
||||
EXPECT_NE(valdef, nullptr);
|
||||
valdef->setCond(cond);
|
||||
valdef->setSdfCond("A==1");
|
||||
EXPECT_EQ(valdef->value(), "test_value");
|
||||
EXPECT_EQ(valdef->cond(), cond);
|
||||
EXPECT_EQ(valdef->sdfCond(), "A==1");
|
||||
|
|
@ -3211,8 +3215,8 @@ TEST(ModeDefTest, DefineAndFindValue) {
|
|||
EXPECT_EQ(found, valdef);
|
||||
EXPECT_EQ(mode->findValueDef("nonexistent"), nullptr);
|
||||
|
||||
const ModeValueMap *vals = mode->values();
|
||||
EXPECT_NE(vals, nullptr);
|
||||
const ModeValueMap &vals = mode->values();
|
||||
EXPECT_FALSE(vals.empty());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -3286,34 +3290,30 @@ TEST(TestCellTest, TimingArcSetsEmpty) {
|
|||
TEST(TestCellTest, FootprintDefault) {
|
||||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
TestCell cell(&lib, "CELL1", "test.lib");
|
||||
const char *fp = cell.footprint();
|
||||
// Empty string or nullptr for default
|
||||
if (fp) {
|
||||
EXPECT_EQ(fp, "");
|
||||
}
|
||||
const std::string &fp = cell.footprint();
|
||||
// Empty string for default
|
||||
EXPECT_TRUE(fp.empty());
|
||||
}
|
||||
|
||||
TEST(TestCellTest, SetFootprint) {
|
||||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
TestCell cell(&lib, "CELL1", "test.lib");
|
||||
cell.setFootprint("INV_FP");
|
||||
EXPECT_STREQ(cell.footprint(), "INV_FP");
|
||||
EXPECT_EQ(cell.footprint(), "INV_FP");
|
||||
}
|
||||
|
||||
TEST(TestCellTest, UserFunctionClassDefault) {
|
||||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
TestCell cell(&lib, "CELL1", "test.lib");
|
||||
const char *ufc = cell.userFunctionClass();
|
||||
if (ufc) {
|
||||
EXPECT_EQ(ufc, "");
|
||||
}
|
||||
const std::string &ufc = cell.userFunctionClass();
|
||||
EXPECT_TRUE(ufc.empty());
|
||||
}
|
||||
|
||||
TEST(TestCellTest, SetUserFunctionClass) {
|
||||
LibertyLibrary lib("test_lib", "test.lib");
|
||||
TestCell cell(&lib, "CELL1", "test.lib");
|
||||
cell.setUserFunctionClass("inverter");
|
||||
EXPECT_STREQ(cell.userFunctionClass(), "inverter");
|
||||
EXPECT_EQ(cell.userFunctionClass(), "inverter");
|
||||
}
|
||||
|
||||
TEST(TestCellTest, SwitchCellTypeGetter) {
|
||||
|
|
@ -3425,15 +3425,15 @@ TEST(TimingTypeTest, ScaleFactorTypeAdditional) {
|
|||
////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(ScanSignalTypeTest, AllNames) {
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::enable), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::enable_inverted), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::clock), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::clock_a), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::clock_b), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::input), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::input_inverted), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::output), nullptr);
|
||||
EXPECT_NE(scanSignalTypeName(ScanSignalType::output_inverted), nullptr);
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::enable).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::enable_inverted).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::clock).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::clock_a).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::clock_b).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::input).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::input_inverted).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::output).empty());
|
||||
EXPECT_FALSE(scanSignalTypeName(ScanSignalType::output_inverted).empty());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -3441,16 +3441,16 @@ TEST(ScanSignalTypeTest, AllNames) {
|
|||
////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(LibertyUtilTest, PwrGndTypeAllNames) {
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::primary_power), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::primary_ground), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::backup_power), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::backup_ground), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::internal_power), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::internal_ground), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::nwell), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::pwell), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::deepnwell), nullptr);
|
||||
EXPECT_NE(pwrGndTypeName(PwrGndType::deeppwell), nullptr);
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::primary_power).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::primary_ground).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::backup_power).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::backup_ground).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::internal_power).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::internal_ground).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::nwell).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::pwell).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::deepnwell).empty());
|
||||
EXPECT_FALSE(pwrGndTypeName(PwrGndType::deeppwell).empty());
|
||||
}
|
||||
|
||||
TEST(LibertyUtilTest, FindPwrGndTypeAll) {
|
||||
|
|
@ -3675,7 +3675,7 @@ TEST(Table0Test, ReportValue) {
|
|||
TestCell cell(&lib, "INV", "test.lib");
|
||||
const Units *units = lib.units();
|
||||
std::string report = tbl.reportValue("Power", &cell, nullptr,
|
||||
0.0f, nullptr, 0.0f, 0.0f,
|
||||
0.0f, "", 0.0f, 0.0f,
|
||||
units->powerUnit(), 3);
|
||||
EXPECT_FALSE(report.empty());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include "VerilogNamespace.hh"
|
||||
#include "PortDirection.hh"
|
||||
#include "ConcreteLibrary.hh"
|
||||
|
|
@ -97,7 +98,7 @@ protected:
|
|||
TEST_F(PortDirectionTest, InputSingleton) {
|
||||
PortDirection *dir = PortDirection::input();
|
||||
EXPECT_NE(dir, nullptr);
|
||||
EXPECT_STREQ(dir->name(), "input");
|
||||
EXPECT_EQ(dir->name(), "input");
|
||||
EXPECT_EQ(dir->index(), 0);
|
||||
EXPECT_TRUE(dir->isInput());
|
||||
EXPECT_FALSE(dir->isOutput());
|
||||
|
|
@ -112,7 +113,7 @@ TEST_F(PortDirectionTest, InputSingleton) {
|
|||
TEST_F(PortDirectionTest, OutputSingleton) {
|
||||
PortDirection *dir = PortDirection::output();
|
||||
EXPECT_NE(dir, nullptr);
|
||||
EXPECT_STREQ(dir->name(), "output");
|
||||
EXPECT_EQ(dir->name(), "output");
|
||||
EXPECT_EQ(dir->index(), 1);
|
||||
EXPECT_TRUE(dir->isOutput());
|
||||
EXPECT_FALSE(dir->isInput());
|
||||
|
|
@ -121,7 +122,7 @@ TEST_F(PortDirectionTest, OutputSingleton) {
|
|||
TEST_F(PortDirectionTest, TristateSingleton) {
|
||||
PortDirection *dir = PortDirection::tristate();
|
||||
EXPECT_NE(dir, nullptr);
|
||||
EXPECT_STREQ(dir->name(), "tristate");
|
||||
EXPECT_EQ(dir->name(), "tristate");
|
||||
EXPECT_EQ(dir->index(), 2);
|
||||
EXPECT_TRUE(dir->isTristate());
|
||||
EXPECT_FALSE(dir->isInput());
|
||||
|
|
@ -131,7 +132,7 @@ TEST_F(PortDirectionTest, TristateSingleton) {
|
|||
TEST_F(PortDirectionTest, BidirectSingleton) {
|
||||
PortDirection *dir = PortDirection::bidirect();
|
||||
EXPECT_NE(dir, nullptr);
|
||||
EXPECT_STREQ(dir->name(), "bidirect");
|
||||
EXPECT_EQ(dir->name(), "bidirect");
|
||||
EXPECT_EQ(dir->index(), 3);
|
||||
EXPECT_TRUE(dir->isBidirect());
|
||||
}
|
||||
|
|
@ -139,7 +140,7 @@ TEST_F(PortDirectionTest, BidirectSingleton) {
|
|||
TEST_F(PortDirectionTest, InternalSingleton) {
|
||||
PortDirection *dir = PortDirection::internal();
|
||||
EXPECT_NE(dir, nullptr);
|
||||
EXPECT_STREQ(dir->name(), "internal");
|
||||
EXPECT_EQ(dir->name(), "internal");
|
||||
EXPECT_EQ(dir->index(), 4);
|
||||
EXPECT_TRUE(dir->isInternal());
|
||||
}
|
||||
|
|
@ -147,7 +148,7 @@ TEST_F(PortDirectionTest, InternalSingleton) {
|
|||
TEST_F(PortDirectionTest, GroundSingleton) {
|
||||
PortDirection *dir = PortDirection::ground();
|
||||
EXPECT_NE(dir, nullptr);
|
||||
EXPECT_STREQ(dir->name(), "ground");
|
||||
EXPECT_EQ(dir->name(), "ground");
|
||||
EXPECT_EQ(dir->index(), 5);
|
||||
EXPECT_TRUE(dir->isGround());
|
||||
}
|
||||
|
|
@ -155,7 +156,7 @@ TEST_F(PortDirectionTest, GroundSingleton) {
|
|||
TEST_F(PortDirectionTest, PowerSingleton) {
|
||||
PortDirection *dir = PortDirection::power();
|
||||
EXPECT_NE(dir, nullptr);
|
||||
EXPECT_STREQ(dir->name(), "power");
|
||||
EXPECT_EQ(dir->name(), "power");
|
||||
EXPECT_EQ(dir->index(), 6);
|
||||
EXPECT_TRUE(dir->isPower());
|
||||
}
|
||||
|
|
@ -163,7 +164,7 @@ TEST_F(PortDirectionTest, PowerSingleton) {
|
|||
TEST_F(PortDirectionTest, UnknownSingleton) {
|
||||
PortDirection *dir = PortDirection::unknown();
|
||||
EXPECT_NE(dir, nullptr);
|
||||
EXPECT_STREQ(dir->name(), "unknown");
|
||||
EXPECT_EQ(dir->name(), "unknown");
|
||||
EXPECT_EQ(dir->index(), 7);
|
||||
EXPECT_TRUE(dir->isUnknown());
|
||||
}
|
||||
|
|
@ -229,8 +230,8 @@ TEST_F(PortDirectionTest, IsPowerGround) {
|
|||
|
||||
TEST(ConcreteLibraryTest, CreateAndFind) {
|
||||
ConcreteLibrary lib("test_lib", "test.lib", false);
|
||||
EXPECT_STREQ(lib.name(), "test_lib");
|
||||
EXPECT_STREQ(lib.filename(), "test.lib");
|
||||
EXPECT_EQ(lib.name(), "test_lib");
|
||||
EXPECT_EQ(lib.filename(), "test.lib");
|
||||
EXPECT_FALSE(lib.isLiberty());
|
||||
}
|
||||
|
||||
|
|
@ -245,8 +246,8 @@ TEST(ConcreteLibraryTest, MakeCell) {
|
|||
ConcreteLibrary lib("test_lib", "test.lib", false);
|
||||
ConcreteCell *cell = lib.makeCell("INV", true, "inv.v");
|
||||
EXPECT_NE(cell, nullptr);
|
||||
EXPECT_STREQ(cell->name(), "INV");
|
||||
EXPECT_STREQ(cell->filename(), "inv.v");
|
||||
EXPECT_EQ(cell->name(), "INV");
|
||||
EXPECT_EQ(cell->filename(), "inv.v");
|
||||
EXPECT_TRUE(cell->isLeaf());
|
||||
EXPECT_EQ(cell->library(), &lib);
|
||||
|
||||
|
|
@ -299,7 +300,7 @@ TEST(ConcreteCellTest, MakePort) {
|
|||
ConcreteCell *cell = lib.makeCell("INV", true, "");
|
||||
ConcretePort *port_a = cell->makePort("A");
|
||||
EXPECT_NE(port_a, nullptr);
|
||||
EXPECT_STREQ(port_a->name(), "A");
|
||||
EXPECT_EQ(port_a->name(), "A");
|
||||
EXPECT_EQ(port_a->cell(), reinterpret_cast<Cell*>(cell));
|
||||
|
||||
ConcretePort *found = cell->findPort("A");
|
||||
|
|
@ -357,9 +358,9 @@ TEST(ConcreteCellTest, AttributeMap) {
|
|||
TEST(ConcreteCellTest, SetName) {
|
||||
ConcreteLibrary lib("test_lib", "test.lib", false);
|
||||
ConcreteCell *cell = lib.makeCell("OLD", true, "");
|
||||
EXPECT_STREQ(cell->name(), "OLD");
|
||||
EXPECT_EQ(cell->name(), "OLD");
|
||||
cell->setName("NEW");
|
||||
EXPECT_STREQ(cell->name(), "NEW");
|
||||
EXPECT_EQ(cell->name(), "NEW");
|
||||
}
|
||||
|
||||
TEST(ConcreteCellTest, PortIterator) {
|
||||
|
|
@ -646,10 +647,10 @@ TEST(ConcreteCellTest, MakeBusPortAscending) {
|
|||
TEST(ConcreteCellTest, Filename) {
|
||||
ConcreteLibrary lib("test_lib", "test.lib", false);
|
||||
ConcreteCell *cell = lib.makeCell("INV", true, "test_cell.v");
|
||||
EXPECT_STREQ(cell->filename(), "test_cell.v");
|
||||
EXPECT_EQ(cell->filename(), "test_cell.v");
|
||||
|
||||
ConcreteCell *cell2 = lib.makeCell("BUF", true, "");
|
||||
EXPECT_STREQ(cell2->filename(), "");
|
||||
EXPECT_EQ(cell2->filename(), "");
|
||||
}
|
||||
|
||||
TEST(ConcreteCellTest, FindCellsMatching) {
|
||||
|
|
@ -692,8 +693,8 @@ TEST(ConcretePortTest, BusPortBusName) {
|
|||
lib.setBusBrkts('[', ']');
|
||||
ConcreteCell *cell = lib.makeCell("REG", true, "");
|
||||
ConcretePort *bus = cell->makeBusPort("D", 3, 0);
|
||||
const char *bus_name = bus->busName();
|
||||
EXPECT_NE(bus_name, nullptr);
|
||||
std::string bus_name = bus->busName();
|
||||
EXPECT_FALSE(bus_name.empty());
|
||||
// Should contain bus bracket notation
|
||||
std::string name_str(bus_name);
|
||||
EXPECT_NE(name_str.find("["), std::string::npos);
|
||||
|
|
@ -704,8 +705,8 @@ TEST(ConcretePortTest, ScalarBusName) {
|
|||
ConcreteCell *cell = lib.makeCell("INV", true, "");
|
||||
ConcretePort *port = cell->makePort("A");
|
||||
// Scalar port busName returns just the name
|
||||
const char *bus_name = port->busName();
|
||||
EXPECT_STREQ(bus_name, "A");
|
||||
std::string bus_name = port->busName();
|
||||
EXPECT_EQ(bus_name, "A");
|
||||
}
|
||||
|
||||
TEST(ConcretePortTest, FindMember) {
|
||||
|
|
@ -830,7 +831,7 @@ TEST(ConcreteLibraryTest, BusBracketsChange) {
|
|||
|
||||
TEST(ConcreteLibraryTest, FilenameAndId) {
|
||||
ConcreteLibrary lib("test_lib", "test.lib", false);
|
||||
EXPECT_STREQ(lib.filename(), "test.lib");
|
||||
EXPECT_EQ(lib.filename(), "test.lib");
|
||||
// Library ID is a monotonically increasing counter
|
||||
EXPECT_GE(lib.id(), 0u);
|
||||
}
|
||||
|
|
@ -878,14 +879,14 @@ TEST(PortDirectionExtraTest, DirectionNames) {
|
|||
if (PortDirection::input() == nullptr) {
|
||||
PortDirection::init();
|
||||
}
|
||||
EXPECT_STREQ(PortDirection::input()->name(), "input");
|
||||
EXPECT_STREQ(PortDirection::output()->name(), "output");
|
||||
EXPECT_STREQ(PortDirection::bidirect()->name(), "bidirect");
|
||||
EXPECT_STREQ(PortDirection::tristate()->name(), "tristate");
|
||||
EXPECT_STREQ(PortDirection::internal()->name(), "internal");
|
||||
EXPECT_STREQ(PortDirection::ground()->name(), "ground");
|
||||
EXPECT_STREQ(PortDirection::power()->name(), "power");
|
||||
EXPECT_STREQ(PortDirection::unknown()->name(), "unknown");
|
||||
EXPECT_EQ(PortDirection::input()->name(), "input");
|
||||
EXPECT_EQ(PortDirection::output()->name(), "output");
|
||||
EXPECT_EQ(PortDirection::bidirect()->name(), "bidirect");
|
||||
EXPECT_EQ(PortDirection::tristate()->name(), "tristate");
|
||||
EXPECT_EQ(PortDirection::internal()->name(), "internal");
|
||||
EXPECT_EQ(PortDirection::ground()->name(), "ground");
|
||||
EXPECT_EQ(PortDirection::power()->name(), "power");
|
||||
EXPECT_EQ(PortDirection::unknown()->name(), "unknown");
|
||||
}
|
||||
|
||||
TEST(PortDirectionExtraTest, FindAllByName) {
|
||||
|
|
@ -940,7 +941,7 @@ TEST(ConcreteCellTest, GroupBusPorts) {
|
|||
cell->makePort("CLK");
|
||||
|
||||
// groupBusPorts should group D[0]-D[3] into bus D
|
||||
cell->groupBusPorts('[', ']', [](const char*) { return true; });
|
||||
cell->groupBusPorts('[', ']', [](std::string_view) { return true; });
|
||||
|
||||
// After grouping, we should find the bus port D
|
||||
ConcretePort *bus = cell->findPort("D");
|
||||
|
|
@ -969,7 +970,7 @@ TEST(ConcreteNetworkTest, MakeLibrary) {
|
|||
EXPECT_EQ(found, lib);
|
||||
|
||||
// Library name
|
||||
EXPECT_STREQ(network.name(lib), "test_lib");
|
||||
EXPECT_EQ(network.name(lib), "test_lib");
|
||||
}
|
||||
|
||||
TEST(ConcreteNetworkTest, LibraryIterator) {
|
||||
|
|
@ -1008,7 +1009,7 @@ TEST(ConcreteNetworkTest, CellName) {
|
|||
|
||||
Cell *cell = network.findCell(lib, "INV_X1");
|
||||
EXPECT_NE(cell, nullptr);
|
||||
EXPECT_STREQ(network.name(cell), "INV_X1");
|
||||
EXPECT_EQ(network.name(cell), "INV_X1");
|
||||
}
|
||||
|
||||
TEST(ConcreteNetworkTest, CellIsLeaf) {
|
||||
|
|
@ -1052,7 +1053,7 @@ TEST(ConcreteNetworkTest, PortProperties) {
|
|||
ConcretePort *a = ccell->makePort("A");
|
||||
|
||||
Port *port = reinterpret_cast<Port*>(a);
|
||||
EXPECT_STREQ(network.name(port), "A");
|
||||
EXPECT_EQ(network.name(port), "A");
|
||||
EXPECT_FALSE(network.isBus(port));
|
||||
EXPECT_FALSE(network.isBundle(port));
|
||||
}
|
||||
|
|
@ -1068,7 +1069,7 @@ TEST(ConcreteNetworkTest, FindPort) {
|
|||
Cell *cell = reinterpret_cast<Cell*>(ccell);
|
||||
Port *found = network.findPort(cell, "A");
|
||||
EXPECT_NE(found, nullptr);
|
||||
EXPECT_STREQ(network.name(found), "A");
|
||||
EXPECT_EQ(network.name(found), "A");
|
||||
|
||||
Port *not_found = network.findPort(cell, "B");
|
||||
EXPECT_EQ(not_found, nullptr);
|
||||
|
|
@ -1102,7 +1103,7 @@ TEST(ConcreteNetworkTest, FindLibraryByName) {
|
|||
TEST(ConcreteNetworkTest, LibraryName) {
|
||||
ConcreteNetwork network;
|
||||
Library *lib = network.makeLibrary("test_name_lib", "test.lib");
|
||||
EXPECT_STREQ(network.name(lib), "test_name_lib");
|
||||
EXPECT_EQ(network.name(lib), "test_name_lib");
|
||||
}
|
||||
|
||||
TEST(ConcreteNetworkTest, LibraryId) {
|
||||
|
|
@ -1151,7 +1152,7 @@ TEST(ConcreteNetworkTest, CellNameViaNetwork) {
|
|||
ConcreteNetwork network;
|
||||
Library *lib = network.makeLibrary("nm_lib", "nm.lib");
|
||||
Cell *cell = network.makeCell(lib, "OR2_X1", true, "nm.lib");
|
||||
EXPECT_STREQ(network.name(cell), "OR2_X1");
|
||||
EXPECT_EQ(network.name(cell), "OR2_X1");
|
||||
}
|
||||
|
||||
TEST(ConcreteNetworkTest, CellIdViaNetwork) {
|
||||
|
|
@ -1167,7 +1168,7 @@ TEST(ConcreteNetworkTest, SetCellName) {
|
|||
Library *lib = network.makeLibrary("rn_lib", "rn.lib");
|
||||
Cell *cell = network.makeCell(lib, "OLD_NAME", true, "rn.lib");
|
||||
network.setName(cell, "NEW_NAME");
|
||||
EXPECT_STREQ(network.name(cell), "NEW_NAME");
|
||||
EXPECT_EQ(network.name(cell), "NEW_NAME");
|
||||
}
|
||||
|
||||
TEST(ConcreteNetworkTest, SetIsLeaf) {
|
||||
|
|
@ -1210,7 +1211,7 @@ TEST(ConcreteNetworkTest, CellFilename) {
|
|||
ConcreteNetwork network;
|
||||
Library *lib = network.makeLibrary("fn_lib", "fn.lib");
|
||||
Cell *cell = network.makeCell(lib, "CELL1", true, "fn.lib");
|
||||
EXPECT_STREQ(network.filename(cell), "fn.lib");
|
||||
EXPECT_EQ(network.filename(cell), "fn.lib");
|
||||
}
|
||||
|
||||
TEST(ConcreteNetworkTest, DeleteCell) {
|
||||
|
|
@ -1343,8 +1344,8 @@ TEST_F(ConcreteNetworkLinkedTest, IsTopInstance) {
|
|||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, InstanceName) {
|
||||
EXPECT_STREQ(network_.name(u1_), "u1");
|
||||
EXPECT_STREQ(network_.name(u2_), "u2");
|
||||
EXPECT_EQ(network_.name(u1_), "u1");
|
||||
EXPECT_EQ(network_.name(u2_), "u2");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, InstanceId) {
|
||||
|
|
@ -1356,12 +1357,12 @@ TEST_F(ConcreteNetworkLinkedTest, InstanceId) {
|
|||
TEST_F(ConcreteNetworkLinkedTest, InstanceCell) {
|
||||
Cell *cell = network_.cell(u1_);
|
||||
EXPECT_NE(cell, nullptr);
|
||||
EXPECT_STREQ(network_.name(cell), "INV");
|
||||
EXPECT_EQ(network_.name(cell), "INV");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, InstanceCellName) {
|
||||
const char *name = network_.cellName(u1_);
|
||||
EXPECT_STREQ(name, "INV");
|
||||
std::string name = network_.cellName(u1_);
|
||||
EXPECT_EQ(name, "INV");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, InstanceParent) {
|
||||
|
|
@ -1388,9 +1389,9 @@ TEST_F(ConcreteNetworkLinkedTest, InstanceFindChild) {
|
|||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, InstancePathName) {
|
||||
const char *path = network_.pathName(u1_);
|
||||
EXPECT_NE(path, nullptr);
|
||||
EXPECT_STREQ(path, "u1");
|
||||
std::string path = network_.pathName(u1_);
|
||||
EXPECT_FALSE(path.empty());
|
||||
EXPECT_EQ(path, "u1");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, ChildIterator) {
|
||||
|
|
@ -1447,7 +1448,7 @@ TEST_F(ConcreteNetworkLinkedTest, PinNet) {
|
|||
TEST_F(ConcreteNetworkLinkedTest, PinPort) {
|
||||
Port *port = network_.port(pin_u1_a_);
|
||||
EXPECT_NE(port, nullptr);
|
||||
EXPECT_STREQ(network_.name(port), "A");
|
||||
EXPECT_EQ(network_.name(port), "A");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PinDirection) {
|
||||
|
|
@ -1473,18 +1474,18 @@ TEST_F(ConcreteNetworkLinkedTest, PinVertexId) {
|
|||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PinName) {
|
||||
const Network &net = network_;
|
||||
const char *name = net.name(pin_u1_a_);
|
||||
EXPECT_NE(name, nullptr);
|
||||
std::string name = net.name(pin_u1_a_);
|
||||
EXPECT_FALSE(name.empty());
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PinPortName) {
|
||||
const char *pname = network_.portName(pin_u1_a_);
|
||||
EXPECT_STREQ(pname, "A");
|
||||
std::string pname = network_.portName(pin_u1_a_);
|
||||
EXPECT_EQ(pname, "A");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PinPathName) {
|
||||
const char *path = network_.pathName(pin_u1_a_);
|
||||
EXPECT_NE(path, nullptr);
|
||||
std::string path = network_.pathName(pin_u1_a_);
|
||||
EXPECT_FALSE(path.empty());
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PinIsLeaf) {
|
||||
|
|
@ -1517,7 +1518,7 @@ TEST_F(ConcreteNetworkLinkedTest, FindPinByPort) {
|
|||
|
||||
// Net tests
|
||||
TEST_F(ConcreteNetworkLinkedTest, NetName) {
|
||||
EXPECT_STREQ(network_.name(net1_), "n1");
|
||||
EXPECT_EQ(network_.name(net1_), "n1");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, NetId) {
|
||||
|
|
@ -1531,8 +1532,8 @@ TEST_F(ConcreteNetworkLinkedTest, NetInstance) {
|
|||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, NetPathName) {
|
||||
const char *path = network_.pathName(net1_);
|
||||
EXPECT_NE(path, nullptr);
|
||||
std::string path = network_.pathName(net1_);
|
||||
EXPECT_FALSE(path.empty());
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, NetIsPowerGround) {
|
||||
|
|
@ -1628,7 +1629,7 @@ TEST_F(ConcreteNetworkLinkedTest, ReplaceCell) {
|
|||
network_.disconnectPin(pin_u1_y_);
|
||||
network_.replaceCell(u1_, buf_cell);
|
||||
Cell *new_cell = network_.cell(u1_);
|
||||
EXPECT_STREQ(network_.name(new_cell), "BUF");
|
||||
EXPECT_EQ(network_.name(new_cell), "BUF");
|
||||
}
|
||||
|
||||
// Network pathName comparisons
|
||||
|
|
@ -1666,35 +1667,31 @@ TEST_F(ConcreteNetworkLinkedTest, PathNameCmpNet) {
|
|||
|
||||
// Network: pathNameFirst / pathNameLast
|
||||
TEST_F(ConcreteNetworkLinkedTest, PathNameFirst) {
|
||||
char *first = nullptr;
|
||||
char *tail = nullptr;
|
||||
std::string first;
|
||||
std::string tail;
|
||||
network_.pathNameFirst("a/b/c", first, tail);
|
||||
if (first) {
|
||||
EXPECT_STREQ(first, "a");
|
||||
EXPECT_STREQ(tail, "b/c");
|
||||
delete [] first;
|
||||
delete [] tail;
|
||||
if (!first.empty()) {
|
||||
EXPECT_EQ(first, "a");
|
||||
EXPECT_EQ(tail, "b/c");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PathNameLast) {
|
||||
char *head = nullptr;
|
||||
char *last = nullptr;
|
||||
std::string head;
|
||||
std::string last;
|
||||
network_.pathNameLast("a/b/c", head, last);
|
||||
if (last) {
|
||||
EXPECT_STREQ(last, "c");
|
||||
EXPECT_STREQ(head, "a/b");
|
||||
delete [] head;
|
||||
delete [] last;
|
||||
if (!last.empty()) {
|
||||
EXPECT_EQ(last, "c");
|
||||
EXPECT_EQ(head, "a/b");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PathNameFirstNoDivider) {
|
||||
char *first = nullptr;
|
||||
char *tail = nullptr;
|
||||
std::string first;
|
||||
std::string tail;
|
||||
network_.pathNameFirst("simple", first, tail);
|
||||
EXPECT_EQ(first, nullptr);
|
||||
EXPECT_EQ(tail, nullptr);
|
||||
EXPECT_TRUE(first.empty());
|
||||
EXPECT_TRUE(tail.empty());
|
||||
}
|
||||
|
||||
// Network: pathDivider / pathEscape
|
||||
|
|
@ -2027,8 +2024,8 @@ TEST_F(ConcreteNetworkLinkedTest, SortByPathNameInstances) {
|
|||
inst_set.insert(u1_);
|
||||
InstanceSeq sorted = sortByPathName(&inst_set, &network_);
|
||||
EXPECT_EQ(sorted.size(), 2u);
|
||||
EXPECT_STREQ(network_.name(sorted[0]), "u1");
|
||||
EXPECT_STREQ(network_.name(sorted[1]), "u2");
|
||||
EXPECT_EQ(network_.name(sorted[0]), "u1");
|
||||
EXPECT_EQ(network_.name(sorted[1]), "u2");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, SortByPathNameNets) {
|
||||
|
|
@ -2049,8 +2046,8 @@ TEST_F(ConcreteNetworkLinkedTest, SortByNamePorts) {
|
|||
port_set.insert(port_a);
|
||||
PortSeq sorted = sortByName(&port_set, &network_);
|
||||
EXPECT_EQ(sorted.size(), 2u);
|
||||
EXPECT_STREQ(network_.name(sorted[0]), "A");
|
||||
EXPECT_STREQ(network_.name(sorted[1]), "Y");
|
||||
EXPECT_EQ(network_.name(sorted[0]), "A");
|
||||
EXPECT_EQ(network_.name(sorted[1]), "Y");
|
||||
}
|
||||
|
||||
// NetworkCmp comparator constructors
|
||||
|
|
@ -2212,8 +2209,8 @@ TEST_F(ConcreteNetworkLinkedTest, PortFromToIndexViaNetwork) {
|
|||
TEST_F(ConcreteNetworkLinkedTest, PortBusNameViaNetwork) {
|
||||
Cell *inv_cell = network_.findCell(lib_, "INV");
|
||||
Port *port_a = network_.findPort(inv_cell, "A");
|
||||
const char *bus_name = network_.busName(port_a);
|
||||
EXPECT_STREQ(bus_name, "A");
|
||||
std::string bus_name = network_.busName(port_a);
|
||||
EXPECT_EQ(bus_name, "A");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PortFindBusBitViaNetwork) {
|
||||
|
|
@ -2308,7 +2305,7 @@ TEST_F(ConcreteNetworkLinkedTest, GroupBusPortsViaNetwork) {
|
|||
ConcreteLibrary *clib = reinterpret_cast<ConcreteLibrary*>(lib_);
|
||||
clib->setBusBrkts('[', ']');
|
||||
|
||||
network_.groupBusPorts(cell, [](const char*) { return true; });
|
||||
network_.groupBusPorts(cell, [](std::string_view) { return true; });
|
||||
Port *bus = network_.findPort(cell, "D");
|
||||
EXPECT_NE(bus, nullptr);
|
||||
if (bus) {
|
||||
|
|
@ -2558,29 +2555,29 @@ TEST_F(ConcreteNetworkLinkedTest, PortDirectionAccess) {
|
|||
|
||||
// Network: various accessor methods
|
||||
TEST_F(ConcreteNetworkLinkedTest, LibraryNameAccess) {
|
||||
EXPECT_STREQ(network_.name(lib_), "test_lib");
|
||||
EXPECT_EQ(network_.name(lib_), "test_lib");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, CellNameAccess) {
|
||||
Cell *inv_cell = network_.findCell(lib_, "INV");
|
||||
EXPECT_STREQ(network_.name(inv_cell), "INV");
|
||||
EXPECT_EQ(network_.name(inv_cell), "INV");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, PortNameAccess) {
|
||||
Cell *inv_cell = network_.findCell(lib_, "INV");
|
||||
Port *port_a = network_.findPort(inv_cell, "A");
|
||||
EXPECT_STREQ(network_.name(port_a), "A");
|
||||
EXPECT_EQ(network_.name(port_a), "A");
|
||||
}
|
||||
|
||||
TEST_F(ConcreteNetworkLinkedTest, NetNameAccess) {
|
||||
EXPECT_STREQ(network_.name(net1_), "n1");
|
||||
EXPECT_EQ(network_.name(net1_), "n1");
|
||||
}
|
||||
|
||||
// Network: cell filename
|
||||
TEST_F(ConcreteNetworkLinkedTest, CellFilename) {
|
||||
Cell *inv_cell = network_.findCell(lib_, "INV");
|
||||
const char *fn = network_.filename(inv_cell);
|
||||
EXPECT_STREQ(fn, "test.lib");
|
||||
std::string_view fn = network_.filename(inv_cell);
|
||||
EXPECT_EQ(fn, "test.lib");
|
||||
}
|
||||
|
||||
// PinSet default constructor
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "StringUtil.hh"
|
||||
#include "MinMax.hh"
|
||||
|
|
@ -41,132 +43,114 @@ class SpefNamespaceTest : public ::testing::Test {};
|
|||
|
||||
// Basic identity: no dividers or escapes needed
|
||||
TEST_F(SpefNamespaceTest, SpefToStaSimpleName) {
|
||||
char *result = spefToSta("net1", '/', '/', '\\');
|
||||
EXPECT_STREQ(result, "net1");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("net1", '/', '/', '\\');
|
||||
EXPECT_EQ(result, "net1");
|
||||
}
|
||||
|
||||
TEST_F(SpefNamespaceTest, StaToSpefSimpleName) {
|
||||
char *result = staToSpef("net1", '/', '/', '\\');
|
||||
EXPECT_STREQ(result, "net1");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("net1", '/', '/', '\\');
|
||||
EXPECT_EQ(result, "net1");
|
||||
}
|
||||
|
||||
// SPEF divider to STA divider translation
|
||||
TEST_F(SpefNamespaceTest, SpefToStaDividerTranslation) {
|
||||
// SPEF uses '.' as divider, STA uses '/'
|
||||
char *result = spefToSta("top.sub.net", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "top/sub/net");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("top.sub.net", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "top/sub/net");
|
||||
}
|
||||
|
||||
TEST_F(SpefNamespaceTest, StaToSpefDividerTranslation) {
|
||||
// STA uses '/' as divider, SPEF uses '.'
|
||||
char *result = staToSpef("top/sub/net", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "top.sub.net");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("top/sub/net", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "top.sub.net");
|
||||
}
|
||||
|
||||
// Escaped divider in SPEF
|
||||
TEST_F(SpefNamespaceTest, SpefToStaEscapedDivider) {
|
||||
// In SPEF, "\." is an escaped divider
|
||||
char *result = spefToSta("top\\.net", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "top\\/net");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("top\\.net", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "top\\/net");
|
||||
}
|
||||
|
||||
// Escaped brackets in SPEF
|
||||
TEST_F(SpefNamespaceTest, SpefToStaEscapedBracket) {
|
||||
char *result = spefToSta("bus\\[0\\]", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "bus\\[0\\]");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("bus\\[0\\]", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "bus\\[0\\]");
|
||||
}
|
||||
|
||||
// STA to SPEF escaped brackets
|
||||
TEST_F(SpefNamespaceTest, StaToSpefEscapedBracket) {
|
||||
char *result = staToSpef("bus\\[0\\]", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "bus\\[0\\]");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("bus\\[0\\]", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "bus\\[0\\]");
|
||||
}
|
||||
|
||||
// SPEF escaped backslash
|
||||
TEST_F(SpefNamespaceTest, SpefToStaEscapedBackslash) {
|
||||
// "\\" in SPEF means literal backslash
|
||||
char *result = spefToSta("name\\\\end", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "name\\\\end");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("name\\\\end", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "name\\\\end");
|
||||
}
|
||||
|
||||
// SPEF escape of non-special character
|
||||
TEST_F(SpefNamespaceTest, SpefToStaEscapedNonSpecial) {
|
||||
// "\a" - 'a' is not divider, not bracket, not backslash
|
||||
char *result = spefToSta("\\a", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "a");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("\\a", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "a");
|
||||
}
|
||||
|
||||
// STA to SPEF escaping non-alphanumeric characters
|
||||
TEST_F(SpefNamespaceTest, StaToSpefSpecialChars) {
|
||||
// '@' should get escaped in SPEF
|
||||
char *result = staToSpef("net@1", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "net\\@1");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("net@1", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "net\\@1");
|
||||
}
|
||||
|
||||
// STA to SPEF: escape for path_escape + non-special char
|
||||
TEST_F(SpefNamespaceTest, StaToSpefEscapedNonSpecial) {
|
||||
// "\\a" - escape + 'a' (not divider, not bracket)
|
||||
char *result = staToSpef("\\a", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "a");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("\\a", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "a");
|
||||
}
|
||||
|
||||
// Empty string
|
||||
TEST_F(SpefNamespaceTest, SpefToStaEmpty) {
|
||||
char *result = spefToSta("", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "");
|
||||
}
|
||||
|
||||
TEST_F(SpefNamespaceTest, StaToSpefEmpty) {
|
||||
char *result = staToSpef("", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "");
|
||||
}
|
||||
|
||||
// Different divider characters
|
||||
TEST_F(SpefNamespaceTest, SpefToStaColonDivider) {
|
||||
char *result = spefToSta("a:b:c", ':', '.', '\\');
|
||||
EXPECT_STREQ(result, "a.b.c");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("a:b:c", ':', '.', '\\');
|
||||
EXPECT_EQ(result, "a.b.c");
|
||||
}
|
||||
|
||||
TEST_F(SpefNamespaceTest, StaToSpefColonDivider) {
|
||||
char *result = staToSpef("a.b.c", ':', '.', '\\');
|
||||
EXPECT_STREQ(result, "a:b:c");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("a.b.c", ':', '.', '\\');
|
||||
EXPECT_EQ(result, "a:b:c");
|
||||
}
|
||||
|
||||
// Underscores and digits should pass through in staToSpef
|
||||
TEST_F(SpefNamespaceTest, StaToSpefAlphanumUnderscore) {
|
||||
char *result = staToSpef("abc_123_XYZ", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "abc_123_XYZ");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("abc_123_XYZ", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "abc_123_XYZ");
|
||||
}
|
||||
|
||||
// Multiple consecutive dividers
|
||||
TEST_F(SpefNamespaceTest, SpefToStaMultipleDividers) {
|
||||
char *result = spefToSta("a..b", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "a//b");
|
||||
delete[] result;
|
||||
std::string result = spefToSta("a..b", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "a//b");
|
||||
}
|
||||
|
||||
// STA escaped divider (path_escape + path_divider)
|
||||
TEST_F(SpefNamespaceTest, StaToSpefEscapedDivider) {
|
||||
// "\/" in STA namespace => "\." in SPEF namespace
|
||||
char *result = staToSpef("\\/", '.', '/', '\\');
|
||||
EXPECT_STREQ(result, "\\.");
|
||||
delete[] result;
|
||||
std::string result = staToSpef("\\/", '.', '/', '\\');
|
||||
EXPECT_EQ(result, "\\.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -2137,7 +2121,7 @@ TEST_F(DesignParasiticsTest, TimingWithParasitics) {
|
|||
waveform->push_back(0.0f);
|
||||
waveform->push_back(250.0f);
|
||||
|
||||
sta_->makeClock("clk", clk_pins, false, 500.0f, waveform, nullptr,
|
||||
sta_->makeClock("clk", clk_pins, false, 500.0f, waveform, "",
|
||||
sta_->cmdMode());
|
||||
|
||||
// Run timing update to exercise delay calculation with parasitics
|
||||
|
|
|
|||
|
|
@ -231,31 +231,31 @@ TEST_F(PwrActivityTest, OriginName) {
|
|||
PwrActivity activity;
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::global);
|
||||
EXPECT_STREQ(activity.originName(), "global");
|
||||
EXPECT_EQ(activity.originName(), "global");
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::input);
|
||||
EXPECT_STREQ(activity.originName(), "input");
|
||||
EXPECT_EQ(activity.originName(), "input");
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::user);
|
||||
EXPECT_STREQ(activity.originName(), "user");
|
||||
EXPECT_EQ(activity.originName(), "user");
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::vcd);
|
||||
EXPECT_STREQ(activity.originName(), "vcd");
|
||||
EXPECT_EQ(activity.originName(), "vcd");
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::saif);
|
||||
EXPECT_STREQ(activity.originName(), "saif");
|
||||
EXPECT_EQ(activity.originName(), "saif");
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::propagated);
|
||||
EXPECT_STREQ(activity.originName(), "propagated");
|
||||
EXPECT_EQ(activity.originName(), "propagated");
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::clock);
|
||||
EXPECT_STREQ(activity.originName(), "clock");
|
||||
EXPECT_EQ(activity.originName(), "clock");
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::constant);
|
||||
EXPECT_STREQ(activity.originName(), "constant");
|
||||
EXPECT_EQ(activity.originName(), "constant");
|
||||
|
||||
activity.setOrigin(PwrActivityOrigin::unknown);
|
||||
EXPECT_STREQ(activity.originName(), "unknown");
|
||||
EXPECT_EQ(activity.originName(), "unknown");
|
||||
}
|
||||
|
||||
TEST_F(PwrActivityTest, VerySmallDensityClipped) {
|
||||
|
|
@ -346,15 +346,15 @@ TEST_F(PowerResultTest, MultipleIncrements) {
|
|||
|
||||
TEST_F(PwrActivityTest, OriginNames) {
|
||||
// Test all origin name strings
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::unknown).originName(), "unknown");
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::global).originName(), "global");
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::input).originName(), "input");
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::user).originName(), "user");
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::vcd).originName(), "vcd");
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::saif).originName(), "saif");
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::propagated).originName(), "propagated");
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::clock).originName(), "clock");
|
||||
EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::constant).originName(), "constant");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::unknown).originName(), "unknown");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::global).originName(), "global");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::input).originName(), "input");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::user).originName(), "user");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::vcd).originName(), "vcd");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::saif).originName(), "saif");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::propagated).originName(), "propagated");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::clock).originName(), "clock");
|
||||
EXPECT_EQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::constant).originName(), "constant");
|
||||
}
|
||||
|
||||
// Construct and test with explicit density/duty
|
||||
|
|
@ -597,15 +597,15 @@ TEST_F(PwrActivityTest, NegativeNearThreshold) {
|
|||
// Test PwrActivity originName for all origins
|
||||
// Covers: PwrActivity::originName exhaustive
|
||||
TEST_F(PwrActivityTest, OriginNameExhaustive) {
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::unknown).originName(), "unknown");
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::global).originName(), "global");
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::input).originName(), "input");
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::user).originName(), "user");
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::vcd).originName(), "vcd");
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::saif).originName(), "saif");
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::propagated).originName(), "propagated");
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::clock).originName(), "clock");
|
||||
EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::constant).originName(), "constant");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::unknown).originName(), "unknown");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::global).originName(), "global");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::input).originName(), "input");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::user).originName(), "user");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::vcd).originName(), "vcd");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::saif).originName(), "saif");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::propagated).originName(), "propagated");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::clock).originName(), "clock");
|
||||
EXPECT_EQ(PwrActivity(0, 0, PwrActivityOrigin::constant).originName(), "constant");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -60,7 +60,7 @@ TEST_F(SdfSmokeTest, AllSdfTransitions) {
|
|||
|
||||
// 0Z
|
||||
EXPECT_NE(Transition::tr0Z(), nullptr);
|
||||
EXPECT_NE(Transition::tr0Z()->asInitFinalString(), nullptr);
|
||||
EXPECT_FALSE(Transition::tr0Z()->asInitFinalString().empty());
|
||||
|
||||
// Z1
|
||||
EXPECT_NE(Transition::trZ1(), nullptr);
|
||||
|
|
@ -135,10 +135,10 @@ TEST_F(SdfSmokeTest, RiseFallFind) {
|
|||
|
||||
// Test RiseFall names
|
||||
TEST_F(SdfSmokeTest, RiseFallNames) {
|
||||
EXPECT_STREQ(RiseFall::rise()->name(), "rise");
|
||||
EXPECT_STREQ(RiseFall::fall()->name(), "fall");
|
||||
EXPECT_STREQ(RiseFall::rise()->shortName(), "^");
|
||||
EXPECT_STREQ(RiseFall::fall()->shortName(), "v");
|
||||
EXPECT_EQ(RiseFall::rise()->name(), "rise");
|
||||
EXPECT_EQ(RiseFall::fall()->name(), "fall");
|
||||
EXPECT_EQ(RiseFall::rise()->shortName(), "^");
|
||||
EXPECT_EQ(RiseFall::fall()->shortName(), "v");
|
||||
}
|
||||
|
||||
// Test RiseFall opposite
|
||||
|
|
@ -160,8 +160,8 @@ TEST_F(SdfSmokeTest, RiseFallBothBasic) {
|
|||
EXPECT_NE(RiseFallBoth::fall(), nullptr);
|
||||
EXPECT_NE(RiseFallBoth::riseFall(), nullptr);
|
||||
|
||||
EXPECT_STREQ(RiseFallBoth::rise()->name(), "rise");
|
||||
EXPECT_STREQ(RiseFallBoth::fall()->name(), "fall");
|
||||
EXPECT_EQ(RiseFallBoth::rise()->name(), "rise");
|
||||
EXPECT_EQ(RiseFallBoth::fall()->name(), "fall");
|
||||
}
|
||||
|
||||
// Test RiseFallBoth matches
|
||||
|
|
@ -174,8 +174,8 @@ TEST_F(SdfSmokeTest, RiseFallBothMatches) {
|
|||
|
||||
// Test MinMax details
|
||||
TEST_F(SdfSmokeTest, MinMaxDetails) {
|
||||
EXPECT_STREQ(MinMax::min()->to_string().c_str(), "min");
|
||||
EXPECT_STREQ(MinMax::max()->to_string().c_str(), "max");
|
||||
EXPECT_EQ(MinMax::min()->to_string(), "min");
|
||||
EXPECT_EQ(MinMax::max()->to_string(), "max");
|
||||
EXPECT_EQ(MinMax::min()->index(), MinMax::minIndex());
|
||||
EXPECT_EQ(MinMax::max()->index(), MinMax::maxIndex());
|
||||
}
|
||||
|
|
@ -326,18 +326,18 @@ TEST_F(SdfSmokeTest, AllTransitionSdfTripleIndex) {
|
|||
|
||||
// Test all transition initFinal strings
|
||||
TEST_F(SdfSmokeTest, AllTransitionInitFinalString) {
|
||||
EXPECT_STREQ(Transition::rise()->asInitFinalString(), "01");
|
||||
EXPECT_STREQ(Transition::fall()->asInitFinalString(), "10");
|
||||
EXPECT_STREQ(Transition::tr0Z()->asInitFinalString(), "0Z");
|
||||
EXPECT_STREQ(Transition::trZ1()->asInitFinalString(), "Z1");
|
||||
EXPECT_STREQ(Transition::tr1Z()->asInitFinalString(), "1Z");
|
||||
EXPECT_STREQ(Transition::trZ0()->asInitFinalString(), "Z0");
|
||||
EXPECT_STREQ(Transition::tr0X()->asInitFinalString(), "0X");
|
||||
EXPECT_STREQ(Transition::trX1()->asInitFinalString(), "X1");
|
||||
EXPECT_STREQ(Transition::tr1X()->asInitFinalString(), "1X");
|
||||
EXPECT_STREQ(Transition::trX0()->asInitFinalString(), "X0");
|
||||
EXPECT_STREQ(Transition::trXZ()->asInitFinalString(), "XZ");
|
||||
EXPECT_STREQ(Transition::trZX()->asInitFinalString(), "ZX");
|
||||
EXPECT_EQ(Transition::rise()->asInitFinalString(), "01");
|
||||
EXPECT_EQ(Transition::fall()->asInitFinalString(), "10");
|
||||
EXPECT_EQ(Transition::tr0Z()->asInitFinalString(), "0Z");
|
||||
EXPECT_EQ(Transition::trZ1()->asInitFinalString(), "Z1");
|
||||
EXPECT_EQ(Transition::tr1Z()->asInitFinalString(), "1Z");
|
||||
EXPECT_EQ(Transition::trZ0()->asInitFinalString(), "Z0");
|
||||
EXPECT_EQ(Transition::tr0X()->asInitFinalString(), "0X");
|
||||
EXPECT_EQ(Transition::trX1()->asInitFinalString(), "X1");
|
||||
EXPECT_EQ(Transition::tr1X()->asInitFinalString(), "1X");
|
||||
EXPECT_EQ(Transition::trX0()->asInitFinalString(), "X0");
|
||||
EXPECT_EQ(Transition::trXZ()->asInitFinalString(), "XZ");
|
||||
EXPECT_EQ(Transition::trZX()->asInitFinalString(), "ZX");
|
||||
}
|
||||
|
||||
// Test all transition asRiseFall
|
||||
|
|
@ -416,16 +416,16 @@ TEST_F(SdfSmokeTest, MinMaxAllAsMinMax) {
|
|||
// Covers: SdfWriter::sdfEdge - exercises transition to SDF edge string mapping
|
||||
TEST_F(SdfSmokeTest, TransitionAsInitFinalString) {
|
||||
// SDF uses init/final transition string representation
|
||||
EXPECT_NE(Transition::rise()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::fall()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::tr0Z()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::trZ1()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::tr1Z()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::trZ0()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::tr0X()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::trX1()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::tr1X()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::trX0()->asInitFinalString(), nullptr);
|
||||
EXPECT_FALSE(Transition::rise()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::fall()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::tr0Z()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::trZ1()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::tr1Z()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::trZ0()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::tr0X()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::trX1()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::tr1X()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::trX0()->asInitFinalString().empty());
|
||||
}
|
||||
|
||||
// Test Transition asRiseFall for SDF edge transitions
|
||||
|
|
@ -538,7 +538,7 @@ TEST_F(SdfSmokeTest, MinMaxAllRangeIndex) {
|
|||
TEST_F(SdfSmokeTest, MinMaxConstructorCoverage) {
|
||||
// The MinMax constructor is private; we verify it was called via singletons
|
||||
const MinMax *mn = MinMax::min();
|
||||
EXPECT_STREQ(mn->to_string().c_str(), "min");
|
||||
EXPECT_EQ(mn->to_string(), "min");
|
||||
EXPECT_EQ(mn->index(), MinMax::minIndex());
|
||||
EXPECT_GT(mn->initValue(), 0.0f);
|
||||
EXPECT_GT(mn->initValueInt(), 0);
|
||||
|
|
@ -547,7 +547,7 @@ TEST_F(SdfSmokeTest, MinMaxConstructorCoverage) {
|
|||
EXPECT_FALSE(mn->compare(3.0f, 2.0f));
|
||||
|
||||
const MinMax *mx = MinMax::max();
|
||||
EXPECT_STREQ(mx->to_string().c_str(), "max");
|
||||
EXPECT_EQ(mx->to_string(), "max");
|
||||
EXPECT_EQ(mx->index(), MinMax::maxIndex());
|
||||
EXPECT_LT(mx->initValue(), 0.0f);
|
||||
EXPECT_LT(mx->initValueInt(), 0);
|
||||
|
|
@ -1001,7 +1001,7 @@ TEST_F(SdfDesignTest, WriteThenReadSdf) {
|
|||
sta_->writeSdf(tmpfile, corner, '/', true, 3, false, true, true);
|
||||
|
||||
// Now read it back
|
||||
readSdf(tmpfile, nullptr, corner, false, false,
|
||||
readSdf(tmpfile, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(tmpfile);
|
||||
|
|
@ -1021,7 +1021,7 @@ TEST_F(SdfDesignTest, ReadSdfUnescapedDividers) {
|
|||
const char *tmpfile = "/tmp/test_r9_sdf_unesc.sdf";
|
||||
sta_->writeSdf(tmpfile, corner, '/', true, 3, false, true, true);
|
||||
|
||||
readSdf(tmpfile, nullptr, corner, true, false,
|
||||
readSdf(tmpfile, "", corner, true, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(tmpfile);
|
||||
|
|
@ -1041,7 +1041,7 @@ TEST_F(SdfDesignTest, ReadSdfIncrementalOnly) {
|
|||
const char *tmpfile = "/tmp/test_r9_sdf_incr.sdf";
|
||||
sta_->writeSdf(tmpfile, corner, '/', true, 3, false, true, true);
|
||||
|
||||
readSdf(tmpfile, nullptr, corner, false, true,
|
||||
readSdf(tmpfile, "", corner, false, true,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(tmpfile);
|
||||
|
|
@ -1061,7 +1061,7 @@ TEST_F(SdfDesignTest, ReadSdfCondUseMin) {
|
|||
const char *tmpfile = "/tmp/test_r9_sdf_cumin.sdf";
|
||||
sta_->writeSdf(tmpfile, corner, '/', true, 3, false, true, true);
|
||||
|
||||
readSdf(tmpfile, nullptr, corner, false, false,
|
||||
readSdf(tmpfile, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::min()), sta_);
|
||||
|
||||
std::remove(tmpfile);
|
||||
|
|
@ -1081,7 +1081,7 @@ TEST_F(SdfDesignTest, ReadSdfCondUseMax) {
|
|||
const char *tmpfile = "/tmp/test_r9_sdf_cumax.sdf";
|
||||
sta_->writeSdf(tmpfile, corner, '/', true, 3, false, true, true);
|
||||
|
||||
readSdf(tmpfile, nullptr, corner, false, false,
|
||||
readSdf(tmpfile, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::max()), sta_);
|
||||
|
||||
std::remove(tmpfile);
|
||||
|
|
@ -1101,7 +1101,7 @@ TEST_F(SdfDesignTest, ReadSdfCombinedOptions) {
|
|||
const char *tmpfile = "/tmp/test_r9_sdf_combined.sdf";
|
||||
sta_->writeSdf(tmpfile, corner, '/', true, 3, false, true, true);
|
||||
|
||||
readSdf(tmpfile, nullptr, corner, true, true,
|
||||
readSdf(tmpfile, "", corner, true, true,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(tmpfile);
|
||||
|
|
@ -1144,7 +1144,7 @@ TEST_F(SdfDesignTest, WriteSdfGzipThenRead) {
|
|||
const char *tmpfile = "/tmp/test_r9_sdf_gz.sdf.gz";
|
||||
sta_->writeSdf(tmpfile, corner, '/', true, 3, true, true, true);
|
||||
|
||||
readSdf(tmpfile, nullptr, corner, false, false,
|
||||
readSdf(tmpfile, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(tmpfile);
|
||||
|
|
@ -1182,7 +1182,7 @@ TEST_F(SdfDesignTest, ReadSdfNonexistent) {
|
|||
Scene *corner = sta_->cmdScene();
|
||||
// Attempt to read nonexistent SDF - should throw
|
||||
EXPECT_THROW(
|
||||
readSdf("/tmp/nonexistent_r9.sdf", nullptr, corner,
|
||||
readSdf("/tmp/nonexistent_r9.sdf", "", corner,
|
||||
false, false, const_cast<MinMaxAll*>(MinMaxAll::all()), sta_),
|
||||
FileNotReadable
|
||||
);
|
||||
|
|
@ -1195,7 +1195,7 @@ TEST_F(SdfSmokeTest, TransitionRiseProperties) {
|
|||
EXPECT_EQ(t->asRiseFall(), RiseFall::rise());
|
||||
EXPECT_EQ(t->sdfTripleIndex(), RiseFall::riseIndex());
|
||||
EXPECT_FALSE(t->to_string().empty());
|
||||
EXPECT_NE(t->asInitFinalString(), nullptr);
|
||||
EXPECT_FALSE(t->asInitFinalString().empty());
|
||||
}
|
||||
|
||||
TEST_F(SdfSmokeTest, TransitionFallProperties) {
|
||||
|
|
@ -1204,7 +1204,7 @@ TEST_F(SdfSmokeTest, TransitionFallProperties) {
|
|||
EXPECT_EQ(t->asRiseFall(), RiseFall::fall());
|
||||
EXPECT_EQ(t->sdfTripleIndex(), RiseFall::fallIndex());
|
||||
EXPECT_FALSE(t->to_string().empty());
|
||||
EXPECT_NE(t->asInitFinalString(), nullptr);
|
||||
EXPECT_FALSE(t->asInitFinalString().empty());
|
||||
}
|
||||
|
||||
TEST_F(SdfSmokeTest, TransitionTristateProperties) {
|
||||
|
|
@ -1418,7 +1418,7 @@ TEST_F(SdfDesignTest, ReadHandCraftedSdf) {
|
|||
fprintf(fp, ")\n");
|
||||
fclose(fp);
|
||||
|
||||
readSdf(sdf_path, nullptr, corner, false, false,
|
||||
readSdf(sdf_path, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(sdf_path);
|
||||
|
|
@ -1455,7 +1455,7 @@ TEST_F(SdfDesignTest, ReadSdfEdgeIopath) {
|
|||
fprintf(fp, ")\n");
|
||||
fclose(fp);
|
||||
|
||||
readSdf(sdf_path, nullptr, corner, false, false,
|
||||
readSdf(sdf_path, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(sdf_path);
|
||||
|
|
@ -1489,7 +1489,7 @@ TEST_F(SdfDesignTest, ReadSdfSetupHold) {
|
|||
fprintf(fp, ")\n");
|
||||
fclose(fp);
|
||||
|
||||
readSdf(sdf_path, nullptr, corner, false, false,
|
||||
readSdf(sdf_path, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(sdf_path);
|
||||
|
|
@ -1523,7 +1523,7 @@ TEST_F(SdfDesignTest, ReadSdfRecRem) {
|
|||
fprintf(fp, ")\n");
|
||||
fclose(fp);
|
||||
|
||||
readSdf(sdf_path, nullptr, corner, false, false,
|
||||
readSdf(sdf_path, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(sdf_path);
|
||||
|
|
@ -1557,7 +1557,7 @@ TEST_F(SdfDesignTest, ReadSdfWidth) {
|
|||
fprintf(fp, ")\n");
|
||||
fclose(fp);
|
||||
|
||||
readSdf(sdf_path, nullptr, corner, false, false,
|
||||
readSdf(sdf_path, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(sdf_path);
|
||||
|
|
@ -1591,7 +1591,7 @@ TEST_F(SdfDesignTest, ReadSdfPeriod) {
|
|||
fprintf(fp, ")\n");
|
||||
fclose(fp);
|
||||
|
||||
readSdf(sdf_path, nullptr, corner, false, false,
|
||||
readSdf(sdf_path, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(sdf_path);
|
||||
|
|
@ -1628,7 +1628,7 @@ TEST_F(SdfDesignTest, ReadSdfNochange) {
|
|||
|
||||
// NOCHANGE is not supported and throws an exception
|
||||
EXPECT_THROW(
|
||||
readSdf(sdf_path, nullptr, corner, false, false,
|
||||
readSdf(sdf_path, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_),
|
||||
std::exception
|
||||
);
|
||||
|
|
@ -1666,7 +1666,7 @@ TEST_F(SdfDesignTest, ReadSdfInterconnect) {
|
|||
fprintf(fp, ")\n");
|
||||
fclose(fp);
|
||||
|
||||
readSdf(sdf_path, nullptr, corner, false, false,
|
||||
readSdf(sdf_path, "", corner, false, false,
|
||||
const_cast<MinMaxAll*>(MinMaxAll::all()), sta_);
|
||||
|
||||
std::remove(sdf_path);
|
||||
|
|
|
|||
|
|
@ -170,14 +170,14 @@ TEST_F(PropertyValueTest, DefaultConstructor) {
|
|||
TEST_F(PropertyValueTest, StringConstructor) {
|
||||
PropertyValue pv("hello");
|
||||
EXPECT_EQ(pv.type(), PropertyValue::Type::string);
|
||||
EXPECT_STREQ(pv.stringValue(), "hello");
|
||||
EXPECT_EQ(pv.stringValue(), "hello");
|
||||
}
|
||||
|
||||
TEST_F(PropertyValueTest, StdStringConstructor) {
|
||||
std::string s("world");
|
||||
PropertyValue pv(s);
|
||||
EXPECT_EQ(pv.type(), PropertyValue::Type::string);
|
||||
EXPECT_STREQ(pv.stringValue(), "world");
|
||||
EXPECT_EQ(pv.stringValue(), "world");
|
||||
}
|
||||
|
||||
TEST_F(PropertyValueTest, BoolConstructorTrue) {
|
||||
|
|
@ -275,7 +275,7 @@ TEST_F(PropertyValueTest, CopyConstructorString) {
|
|||
PropertyValue pv1("copy_test");
|
||||
PropertyValue pv2(pv1);
|
||||
EXPECT_EQ(pv2.type(), PropertyValue::Type::string);
|
||||
EXPECT_STREQ(pv2.stringValue(), "copy_test");
|
||||
EXPECT_EQ(pv2.stringValue(), "copy_test");
|
||||
}
|
||||
|
||||
TEST_F(PropertyValueTest, CopyConstructorFloat) {
|
||||
|
|
@ -382,7 +382,7 @@ TEST_F(PropertyValueTest, MoveConstructorString) {
|
|||
PropertyValue pv1("move_test");
|
||||
PropertyValue pv2(std::move(pv1));
|
||||
EXPECT_EQ(pv2.type(), PropertyValue::Type::string);
|
||||
EXPECT_STREQ(pv2.stringValue(), "move_test");
|
||||
EXPECT_EQ(pv2.stringValue(), "move_test");
|
||||
}
|
||||
|
||||
TEST_F(PropertyValueTest, MoveConstructorFloat) {
|
||||
|
|
@ -480,7 +480,7 @@ TEST_F(PropertyValueTest, CopyAssignmentString) {
|
|||
PropertyValue pv2;
|
||||
pv2 = pv1;
|
||||
EXPECT_EQ(pv2.type(), PropertyValue::Type::string);
|
||||
EXPECT_STREQ(pv2.stringValue(), "assign_test");
|
||||
EXPECT_EQ(pv2.stringValue(), "assign_test");
|
||||
}
|
||||
|
||||
TEST_F(PropertyValueTest, CopyAssignmentFloat) {
|
||||
|
|
@ -591,7 +591,7 @@ TEST_F(PropertyValueTest, MoveAssignmentString) {
|
|||
PropertyValue pv2;
|
||||
pv2 = std::move(pv1);
|
||||
EXPECT_EQ(pv2.type(), PropertyValue::Type::string);
|
||||
EXPECT_STREQ(pv2.stringValue(), "move_assign");
|
||||
EXPECT_EQ(pv2.stringValue(), "move_assign");
|
||||
}
|
||||
|
||||
TEST_F(PropertyValueTest, MoveAssignmentFloat) {
|
||||
|
|
@ -950,7 +950,7 @@ protected:
|
|||
|
||||
// FalsePath
|
||||
TEST_F(ExceptionPathTest, FalsePathBasic) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_TRUE(fp.isFalse());
|
||||
EXPECT_FALSE(fp.isLoop());
|
||||
EXPECT_FALSE(fp.isMultiCycle());
|
||||
|
|
@ -965,38 +965,38 @@ TEST_F(ExceptionPathTest, FalsePathBasic) {
|
|||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, FalsePathTypeString) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_EQ(fp.typePriority(), ExceptionPath::falsePathPriority());
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, FalsePathTighterThan) {
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
// FalsePath tighterThan always returns false
|
||||
EXPECT_FALSE(fp1.tighterThan(&fp2));
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, FalsePathMatches) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_TRUE(fp.matches(MinMax::min(), false));
|
||||
EXPECT_TRUE(fp.matches(MinMax::max(), false));
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, FalsePathMatchesMinOnly) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::min(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::min(), true, "");
|
||||
EXPECT_TRUE(fp.matches(MinMax::min(), false));
|
||||
EXPECT_FALSE(fp.matches(MinMax::max(), false));
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, FalsePathMergeable) {
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_TRUE(fp1.mergeable(&fp2));
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, FalsePathOverrides) {
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_TRUE(fp1.overrides(&fp2));
|
||||
}
|
||||
|
||||
|
|
@ -1026,7 +1026,7 @@ TEST_F(ExceptionPathTest, LoopPathNotMergeable) {
|
|||
// PathDelay
|
||||
TEST_F(ExceptionPathTest, PathDelayBasic) {
|
||||
PathDelay pd(nullptr, nullptr, nullptr, MinMax::max(), false, false,
|
||||
10.0e-9f, true, nullptr);
|
||||
10.0e-9f, true, "");
|
||||
EXPECT_TRUE(pd.isPathDelay());
|
||||
EXPECT_FALSE(pd.isFalse());
|
||||
EXPECT_FALSE(pd.isMultiCycle());
|
||||
|
|
@ -1038,7 +1038,7 @@ TEST_F(ExceptionPathTest, PathDelayBasic) {
|
|||
|
||||
TEST_F(ExceptionPathTest, PathDelayWithFlags) {
|
||||
PathDelay pd(nullptr, nullptr, nullptr, MinMax::min(), true, true,
|
||||
5.0e-9f, true, nullptr);
|
||||
5.0e-9f, true, "");
|
||||
EXPECT_TRUE(pd.ignoreClkLatency());
|
||||
EXPECT_TRUE(pd.breakPath());
|
||||
EXPECT_FLOAT_EQ(pd.delay(), 5.0e-9f);
|
||||
|
|
@ -1046,15 +1046,15 @@ TEST_F(ExceptionPathTest, PathDelayWithFlags) {
|
|||
|
||||
TEST_F(ExceptionPathTest, PathDelayTypePriority) {
|
||||
PathDelay pd(nullptr, nullptr, nullptr, MinMax::max(), false, false,
|
||||
0.0f, true, nullptr);
|
||||
0.0f, true, "");
|
||||
EXPECT_EQ(pd.typePriority(), ExceptionPath::pathDelayPriority());
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, PathDelayTighterThanMax) {
|
||||
PathDelay pd1(nullptr, nullptr, nullptr, MinMax::max(), false, false,
|
||||
5.0e-9f, true, nullptr);
|
||||
5.0e-9f, true, "");
|
||||
PathDelay pd2(nullptr, nullptr, nullptr, MinMax::max(), false, false,
|
||||
10.0e-9f, true, nullptr);
|
||||
10.0e-9f, true, "");
|
||||
// For max, tighter means smaller delay
|
||||
EXPECT_TRUE(pd1.tighterThan(&pd2));
|
||||
EXPECT_FALSE(pd2.tighterThan(&pd1));
|
||||
|
|
@ -1062,9 +1062,9 @@ TEST_F(ExceptionPathTest, PathDelayTighterThanMax) {
|
|||
|
||||
TEST_F(ExceptionPathTest, PathDelayTighterThanMin) {
|
||||
PathDelay pd1(nullptr, nullptr, nullptr, MinMax::min(), false, false,
|
||||
10.0e-9f, true, nullptr);
|
||||
10.0e-9f, true, "");
|
||||
PathDelay pd2(nullptr, nullptr, nullptr, MinMax::min(), false, false,
|
||||
5.0e-9f, true, nullptr);
|
||||
5.0e-9f, true, "");
|
||||
// For min, tighter means larger delay
|
||||
EXPECT_TRUE(pd1.tighterThan(&pd2));
|
||||
EXPECT_FALSE(pd2.tighterThan(&pd1));
|
||||
|
|
@ -1072,7 +1072,7 @@ TEST_F(ExceptionPathTest, PathDelayTighterThanMin) {
|
|||
|
||||
TEST_F(ExceptionPathTest, PathDelayClone) {
|
||||
PathDelay pd(nullptr, nullptr, nullptr, MinMax::max(), true, true,
|
||||
7.0e-9f, true, nullptr);
|
||||
7.0e-9f, true, "");
|
||||
ExceptionPath *clone = pd.clone(nullptr, nullptr, nullptr, true);
|
||||
EXPECT_TRUE(clone->isPathDelay());
|
||||
EXPECT_FLOAT_EQ(clone->delay(), 7.0e-9f);
|
||||
|
|
@ -1083,16 +1083,16 @@ TEST_F(ExceptionPathTest, PathDelayClone) {
|
|||
|
||||
TEST_F(ExceptionPathTest, PathDelayOverrides) {
|
||||
PathDelay pd1(nullptr, nullptr, nullptr, MinMax::max(), false, false,
|
||||
5.0e-9f, true, nullptr);
|
||||
5.0e-9f, true, "");
|
||||
PathDelay pd2(nullptr, nullptr, nullptr, MinMax::max(), false, false,
|
||||
10.0e-9f, true, nullptr);
|
||||
10.0e-9f, true, "");
|
||||
EXPECT_TRUE(pd1.overrides(&pd2));
|
||||
}
|
||||
|
||||
// MultiCyclePath
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathBasic) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::all(),
|
||||
true, 3, true, nullptr);
|
||||
true, 3, true, "");
|
||||
EXPECT_TRUE(mcp.isMultiCycle());
|
||||
EXPECT_FALSE(mcp.isFalse());
|
||||
EXPECT_FALSE(mcp.isPathDelay());
|
||||
|
|
@ -1103,13 +1103,13 @@ TEST_F(ExceptionPathTest, MultiCyclePathBasic) {
|
|||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathTypePriority) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::all(),
|
||||
false, 2, true, nullptr);
|
||||
false, 2, true, "");
|
||||
EXPECT_EQ(mcp.typePriority(), ExceptionPath::multiCyclePathPriority());
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathMultiplierAll) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::all(),
|
||||
true, 3, true, nullptr);
|
||||
true, 3, true, "");
|
||||
// When min_max_ is all and min_max arg is min, multiplier is 0
|
||||
EXPECT_EQ(mcp.pathMultiplier(MinMax::min()), 0);
|
||||
// For max, returns the actual multiplier
|
||||
|
|
@ -1118,14 +1118,14 @@ TEST_F(ExceptionPathTest, MultiCyclePathMultiplierAll) {
|
|||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathMultiplierSpecific) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::max(),
|
||||
true, 5, true, nullptr);
|
||||
true, 5, true, "");
|
||||
EXPECT_EQ(mcp.pathMultiplier(MinMax::min()), 5);
|
||||
EXPECT_EQ(mcp.pathMultiplier(MinMax::max()), 5);
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathPriorityAll) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::all(),
|
||||
true, 3, true, nullptr);
|
||||
true, 3, true, "");
|
||||
int base_priority = mcp.priority();
|
||||
// priority(min_max) returns priority_ + 1 when min_max_ == all
|
||||
EXPECT_EQ(mcp.priority(MinMax::min()), base_priority + 1);
|
||||
|
|
@ -1134,7 +1134,7 @@ TEST_F(ExceptionPathTest, MultiCyclePathPriorityAll) {
|
|||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathPrioritySpecific) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::max(),
|
||||
true, 3, true, nullptr);
|
||||
true, 3, true, "");
|
||||
int base_priority = mcp.priority();
|
||||
// priority(min_max) returns priority_ + 2 when min_max_ matches
|
||||
EXPECT_EQ(mcp.priority(MinMax::max()), base_priority + 2);
|
||||
|
|
@ -1144,7 +1144,7 @@ TEST_F(ExceptionPathTest, MultiCyclePathPrioritySpecific) {
|
|||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathMatchesAll) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::all(),
|
||||
true, 3, true, nullptr);
|
||||
true, 3, true, "");
|
||||
EXPECT_TRUE(mcp.matches(MinMax::min(), false));
|
||||
EXPECT_TRUE(mcp.matches(MinMax::max(), false));
|
||||
EXPECT_TRUE(mcp.matches(MinMax::min(), true));
|
||||
|
|
@ -1153,7 +1153,7 @@ TEST_F(ExceptionPathTest, MultiCyclePathMatchesAll) {
|
|||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathMatchesMaxSetup) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::max(),
|
||||
true, 3, true, nullptr);
|
||||
true, 3, true, "");
|
||||
EXPECT_TRUE(mcp.matches(MinMax::max(), false));
|
||||
EXPECT_TRUE(mcp.matches(MinMax::max(), true));
|
||||
// For min path, not exact: should still match because multicycle setup
|
||||
|
|
@ -1165,16 +1165,16 @@ TEST_F(ExceptionPathTest, MultiCyclePathMatchesMaxSetup) {
|
|||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathTighterThan) {
|
||||
MultiCyclePath mcp1(nullptr, nullptr, nullptr, MinMaxAll::all(),
|
||||
true, 2, true, nullptr);
|
||||
true, 2, true, "");
|
||||
MultiCyclePath mcp2(nullptr, nullptr, nullptr, MinMaxAll::all(),
|
||||
true, 5, true, nullptr);
|
||||
true, 5, true, "");
|
||||
EXPECT_TRUE(mcp1.tighterThan(&mcp2));
|
||||
EXPECT_FALSE(mcp2.tighterThan(&mcp1));
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, MultiCyclePathClone) {
|
||||
MultiCyclePath mcp(nullptr, nullptr, nullptr, MinMaxAll::max(),
|
||||
true, 4, true, nullptr);
|
||||
true, 4, true, "");
|
||||
ExceptionPath *clone = mcp.clone(nullptr, nullptr, nullptr, true);
|
||||
EXPECT_TRUE(clone->isMultiCycle());
|
||||
EXPECT_EQ(clone->pathMultiplier(), 4);
|
||||
|
|
@ -1228,7 +1228,7 @@ TEST_F(ExceptionPathTest, FilterPathClone) {
|
|||
|
||||
// GroupPath
|
||||
TEST_F(ExceptionPathTest, GroupPathBasic) {
|
||||
GroupPath gp("group1", false, nullptr, nullptr, nullptr, true, nullptr);
|
||||
GroupPath gp("group1", false, nullptr, nullptr, nullptr, true, "");
|
||||
EXPECT_TRUE(gp.isGroupPath());
|
||||
EXPECT_FALSE(gp.isFalse());
|
||||
EXPECT_FALSE(gp.isPathDelay());
|
||||
|
|
@ -1238,19 +1238,19 @@ TEST_F(ExceptionPathTest, GroupPathBasic) {
|
|||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, GroupPathDefault) {
|
||||
GroupPath gp("default_group", true, nullptr, nullptr, nullptr, true, nullptr);
|
||||
GroupPath gp("default_group", true, nullptr, nullptr, nullptr, true, "");
|
||||
EXPECT_TRUE(gp.isDefault());
|
||||
EXPECT_EQ(gp.name(), "default_group");
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, GroupPathTypePriority) {
|
||||
GroupPath gp("gp", false, nullptr, nullptr, nullptr, true, nullptr);
|
||||
GroupPath gp("gp", false, nullptr, nullptr, nullptr, true, "");
|
||||
EXPECT_EQ(gp.typePriority(), ExceptionPath::groupPathPriority());
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, GroupPathTighterThan) {
|
||||
GroupPath gp1("gp1", false, nullptr, nullptr, nullptr, true, nullptr);
|
||||
GroupPath gp2("gp2", false, nullptr, nullptr, nullptr, true, nullptr);
|
||||
GroupPath gp1("gp1", false, nullptr, nullptr, nullptr, true, "");
|
||||
GroupPath gp2("gp2", false, nullptr, nullptr, nullptr, true, "");
|
||||
EXPECT_FALSE(gp1.tighterThan(&gp2));
|
||||
}
|
||||
|
||||
|
|
@ -1277,14 +1277,14 @@ TEST_F(ExceptionPathTest, FromThruToPriority) {
|
|||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, SetId) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_EQ(fp.id(), 0u);
|
||||
fp.setId(42);
|
||||
EXPECT_EQ(fp.id(), 42u);
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, SetPriority) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
int orig_priority = fp.priority();
|
||||
fp.setPriority(9999);
|
||||
EXPECT_EQ(fp.priority(), 9999);
|
||||
|
|
@ -1292,12 +1292,12 @@ TEST_F(ExceptionPathTest, SetPriority) {
|
|||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, FirstPtNone) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_EQ(fp.firstPt(), nullptr);
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, FirstState) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
ExceptionState *state = fp.firstState();
|
||||
EXPECT_NE(state, nullptr);
|
||||
// Should be complete since no from/thru/to
|
||||
|
|
@ -1305,27 +1305,27 @@ TEST_F(ExceptionPathTest, FirstState) {
|
|||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, Hash) {
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
// Same structure should produce same hash
|
||||
EXPECT_EQ(fp1.hash(), fp2.hash());
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, MergeablePts) {
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_TRUE(fp1.mergeablePts(&fp2));
|
||||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, IntersectsPts) {
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_TRUE(fp1.intersectsPts(&fp2, nullptr));
|
||||
}
|
||||
|
||||
// ExceptionState tests
|
||||
TEST_F(ExceptionPathTest, ExceptionStateBasic) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
ExceptionState *state = fp.firstState();
|
||||
EXPECT_EQ(state->exception(), &fp);
|
||||
EXPECT_EQ(state->nextThru(), nullptr);
|
||||
|
|
@ -1333,7 +1333,7 @@ TEST_F(ExceptionPathTest, ExceptionStateBasic) {
|
|||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, ExceptionStateHash) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
ExceptionState *state = fp.firstState();
|
||||
// Hash should be deterministic
|
||||
size_t h = state->hash();
|
||||
|
|
@ -1341,9 +1341,9 @@ TEST_F(ExceptionPathTest, ExceptionStateHash) {
|
|||
}
|
||||
|
||||
TEST_F(ExceptionPathTest, ExceptionStateLess) {
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp1(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
fp1.setId(1);
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp2(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
fp2.setId(2);
|
||||
ExceptionState *s1 = fp1.firstState();
|
||||
ExceptionState *s2 = fp2.firstState();
|
||||
|
|
@ -1366,14 +1366,14 @@ TEST_F(ExceptionPathTest, CheckFromThrusToWithNulls) {
|
|||
|
||||
// ExceptionPtIterator
|
||||
TEST_F(ExceptionPathTest, PtIteratorEmpty) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
ExceptionPtIterator iter(&fp);
|
||||
EXPECT_FALSE(iter.hasNext());
|
||||
}
|
||||
|
||||
// Default values
|
||||
TEST_F(ExceptionPathTest, DefaultValues) {
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, nullptr);
|
||||
FalsePath fp(nullptr, nullptr, nullptr, MinMaxAll::all(), true, "");
|
||||
EXPECT_FALSE(fp.useEndClk());
|
||||
EXPECT_EQ(fp.pathMultiplier(), 0);
|
||||
EXPECT_FLOAT_EQ(fp.delay(), 0.0f);
|
||||
|
|
|
|||
|
|
@ -336,10 +336,10 @@ TEST_F(SpiceSmokeTest, TransitionAsRiseFall) {
|
|||
}
|
||||
|
||||
TEST_F(SpiceSmokeTest, TransitionInitFinalString) {
|
||||
const char *rise_str = Transition::rise()->asInitFinalString();
|
||||
EXPECT_NE(rise_str, nullptr);
|
||||
const char *fall_str = Transition::fall()->asInitFinalString();
|
||||
EXPECT_NE(fall_str, nullptr);
|
||||
std::string rise_str = Transition::rise()->asInitFinalString();
|
||||
EXPECT_FALSE(rise_str.empty());
|
||||
std::string fall_str = Transition::fall()->asInitFinalString();
|
||||
EXPECT_FALSE(fall_str.empty());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -587,8 +587,8 @@ TEST_F(SpiceSmokeTest, RiseFallBothRange) {
|
|||
|
||||
// Test Transition init strings used in WriteSpice
|
||||
TEST_F(SpiceSmokeTest, TransitionInitFinalStrings) {
|
||||
EXPECT_NE(Transition::rise()->asInitFinalString(), nullptr);
|
||||
EXPECT_NE(Transition::fall()->asInitFinalString(), nullptr);
|
||||
EXPECT_FALSE(Transition::rise()->asInitFinalString().empty());
|
||||
EXPECT_FALSE(Transition::fall()->asInitFinalString().empty());
|
||||
}
|
||||
|
||||
// Test MinMax initValue used in spice
|
||||
|
|
@ -804,8 +804,8 @@ TEST_F(SpiceSmokeTest, MinMaxToString) {
|
|||
// Test RiseFall shortName
|
||||
// Covers: RiseFall::shortName
|
||||
TEST_F(SpiceSmokeTest, RiseFallShortName) {
|
||||
EXPECT_STREQ(RiseFall::rise()->shortName(), "^");
|
||||
EXPECT_STREQ(RiseFall::fall()->shortName(), "v");
|
||||
EXPECT_EQ(RiseFall::rise()->shortName(), "^");
|
||||
EXPECT_EQ(RiseFall::fall()->shortName(), "v");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1424,7 +1424,7 @@ protected:
|
|||
FloatSeq *waveform = new FloatSeq;
|
||||
waveform->push_back(0.0f);
|
||||
waveform->push_back(5.0f);
|
||||
sta_->makeClock("clk", clk_pins, false, 10.0f, waveform, nullptr,
|
||||
sta_->makeClock("clk", clk_pins, false, 10.0f, waveform, "",
|
||||
sta_->cmdMode());
|
||||
|
||||
Pin *in1 = network->findPin(top, "in1");
|
||||
|
|
@ -1510,7 +1510,7 @@ TEST_F(SpiceDesignTest, LibertyCellAccess) {
|
|||
ASSERT_NE(and1, nullptr);
|
||||
LibertyCell *cell = network->libertyCell(and1);
|
||||
ASSERT_NE(cell, nullptr);
|
||||
EXPECT_STREQ(cell->name(), "AND2_X1");
|
||||
EXPECT_EQ(cell->name(), "AND2_X1");
|
||||
}
|
||||
|
||||
// Verify liberty cell ports (needed for SPICE subcircuit port mapping)
|
||||
|
|
@ -1726,15 +1726,15 @@ TEST_F(SpiceDesignTest, InstanceCellName) {
|
|||
Network *network = sta_->cmdNetwork();
|
||||
Instance *and1 = network->findInstance("and1");
|
||||
ASSERT_NE(and1, nullptr);
|
||||
const char *cell_name = network->cellName(and1);
|
||||
ASSERT_NE(cell_name, nullptr);
|
||||
EXPECT_STREQ(cell_name, "AND2_X1");
|
||||
std::string cell_name = network->cellName(and1);
|
||||
EXPECT_FALSE(cell_name.empty());
|
||||
EXPECT_EQ(cell_name, "AND2_X1");
|
||||
|
||||
Instance *reg1 = network->findInstance("reg1");
|
||||
ASSERT_NE(reg1, nullptr);
|
||||
cell_name = network->cellName(reg1);
|
||||
ASSERT_NE(cell_name, nullptr);
|
||||
EXPECT_STREQ(cell_name, "DFF_X1");
|
||||
EXPECT_FALSE(cell_name.empty());
|
||||
EXPECT_EQ(cell_name, "DFF_X1");
|
||||
}
|
||||
|
||||
// Verify print with SPICE subcircuit instance format for design cells
|
||||
|
|
@ -1747,8 +1747,8 @@ TEST_F(SpiceDesignTest, StreamPrintSubcktInst) {
|
|||
Network *network = sta_->cmdNetwork();
|
||||
Instance *and1 = network->findInstance("and1");
|
||||
ASSERT_NE(and1, nullptr);
|
||||
const char *inst_name = network->name(and1);
|
||||
const char *cell_name = network->cellName(and1);
|
||||
std::string inst_name = network->name(and1);
|
||||
std::string cell_name = network->cellName(and1);
|
||||
|
||||
std::ofstream out(tmpl);
|
||||
ASSERT_TRUE(out.is_open());
|
||||
|
|
@ -1770,10 +1770,10 @@ TEST_F(SpiceDesignTest, NetNamesForSpice) {
|
|||
ASSERT_NE(and1_zn, nullptr);
|
||||
Net *net = network->net(and1_zn);
|
||||
ASSERT_NE(net, nullptr);
|
||||
const char *net_name = network->name(net);
|
||||
EXPECT_NE(net_name, nullptr);
|
||||
std::string net_name = network->name(net);
|
||||
EXPECT_FALSE(net_name.empty());
|
||||
// The net name should be "n1" (from the Verilog: wire n1)
|
||||
EXPECT_STREQ(net_name, "n1");
|
||||
EXPECT_EQ(net_name, "n1");
|
||||
}
|
||||
|
||||
// Verify hold timing paths (for SPICE min-delay analysis)
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ TEST(RiseFallValuesTest, OverwriteValue)
|
|||
TEST(PatternMatchClassTest, SimpleGlobConstructor)
|
||||
{
|
||||
PatternMatch pm("hello");
|
||||
EXPECT_STREQ(pm.pattern(), "hello");
|
||||
EXPECT_EQ(pm.pattern(), "hello");
|
||||
EXPECT_FALSE(pm.isRegexp());
|
||||
EXPECT_FALSE(pm.nocase());
|
||||
EXPECT_EQ(pm.tclInterp(), nullptr);
|
||||
|
|
@ -728,7 +728,7 @@ TEST(PatternMatchClassTest, InheritFromConstructor)
|
|||
{
|
||||
PatternMatch parent("base*", false, true, nullptr);
|
||||
PatternMatch child("child*", &parent);
|
||||
EXPECT_STREQ(child.pattern(), "child*");
|
||||
EXPECT_EQ(child.pattern(), "child*");
|
||||
EXPECT_FALSE(child.isRegexp());
|
||||
EXPECT_TRUE(child.nocase());
|
||||
EXPECT_TRUE(child.match("children"));
|
||||
|
|
@ -1162,21 +1162,6 @@ TEST(ReportTest, LogAndConsoleSimultaneous)
|
|||
// Additional StringUtil tests
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(StringUtilTest, StringCopy)
|
||||
{
|
||||
const char *orig = "hello";
|
||||
char *copy = stringCopy(orig);
|
||||
EXPECT_STREQ(copy, "hello");
|
||||
EXPECT_NE(copy, orig);
|
||||
stringDelete(copy);
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StringCopyNull)
|
||||
{
|
||||
char *copy = stringCopy(nullptr);
|
||||
EXPECT_EQ(copy, nullptr);
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StaFormat)
|
||||
{
|
||||
std::string s = sta::format("value={}", 42);
|
||||
|
|
@ -1208,47 +1193,12 @@ TEST(StringUtilTest, StaFormatTmp)
|
|||
EXPECT_EQ(s, "tmp 42");
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, MakeTmpString)
|
||||
{
|
||||
char *tmp = makeTmpString(100);
|
||||
EXPECT_NE(tmp, nullptr);
|
||||
// We can write to it
|
||||
strcpy(tmp, "test");
|
||||
EXPECT_STREQ(tmp, "test");
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, MakeTmpStringFromStdString)
|
||||
{
|
||||
std::string s = "hello";
|
||||
char *tmp = makeTmpString(s);
|
||||
EXPECT_STREQ(tmp, "hello");
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, IsTmpString)
|
||||
{
|
||||
char *tmp = makeTmpString(10);
|
||||
strcpy(tmp, "test");
|
||||
EXPECT_TRUE(isTmpString(tmp));
|
||||
|
||||
char local[] = "local";
|
||||
EXPECT_FALSE(isTmpString(local));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StringEqWithLength)
|
||||
{
|
||||
EXPECT_TRUE(stringEq("hello world", "hello", 5));
|
||||
EXPECT_FALSE(stringEq("hello world", "hellx", 5));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StringEqIf)
|
||||
{
|
||||
EXPECT_TRUE(stringEqIf(nullptr, nullptr));
|
||||
EXPECT_FALSE(stringEqIf(nullptr, "hello"));
|
||||
EXPECT_FALSE(stringEqIf("hello", nullptr));
|
||||
EXPECT_TRUE(stringEqIf("hello", "hello"));
|
||||
EXPECT_FALSE(stringEqIf("hello", "world"));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StringBeginEq)
|
||||
{
|
||||
EXPECT_TRUE(stringBeginEq("hello world", "hello"));
|
||||
|
|
@ -1267,50 +1217,6 @@ TEST(StringUtilTest, StringEqual)
|
|||
EXPECT_FALSE(stringEqual("hello", "world"));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StringEqualIf)
|
||||
{
|
||||
EXPECT_TRUE(stringEqualIf(nullptr, nullptr));
|
||||
EXPECT_FALSE(stringEqualIf(nullptr, "hello"));
|
||||
EXPECT_FALSE(stringEqualIf("hello", nullptr));
|
||||
EXPECT_TRUE(stringEqualIf("HELLO", "hello"));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StringLess)
|
||||
{
|
||||
EXPECT_TRUE(stringLess("abc", "def"));
|
||||
EXPECT_FALSE(stringLess("def", "abc"));
|
||||
EXPECT_FALSE(stringLess("abc", "abc"));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StringLessIf)
|
||||
{
|
||||
EXPECT_TRUE(stringLessIf(nullptr, "abc"));
|
||||
EXPECT_FALSE(stringLessIf("abc", nullptr));
|
||||
EXPECT_FALSE(stringLessIf(nullptr, nullptr));
|
||||
EXPECT_TRUE(stringLessIf("abc", "def"));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, CharPtrLessComparator)
|
||||
{
|
||||
CharPtrLess cmp;
|
||||
EXPECT_TRUE(cmp("abc", "def"));
|
||||
EXPECT_FALSE(cmp("def", "abc"));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, CharPtrCaseLessComparator)
|
||||
{
|
||||
CharPtrCaseLess cmp;
|
||||
EXPECT_TRUE(cmp("abc", "DEF"));
|
||||
EXPECT_FALSE(cmp("DEF", "ABC"));
|
||||
}
|
||||
|
||||
TEST(StringUtilTest, StringLessIfComparator)
|
||||
{
|
||||
StringLessIf cmp;
|
||||
EXPECT_TRUE(cmp(nullptr, "abc"));
|
||||
EXPECT_FALSE(cmp("abc", nullptr));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug tests
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1643,8 +1549,8 @@ TEST(TransitionCovTest, RiseFallBothToString)
|
|||
{
|
||||
EXPECT_EQ(RiseFallBoth::rise()->to_string(), "rise");
|
||||
EXPECT_EQ(RiseFallBoth::fall()->to_string(), "fall");
|
||||
EXPECT_STREQ(RiseFallBoth::rise()->shortName(), "^");
|
||||
EXPECT_STREQ(RiseFallBoth::fall()->shortName(), "v");
|
||||
EXPECT_EQ(RiseFallBoth::rise()->shortName(), "^");
|
||||
EXPECT_EQ(RiseFallBoth::fall()->shortName(), "v");
|
||||
}
|
||||
|
||||
// RiseFallBoth::index
|
||||
|
|
@ -1734,19 +1640,19 @@ TEST(TransitionCovTest, TransitionAsRiseFallExtra)
|
|||
// Transition asInitFinalString for various transitions
|
||||
TEST(TransitionCovTest, TransitionAsInitFinalString)
|
||||
{
|
||||
EXPECT_STREQ(Transition::rise()->asInitFinalString(), "01");
|
||||
EXPECT_STREQ(Transition::fall()->asInitFinalString(), "10");
|
||||
EXPECT_STREQ(Transition::tr0Z()->asInitFinalString(), "0Z");
|
||||
EXPECT_STREQ(Transition::trZ1()->asInitFinalString(), "Z1");
|
||||
EXPECT_STREQ(Transition::tr1Z()->asInitFinalString(), "1Z");
|
||||
EXPECT_STREQ(Transition::trZ0()->asInitFinalString(), "Z0");
|
||||
EXPECT_STREQ(Transition::tr0X()->asInitFinalString(), "0X");
|
||||
EXPECT_STREQ(Transition::trX1()->asInitFinalString(), "X1");
|
||||
EXPECT_STREQ(Transition::tr1X()->asInitFinalString(), "1X");
|
||||
EXPECT_STREQ(Transition::trX0()->asInitFinalString(), "X0");
|
||||
EXPECT_STREQ(Transition::trXZ()->asInitFinalString(), "XZ");
|
||||
EXPECT_STREQ(Transition::trZX()->asInitFinalString(), "ZX");
|
||||
EXPECT_STREQ(Transition::riseFall()->asInitFinalString(), "**");
|
||||
EXPECT_EQ(Transition::rise()->asInitFinalString(), "01");
|
||||
EXPECT_EQ(Transition::fall()->asInitFinalString(), "10");
|
||||
EXPECT_EQ(Transition::tr0Z()->asInitFinalString(), "0Z");
|
||||
EXPECT_EQ(Transition::trZ1()->asInitFinalString(), "Z1");
|
||||
EXPECT_EQ(Transition::tr1Z()->asInitFinalString(), "1Z");
|
||||
EXPECT_EQ(Transition::trZ0()->asInitFinalString(), "Z0");
|
||||
EXPECT_EQ(Transition::tr0X()->asInitFinalString(), "0X");
|
||||
EXPECT_EQ(Transition::trX1()->asInitFinalString(), "X1");
|
||||
EXPECT_EQ(Transition::tr1X()->asInitFinalString(), "1X");
|
||||
EXPECT_EQ(Transition::trX0()->asInitFinalString(), "X0");
|
||||
EXPECT_EQ(Transition::trXZ()->asInitFinalString(), "XZ");
|
||||
EXPECT_EQ(Transition::trZX()->asInitFinalString(), "ZX");
|
||||
EXPECT_EQ(Transition::riseFall()->asInitFinalString(), "**");
|
||||
}
|
||||
|
||||
// Transition::sdfTripleIndex
|
||||
|
|
@ -1791,27 +1697,6 @@ TEST(StringUtilCovTest, StaFormatArgs)
|
|||
EXPECT_EQ(s, "args test 42 hello");
|
||||
}
|
||||
|
||||
// stringDeleteCheck (only for non-tmp strings - should not crash)
|
||||
TEST(StringUtilCovTest, StringDeleteCheckNonTmp)
|
||||
{
|
||||
ASSERT_NO_THROW(( [&](){
|
||||
char *s = stringCopy("not tmp");
|
||||
// This should not crash or exit; it's not a tmp string
|
||||
stringDeleteCheck(s);
|
||||
stringDelete(s);
|
||||
|
||||
}() ));
|
||||
}
|
||||
|
||||
// Test that isTmpString returns false for heap-allocated strings
|
||||
TEST(StringUtilCovTest, IsTmpStringHeap)
|
||||
{
|
||||
char *s = new char[10];
|
||||
strcpy(s, "heap");
|
||||
EXPECT_FALSE(isTmpString(s));
|
||||
delete [] s;
|
||||
}
|
||||
|
||||
// Long sta::format string
|
||||
TEST(StringUtilCovTest, LongStaFormat)
|
||||
{
|
||||
|
|
@ -2298,31 +2183,6 @@ TEST(ReportStdCovTest, PrintErrorConsole)
|
|||
}() ));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// StringUtil: makeTmpString(std::string&) and stringDeleteCheck
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(StringUtilCovTest, MakeTmpStringStdString)
|
||||
{
|
||||
std::string s = "test_tmp_string";
|
||||
char *tmp = makeTmpString(s);
|
||||
EXPECT_STREQ(tmp, "test_tmp_string");
|
||||
EXPECT_TRUE(isTmpString(tmp));
|
||||
}
|
||||
|
||||
// stringDeleteCheck for tmp string calls Report::critical which exits,
|
||||
// so we cannot test that path. Test only with non-tmp strings.
|
||||
TEST(StringUtilCovTest, StringDeleteCheckRegular)
|
||||
{
|
||||
ASSERT_NO_THROW(( [&](){
|
||||
char *s = stringCopy("regular");
|
||||
// Should not crash - regular string can be deleted
|
||||
stringDeleteCheck(s);
|
||||
stringDelete(s);
|
||||
|
||||
}() ));
|
||||
}
|
||||
|
||||
// Test Report redirectStringPrint with empty string
|
||||
// Covers: Report::redirectStringPrint
|
||||
TEST(ReportCovTest, RedirectStringPrintEmpty)
|
||||
|
|
|
|||
|
|
@ -2187,8 +2187,8 @@ TEST_F(VerilogDesignTest, EnsureGraphVerify) {
|
|||
Instance *inst = child_iter->next();
|
||||
Cell *cell = network->cell(inst);
|
||||
EXPECT_NE(cell, nullptr);
|
||||
const char *cell_name = network->name(cell);
|
||||
EXPECT_NE(cell_name, nullptr);
|
||||
std::string cell_name = network->name(cell);
|
||||
EXPECT_FALSE(cell_name.empty());
|
||||
}
|
||||
delete child_iter;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue