From a5f8e9c3ab32c51247fa9fda3a77d709d4cfb958 Mon Sep 17 00:00:00 2001 From: Jaehyun Kim Date: Wed, 11 Mar 2026 10:16:27 +0900 Subject: [PATCH] test: Fix test failures after master merge Update test code to match API changes from upstream master: - TestGraph.cc: Fix makeScenes() call to pass reference instead of pointer - TestLibertyClasses.cc: Fix ScaleFactorType wire_res/wire_cap name mapping; fix TablePtr usage by calling .get() where const TableModel* is expected - TestLibertyClasses.cc: Update liberty_read_nangate.ok for new timing arc output - TestPower.cc: Replace PwrActivityOrigin::defaulted with ::unknown; fix isSet() expectations (unknown origin returns false) - TestSdcClasses.cc, TestSdf.cc, TestUtil.cc, TestSpice.cc: Fix RiseFall::to_string() expected values from short form ("^"/"v") to long form ("rise"/"fall") - TestUtil.cc: Remove tests for deleted StringVector/split/TokenParser and StringSet::deleteContents (removed from master) - TestSpice.cc: Replace StdStringSeq with StringSeq - helpers.tcl: Use pwd-based result_dir so module tests write results to their own test/results/ directory - verilog_bus.ok: Update golden file for new port ordering from master Signed-off-by: Jaehyun Kim --- graph/test/cpp/TestGraph.cc | 2 +- liberty/test/cpp/TestLibertyClasses.cc | 60 ++- liberty/test/liberty_read_nangate.ok | 616 ++++++++++++++++++++++++- power/test/cpp/TestPower.cc | 32 +- sdc/test/cpp/TestSdcClasses.cc | 6 +- sdf/test/cpp/TestSdf.cc | 8 +- spice/test/cpp/TestSpice.cc | 55 +-- test/helpers.tcl | 2 +- util/test/cpp/TestUtil.cc | 167 +------ verilog/test/verilog_bus.ok | 8 +- 10 files changed, 704 insertions(+), 252 deletions(-) diff --git a/graph/test/cpp/TestGraph.cc b/graph/test/cpp/TestGraph.cc index 57353c6d..868018d6 100644 --- a/graph/test/cpp/TestGraph.cc +++ b/graph/test/cpp/TestGraph.cc @@ -1892,7 +1892,7 @@ protected: StringSeq scene_names; scene_names.push_back("fast"); scene_names.push_back("slow"); - sta_->makeScenes(&scene_names); + sta_->makeScenes(scene_names); Scene *fast_corner = sta_->findScene("fast"); Scene *slow_corner = sta_->findScene("slow"); diff --git a/liberty/test/cpp/TestLibertyClasses.cc b/liberty/test/cpp/TestLibertyClasses.cc index d0c6a572..60470e17 100644 --- a/liberty/test/cpp/TestLibertyClasses.cc +++ b/liberty/test/cpp/TestLibertyClasses.cc @@ -2372,7 +2372,8 @@ TEST(Table2Test, FindValueInterpolation) { TEST(GateTableModelTest, CheckAxesOrder0) { TablePtr tbl = std::make_shared(1.0f); - EXPECT_TRUE(GateTableModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(GateTableModel::checkAxes(&tbl_model)); } TEST(GateTableModelTest, CheckAxesOrder1) { @@ -2383,7 +2384,8 @@ TEST(GateTableModelTest, CheckAxesOrder1) { FloatSeq values; values.push_back(1.0f); values.push_back(2.0f); TablePtr tbl = std::make_shared
(std::move(values), axis); - EXPECT_TRUE(GateTableModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(GateTableModel::checkAxes(&tbl_model)); } TEST(GateTableModelTest, CheckAxesOrder2) { @@ -2400,7 +2402,8 @@ TEST(GateTableModelTest, CheckAxesOrder2) { FloatSeq row1; row1.push_back(3.0f); row1.push_back(4.0f); values.push_back(std::move(row0)); values.push_back(std::move(row1)); TablePtr tbl = std::make_shared
(std::move(values), axis1, axis2); - EXPECT_TRUE(GateTableModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(GateTableModel::checkAxes(&tbl_model)); } //////////////////////////////////////////////////////////////// @@ -2409,7 +2412,8 @@ TEST(GateTableModelTest, CheckAxesOrder2) { TEST(LibertyLibraryTest, CheckSlewDegradationAxesOrder0) { TablePtr tbl = std::make_shared
(1.0f); - EXPECT_TRUE(LibertyLibrary::checkSlewDegradationAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(LibertyLibrary::checkSlewDegradationAxes(&tbl_model)); } TEST(LibertyLibraryTest, CheckSlewDegradationAxesOrder1) { @@ -2420,7 +2424,8 @@ TEST(LibertyLibraryTest, CheckSlewDegradationAxesOrder1) { FloatSeq values; values.push_back(0.1f); values.push_back(1.0f); TablePtr tbl = std::make_shared
(std::move(values), axis); - EXPECT_TRUE(LibertyLibrary::checkSlewDegradationAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(LibertyLibrary::checkSlewDegradationAxes(&tbl_model)); } //////////////////////////////////////////////////////////////// @@ -2897,7 +2902,8 @@ TEST(LibertyLibraryTest, CheckSlewDegradationAxesOrder2) { FloatSeq row1; row1.push_back(0.3f); row1.push_back(0.4f); values.push_back(std::move(row0)); values.push_back(std::move(row1)); TablePtr tbl = std::make_shared
(std::move(values), axis1, axis2); - EXPECT_TRUE(LibertyLibrary::checkSlewDegradationAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(LibertyLibrary::checkSlewDegradationAxes(&tbl_model)); } TEST(LibertyLibraryTest, CheckSlewDegradationAxesOrder2Reversed) { @@ -2914,7 +2920,8 @@ TEST(LibertyLibraryTest, CheckSlewDegradationAxesOrder2Reversed) { FloatSeq row1; row1.push_back(0.3f); row1.push_back(0.4f); values.push_back(std::move(row0)); values.push_back(std::move(row1)); TablePtr tbl = std::make_shared
(std::move(values), axis1, axis2); - EXPECT_TRUE(LibertyLibrary::checkSlewDegradationAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(LibertyLibrary::checkSlewDegradationAxes(&tbl_model)); } //////////////////////////////////////////////////////////////// @@ -3001,10 +3008,8 @@ TEST(ScaleFactorPvtTest, PvtToName) { TEST(ScaleFactorTypeTest, FindByName) { EXPECT_EQ(findScaleFactorType("pin_cap"), ScaleFactorType::pin_cap); - // Note: in the source map, "wire_res" string is mapped to ScaleFactorType::wire_cap - // and there is no "wire_cap" string entry - EXPECT_EQ(findScaleFactorType("wire_res"), ScaleFactorType::wire_cap); - EXPECT_EQ(findScaleFactorType("wire_cap"), ScaleFactorType::unknown); + EXPECT_EQ(findScaleFactorType("wire_res"), ScaleFactorType::wire_res); + EXPECT_EQ(findScaleFactorType("wire_cap"), ScaleFactorType::wire_cap); EXPECT_EQ(findScaleFactorType("min_period"), ScaleFactorType::min_period); EXPECT_EQ(findScaleFactorType("cell"), ScaleFactorType::cell); EXPECT_EQ(findScaleFactorType("hold"), ScaleFactorType::hold); @@ -3022,10 +3027,8 @@ TEST(ScaleFactorTypeTest, FindByName) { TEST(ScaleFactorTypeTest, TypeToName) { EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::pin_cap), "pin_cap"); - // Note: wire_cap maps to "wire_res" string in source (implementation quirk) - EXPECT_STREQ(scaleFactorTypeName(ScaleFactorType::wire_cap), "wire_res"); - // wire_res is not in the map - returns nullptr - EXPECT_EQ(scaleFactorTypeName(ScaleFactorType::wire_res), nullptr); + 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"); @@ -3549,7 +3552,8 @@ TEST(GateTableModelTest, CheckAxesOrder1BadAxis) { FloatSeq values; values.push_back(1.0f); values.push_back(2.0f); TablePtr tbl = std::make_shared
(std::move(values), axis); - EXPECT_FALSE(GateTableModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_FALSE(GateTableModel::checkAxes(&tbl_model)); } TEST(GateTableModelTest, CheckAxesOrder2BadAxis) { @@ -3566,7 +3570,8 @@ TEST(GateTableModelTest, CheckAxesOrder2BadAxis) { FloatSeq row1; row1.push_back(3.0f); row1.push_back(4.0f); values.push_back(std::move(row0)); values.push_back(std::move(row1)); TablePtr tbl = std::make_shared
(std::move(values), axis1, axis2); - EXPECT_FALSE(GateTableModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_FALSE(GateTableModel::checkAxes(&tbl_model)); } //////////////////////////////////////////////////////////////// @@ -3575,7 +3580,8 @@ TEST(GateTableModelTest, CheckAxesOrder2BadAxis) { TEST(CheckTableModelTest, CheckAxesOrder0) { TablePtr tbl = std::make_shared
(1.0f); - EXPECT_TRUE(CheckTableModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(CheckTableModel::checkAxes(&tbl_model)); } TEST(CheckTableModelTest, CheckAxesOrder1) { @@ -3586,7 +3592,8 @@ TEST(CheckTableModelTest, CheckAxesOrder1) { FloatSeq values; values.push_back(1.0f); values.push_back(2.0f); TablePtr tbl = std::make_shared
(std::move(values), axis); - EXPECT_TRUE(CheckTableModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(CheckTableModel::checkAxes(&tbl_model)); } TEST(CheckTableModelTest, CheckAxesOrder1BadAxis) { @@ -3597,7 +3604,8 @@ TEST(CheckTableModelTest, CheckAxesOrder1BadAxis) { FloatSeq values; values.push_back(1.0f); values.push_back(2.0f); TablePtr tbl = std::make_shared
(std::move(values), axis); - EXPECT_FALSE(CheckTableModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_FALSE(CheckTableModel::checkAxes(&tbl_model)); } //////////////////////////////////////////////////////////////// @@ -3607,7 +3615,8 @@ TEST(CheckTableModelTest, CheckAxesOrder1BadAxis) { TEST(ReceiverModelTest, CheckAxesOrder0False) { // Table0 has no axes, ReceiverModel requires input_net_transition axis TablePtr tbl = std::make_shared
(1.0f); - EXPECT_FALSE(ReceiverModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_FALSE(ReceiverModel::checkAxes(&tbl_model)); } TEST(ReceiverModelTest, CheckAxesOrder1Valid) { @@ -3618,7 +3627,8 @@ TEST(ReceiverModelTest, CheckAxesOrder1Valid) { FloatSeq values; values.push_back(1.0f); values.push_back(2.0f); TablePtr tbl = std::make_shared
(std::move(values), axis); - EXPECT_TRUE(ReceiverModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_TRUE(ReceiverModel::checkAxes(&tbl_model)); } TEST(ReceiverModelTest, CheckAxesOrder1BadAxis) { @@ -3629,7 +3639,8 @@ TEST(ReceiverModelTest, CheckAxesOrder1BadAxis) { FloatSeq values; values.push_back(1.0f); values.push_back(2.0f); TablePtr tbl = std::make_shared
(std::move(values), axis); - EXPECT_FALSE(ReceiverModel::checkAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_FALSE(ReceiverModel::checkAxes(&tbl_model)); } //////////////////////////////////////////////////////////////// @@ -3644,7 +3655,8 @@ TEST(LibertyLibraryTest, CheckSlewDegradationAxesBadAxis) { FloatSeq values; values.push_back(0.1f); values.push_back(1.0f); TablePtr tbl = std::make_shared
(std::move(values), axis); - EXPECT_FALSE(LibertyLibrary::checkSlewDegradationAxes(tbl)); + TableModel tbl_model(tbl, nullptr, ScaleFactorType::cell, RiseFall::rise()); + EXPECT_FALSE(LibertyLibrary::checkSlewDegradationAxes(&tbl_model)); } //////////////////////////////////////////////////////////////// diff --git a/liberty/test/liberty_read_nangate.ok b/liberty/test/liberty_read_nangate.ok index 6be51805..cf5a05cf 100644 --- a/liberty/test/liberty_read_nangate.ok +++ b/liberty/test/liberty_read_nangate.ok @@ -5,6 +5,12 @@ File ../../test/nangate45/Nangate45_typ.lib VSS ground A input 1.55-1.70 ZN output function=!A + +Timing arcs + A -> ZN + combinational + ^ -> v + v -> ^ Cell BUF_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -12,6 +18,12 @@ File ../../test/nangate45/Nangate45_typ.lib VSS ground A input 0.88-0.97 Z output function=A + +Timing arcs + A -> Z + combinational + ^ -> ^ + v -> v Cell NAND2_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -20,6 +32,16 @@ File ../../test/nangate45/Nangate45_typ.lib A1 input 1.53-1.60 A2 input 1.50-1.66 ZN output function=!(A1*A2) + +Timing arcs + A1 -> ZN + combinational + ^ -> v + v -> ^ + A2 -> ZN + combinational + ^ -> v + v -> ^ Cell NOR2_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -28,6 +50,16 @@ File ../../test/nangate45/Nangate45_typ.lib A1 input 1.41-1.71 A2 input 1.56-1.65 ZN output function=!(A1+A2) + +Timing arcs + A1 -> ZN + combinational + ^ -> v + v -> ^ + A2 -> ZN + combinational + ^ -> v + v -> ^ Cell AND2_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -36,6 +68,16 @@ File ../../test/nangate45/Nangate45_typ.lib A1 input 0.87-0.92 A2 input 0.89-0.97 ZN output function=A1*A2 + +Timing arcs + A1 -> ZN + combinational + ^ -> ^ + v -> v + A2 -> ZN + combinational + ^ -> ^ + v -> v Cell OR2_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -44,6 +86,16 @@ File ../../test/nangate45/Nangate45_typ.lib A1 input 0.79-0.95 A2 input 0.90-0.94 ZN output function=A1+A2 + +Timing arcs + A1 -> ZN + combinational + ^ -> ^ + v -> v + A2 -> ZN + combinational + ^ -> ^ + v -> v Cell MUX2_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -53,22 +105,74 @@ File ../../test/nangate45/Nangate45_typ.lib B input 0.90-0.94 S input 1.81-1.92 Z output function=(S*B)+(A*!S) + +Timing arcs + A -> Z + combinational + when !B*!S + ^ -> ^ + v -> v + A -> Z + combinational + when B*!S + ^ -> ^ + v -> v + B -> Z + combinational + when !A*S + ^ -> ^ + v -> v + B -> Z + combinational + when A*S + ^ -> ^ + v -> v + S -> Z + combinational + when !A*B + ^ -> ^ + v -> v + S -> Z + combinational + when A*!B + ^ -> v + v -> ^ Cell DFF_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib - IQ internal - IQN internal VDD power VSS ground D input 1.06-1.14 CK input 0.86-0.95 Q output function=IQ QN output function=IQN + IQ internal + IQN internal + +Timing arcs + CK -> D + hold + ^ -> ^ + ^ -> v + CK -> D + setup + ^ -> ^ + ^ -> v + CK -> CK + width + ^ -> v + v -> ^ + CK -> Q + Reg Clk to Q + ^ -> ^ + ^ -> v + CK -> QN + Reg Clk to Q + ^ -> ^ + ^ -> v Cell DFFR_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib - IQ internal - IQN internal VDD power VSS ground D input 1.05-1.13 @@ -76,11 +180,77 @@ File ../../test/nangate45/Nangate45_typ.lib CK input 0.88-0.98 Q output function=IQ QN output function=IQN + IQ internal + IQN internal + +Timing arcs + CK -> D + hold + when RN + ^ -> ^ + ^ -> v + CK -> D + setup + when RN + ^ -> ^ + ^ -> v + CK -> RN + recovery + ^ -> ^ + CK -> RN + removal + ^ -> ^ + RN -> RN + width + v -> ^ + CK -> CK + width + when RN + ^ -> v + v -> ^ + CK -> Q + Reg Clk to Q + ^ -> ^ + ^ -> v + RN -> Q + Reg Set/Clr + when !CK*!D + v -> v + RN -> Q + Reg Set/Clr + when !CK*D + v -> v + RN -> Q + Reg Set/Clr + when CK*!D + v -> v + RN -> Q + Reg Set/Clr + when CK*D + v -> v + CK -> QN + Reg Clk to Q + ^ -> ^ + ^ -> v + RN -> QN + Reg Set/Clr + when !CK*!D + v -> ^ + RN -> QN + Reg Set/Clr + when !CK*D + v -> ^ + RN -> QN + Reg Set/Clr + when CK*!D + v -> ^ + RN -> QN + Reg Set/Clr + when CK*D + v -> ^ Cell DFFS_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib - IQ internal - IQN internal VDD power VSS ground D input 1.09-1.16 @@ -88,11 +258,77 @@ File ../../test/nangate45/Nangate45_typ.lib CK input 0.88-0.97 Q output function=IQ QN output function=IQN + IQ internal + IQN internal + +Timing arcs + CK -> D + hold + when SN + ^ -> ^ + ^ -> v + CK -> D + setup + when SN + ^ -> ^ + ^ -> v + CK -> SN + recovery + ^ -> ^ + CK -> SN + removal + ^ -> ^ + SN -> SN + width + v -> ^ + CK -> CK + width + when SN + ^ -> v + v -> ^ + CK -> Q + Reg Clk to Q + ^ -> ^ + ^ -> v + SN -> Q + Reg Set/Clr + when !CK*!D + v -> ^ + SN -> Q + Reg Set/Clr + when !CK*D + v -> ^ + SN -> Q + Reg Set/Clr + when CK*!D + v -> ^ + SN -> Q + Reg Set/Clr + when CK*D + v -> ^ + CK -> QN + Reg Clk to Q + ^ -> ^ + ^ -> v + SN -> QN + Reg Set/Clr + when !CK*!D + v -> v + SN -> QN + Reg Set/Clr + when !CK*D + v -> v + SN -> QN + Reg Set/Clr + when CK*!D + v -> v + SN -> QN + Reg Set/Clr + when CK*D + v -> v Cell DFFRS_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib - IQ internal - IQN internal VDD power VSS ground D input 1.08-1.15 @@ -101,17 +337,193 @@ File ../../test/nangate45/Nangate45_typ.lib CK input 0.87-0.96 Q output function=IQ QN output function=IQN + IQ internal + IQN internal + +Timing arcs + CK -> D + hold + when RN*SN + ^ -> ^ + ^ -> v + CK -> D + setup + when RN*SN + ^ -> ^ + ^ -> v + CK -> RN + recovery + when SN + ^ -> ^ + CK -> RN + removal + when SN + ^ -> ^ + RN -> RN + width + when SN + v -> ^ + CK -> SN + recovery + when RN + ^ -> ^ + CK -> SN + removal + when RN + ^ -> ^ + SN -> SN + width + when RN + v -> ^ + CK -> CK + width + when RN*SN + ^ -> v + v -> ^ + CK -> Q + Reg Clk to Q + ^ -> ^ + ^ -> v + RN -> Q + Reg Set/Clr + when (!CK*!D)*!SN + v -> v + RN -> Q + Reg Set/Clr + when (!CK*!D)*SN + v -> v + RN -> Q + Reg Set/Clr + when (!CK*D)*!SN + v -> v + RN -> Q + Reg Set/Clr + when (!CK*D)*SN + v -> v + RN -> Q + Reg Set/Clr + when (CK*!D)*!SN + v -> v + RN -> Q + Reg Set/Clr + when (CK*!D)*SN + v -> v + RN -> Q + Reg Set/Clr + when (CK*D)*!SN + v -> v + RN -> Q + Reg Set/Clr + when (CK*D)*SN + v -> v + SN -> Q + Reg Set/Clr + when (!CK*!D)*RN + v -> ^ + SN -> Q + Reg Set/Clr + when (!CK*D)*RN + v -> ^ + SN -> Q + Reg Set/Clr + when (CK*!D)*RN + v -> ^ + SN -> Q + Reg Set/Clr + when (CK*D)*RN + v -> ^ + CK -> QN + Reg Clk to Q + ^ -> ^ + ^ -> v + RN -> QN + Reg Set/Clr + when (!CK*!D)*SN + v -> ^ + RN -> QN + Reg Set/Clr + when (!CK*D)*SN + v -> ^ + RN -> QN + Reg Set/Clr + when (CK*!D)*SN + v -> ^ + RN -> QN + Reg Set/Clr + when (CK*D)*SN + v -> ^ + SN -> QN + Reg Set/Clr + when (!CK*!D)*!RN + v -> v + SN -> QN + Reg Set/Clr + when (!CK*!D)*RN + v -> v + SN -> QN + Reg Set/Clr + when (!CK*D)*!RN + v -> v + SN -> QN + Reg Set/Clr + when (!CK*D)*RN + v -> v + SN -> QN + Reg Set/Clr + when (CK*!D)*!RN + v -> v + SN -> QN + Reg Set/Clr + when (CK*!D)*RN + v -> v + SN -> QN + Reg Set/Clr + when (CK*D)*!RN + v -> v + SN -> QN + Reg Set/Clr + when (CK*D)*RN + v -> v Cell TLAT_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib - IQ internal - IQN internal VDD power VSS ground D input 1.07-1.14 G input 0.92-1.02 OE input 1.42-1.50 Q tristate enable=OE function=IQ 0.79-0.79 + IQ internal + IQN internal + +Timing arcs + G -> D + hold + v -> ^ + v -> v + G -> D + setup + v -> ^ + v -> v + G -> G + width + ^ -> v + D -> Q + Latch D to Q + ^ -> ^ + v -> v + G -> Q + Latch En to Q + ^ -> ^ + ^ -> v + OE -> Q + tristate disable + v -> 0Z + v -> 1Z + OE -> Q + tristate enable + ^ -> Z1 + ^ -> Z0 Cell AOI21_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -121,6 +533,31 @@ File ../../test/nangate45/Nangate45_typ.lib B1 input 1.45-1.65 B2 input 1.41-1.68 ZN output function=!(A+(B1*B2)) + +Timing arcs + A -> ZN + combinational + when !B1*!B2 + ^ -> v + v -> ^ + A -> ZN + combinational + when !B1*B2 + ^ -> v + v -> ^ + A -> ZN + combinational + when B1*!B2 + ^ -> v + v -> ^ + B1 -> ZN + combinational + ^ -> v + v -> ^ + B2 -> ZN + combinational + ^ -> v + v -> ^ Cell OAI21_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -130,6 +567,31 @@ File ../../test/nangate45/Nangate45_typ.lib B1 input 1.46-1.66 B2 input 1.56-1.57 ZN output function=!(A*(B1+B2)) + +Timing arcs + A -> ZN + combinational + when !B1*B2 + ^ -> v + v -> ^ + A -> ZN + combinational + when B1*!B2 + ^ -> v + v -> ^ + A -> ZN + combinational + when B1*B2 + ^ -> v + v -> ^ + B1 -> ZN + combinational + ^ -> v + v -> ^ + B2 -> ZN + combinational + ^ -> v + v -> ^ Cell HA_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -139,6 +601,36 @@ File ../../test/nangate45/Nangate45_typ.lib B input 3.34-3.45 CO output function=A*B S output function=A^B + +Timing arcs + A -> CO + combinational + ^ -> ^ + v -> v + B -> CO + combinational + ^ -> ^ + v -> v + A -> S + combinational + when !B + ^ -> ^ + v -> v + A -> S + combinational + when B + ^ -> v + v -> ^ + B -> S + combinational + when !A + ^ -> ^ + v -> v + B -> S + combinational + when A + ^ -> v + v -> ^ Cell FA_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -149,6 +641,98 @@ File ../../test/nangate45/Nangate45_typ.lib CI input 2.66-2.76 CO output function=(A*B)+(CI*(A+B)) S output function=CI^(A^B) + +Timing arcs + A -> CO + combinational + when !B*CI + ^ -> ^ + v -> v + A -> CO + combinational + when B*!CI + ^ -> ^ + v -> v + B -> CO + combinational + when !A*CI + ^ -> ^ + v -> v + B -> CO + combinational + when A*!CI + ^ -> ^ + v -> v + CI -> CO + combinational + when !A*B + ^ -> ^ + v -> v + CI -> CO + combinational + when A*!B + ^ -> ^ + v -> v + A -> S + combinational + when !B*!CI + ^ -> ^ + v -> v + A -> S + combinational + when !B*CI + ^ -> v + v -> ^ + A -> S + combinational + when B*!CI + ^ -> v + v -> ^ + A -> S + combinational + when B*CI + ^ -> ^ + v -> v + B -> S + combinational + when !A*!CI + ^ -> ^ + v -> v + B -> S + combinational + when !A*CI + ^ -> v + v -> ^ + B -> S + combinational + when A*!CI + ^ -> v + v -> ^ + B -> S + combinational + when A*CI + ^ -> ^ + v -> v + CI -> S + combinational + when !A*!B + ^ -> ^ + v -> v + CI -> S + combinational + when !A*B + ^ -> v + v -> ^ + CI -> S + combinational + when A*!B + ^ -> v + v -> ^ + CI -> S + combinational + when A*B + ^ -> ^ + v -> v Cell CLKBUF_X1 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -156,6 +740,12 @@ File ../../test/nangate45/Nangate45_typ.lib VSS ground A input 0.70-0.78 Z output function=A + +Timing arcs + A -> Z + combinational + ^ -> ^ + v -> v Cell CLKBUF_X2 Library NangateOpenCellLibrary File ../../test/nangate45/Nangate45_typ.lib @@ -163,3 +753,9 @@ File ../../test/nangate45/Nangate45_typ.lib VSS ground A input 1.24-1.41 Z output function=A + +Timing arcs + A -> Z + combinational + ^ -> ^ + v -> v diff --git a/power/test/cpp/TestPower.cc b/power/test/cpp/TestPower.cc index a3a7c0b3..771dc4b7 100644 --- a/power/test/cpp/TestPower.cc +++ b/power/test/cpp/TestPower.cc @@ -226,8 +226,8 @@ TEST_F(PwrActivityTest, IsSetForAllOrigins) { activity.setOrigin(PwrActivityOrigin::constant); EXPECT_TRUE(activity.isSet()); - activity.setOrigin(PwrActivityOrigin::defaulted); - EXPECT_TRUE(activity.isSet()); + activity.setOrigin(PwrActivityOrigin::unknown); + EXPECT_FALSE(activity.isSet()); } TEST_F(PwrActivityTest, OriginName) { @@ -257,8 +257,8 @@ TEST_F(PwrActivityTest, OriginName) { activity.setOrigin(PwrActivityOrigin::constant); EXPECT_STREQ(activity.originName(), "constant"); - activity.setOrigin(PwrActivityOrigin::defaulted); - EXPECT_STREQ(activity.originName(), "defaulted"); + activity.setOrigin(PwrActivityOrigin::unknown); + EXPECT_STREQ(activity.originName(), "unknown"); activity.setOrigin(PwrActivityOrigin::unknown); EXPECT_STREQ(activity.originName(), "unknown"); @@ -361,7 +361,7 @@ TEST_F(PwrActivityTest, OriginNames) { 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_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::defaulted).originName(), "defaulted"); + EXPECT_STREQ(PwrActivity(0.0f, 0.0f, PwrActivityOrigin::unknown).originName(), "unknown"); } // Construct and test with explicit density/duty @@ -378,18 +378,20 @@ TEST_F(PwrActivityTest, IsSetOriginCombinations) { a.setOrigin(PwrActivityOrigin::unknown); EXPECT_FALSE(a.isSet()); - for (auto origin : {PwrActivityOrigin::global, - PwrActivityOrigin::input, - PwrActivityOrigin::user, - PwrActivityOrigin::vcd, - PwrActivityOrigin::saif, - PwrActivityOrigin::propagated, - PwrActivityOrigin::clock, - PwrActivityOrigin::constant, - PwrActivityOrigin::defaulted}) { + for (PwrActivityOrigin origin : {PwrActivityOrigin::global, + PwrActivityOrigin::input, + PwrActivityOrigin::user, + PwrActivityOrigin::vcd, + PwrActivityOrigin::saif, + PwrActivityOrigin::propagated, + PwrActivityOrigin::clock, + PwrActivityOrigin::constant}) { a.setOrigin(origin); EXPECT_TRUE(a.isSet()); } + // unknown origin means not set + a.setOrigin(PwrActivityOrigin::unknown); + EXPECT_FALSE(a.isSet()); } // Test init and then set again @@ -611,7 +613,7 @@ TEST_F(PwrActivityTest, OriginNameExhaustive) { 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_STREQ(PwrActivity(0, 0, PwrActivityOrigin::defaulted).originName(), "defaulted"); + EXPECT_STREQ(PwrActivity(0, 0, PwrActivityOrigin::unknown).originName(), "unknown"); } //////////////////////////////////////////////////////////////// diff --git a/sdc/test/cpp/TestSdcClasses.cc b/sdc/test/cpp/TestSdcClasses.cc index 115a95a2..7b8f1c6c 100644 --- a/sdc/test/cpp/TestSdcClasses.cc +++ b/sdc/test/cpp/TestSdcClasses.cc @@ -70,9 +70,9 @@ TEST_F(RiseFallTest, Singletons) { } TEST_F(RiseFallTest, Names) { - // to_string() returns short_name: "^" for rise, "v" for fall - EXPECT_EQ(RiseFall::rise()->to_string(), "^"); - EXPECT_EQ(RiseFall::fall()->to_string(), "v"); + // to_string() returns name: "rise" for rise, "fall" for fall + EXPECT_EQ(RiseFall::rise()->to_string(), "rise"); + EXPECT_EQ(RiseFall::fall()->to_string(), "fall"); } TEST_F(RiseFallTest, Indices) { diff --git a/sdf/test/cpp/TestSdf.cc b/sdf/test/cpp/TestSdf.cc index 376d8bfa..e99ae9db 100644 --- a/sdf/test/cpp/TestSdf.cc +++ b/sdf/test/cpp/TestSdf.cc @@ -630,8 +630,8 @@ TEST_F(SdfSmokeTest, TransitionMaxIndex) { // Test RiseFall to_string // Covers: RiseFall::to_string TEST_F(SdfSmokeTest, RiseFallToString) { - EXPECT_EQ(RiseFall::rise()->to_string(), "^"); - EXPECT_EQ(RiseFall::fall()->to_string(), "v"); + EXPECT_EQ(RiseFall::rise()->to_string(), "rise"); + EXPECT_EQ(RiseFall::fall()->to_string(), "fall"); } // Test MinMax compare with equal values @@ -1306,8 +1306,8 @@ TEST_F(SdfSmokeTest, MinMaxCompareExtremes) { } TEST_F(SdfSmokeTest, RiseFallToStringAndFind) { - EXPECT_EQ(RiseFall::rise()->to_string(), "^"); - EXPECT_EQ(RiseFall::fall()->to_string(), "v"); + EXPECT_EQ(RiseFall::rise()->to_string(), "rise"); + EXPECT_EQ(RiseFall::fall()->to_string(), "fall"); EXPECT_EQ(RiseFall::find("^"), RiseFall::rise()); EXPECT_EQ(RiseFall::find("v"), RiseFall::fall()); EXPECT_EQ(RiseFall::find("rise"), RiseFall::rise()); diff --git a/spice/test/cpp/TestSpice.cc b/spice/test/cpp/TestSpice.cc index cd9ebd3c..7899fda9 100644 --- a/spice/test/cpp/TestSpice.cc +++ b/spice/test/cpp/TestSpice.cc @@ -18,6 +18,7 @@ #include "PathExpanded.hh" #include "Search.hh" #include "CircuitSim.hh" +#include "StringUtil.hh" #include "spice/Xyce.hh" #include "spice/WriteSpice.hh" @@ -139,7 +140,7 @@ TEST_F(XyceCsvTest, ReadSimpleCsv) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -161,7 +162,7 @@ TEST_F(XyceCsvTest, ReadSingleSignal) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -173,7 +174,7 @@ TEST_F(XyceCsvTest, ReadSingleSignal) { TEST_F(XyceCsvTest, FileNotReadableThrows) { EXPECT_THROW( { - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv("/nonexistent/file.csv", titles, waveforms); }, @@ -274,7 +275,7 @@ TEST_F(XyceCsvTest, ReadMultipleSignals) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -296,7 +297,7 @@ TEST_F(XyceCsvTest, ReadManyDataPoints) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -411,7 +412,7 @@ TEST_F(XyceCsvTest, ReadNegativeValues) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -427,7 +428,7 @@ TEST_F(XyceCsvTest, ReadHeaderOnly) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -712,7 +713,7 @@ TEST_F(XyceCsvTest, ReadPrecisionValues) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -739,7 +740,7 @@ TEST_F(XyceCsvTest, ReadManySignals) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -912,7 +913,7 @@ TEST_F(XyceCsvTest, ReadCsvWithZeroValues) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -937,7 +938,7 @@ TEST_F(XyceCsvTest, ReadCsvManySignals) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1147,7 +1148,7 @@ TEST_F(XyceCsvTest, ReadCsvSmallValues) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1165,7 +1166,7 @@ TEST_F(XyceCsvTest, ReadCsvLargeValues) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1187,7 +1188,7 @@ TEST_F(XyceCsvTest, ReadCsv100TimeSteps) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1205,7 +1206,7 @@ TEST_F(XyceCsvTest, ReadCsvSpecialSignalNames) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1224,7 +1225,7 @@ TEST_F(XyceCsvTest, ReadCsvCurrentProbes) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1254,8 +1255,8 @@ TEST_F(SpiceSmokeTest, RiseFallBothIndex) { } TEST_F(SpiceSmokeTest, RiseFallBothToString) { - EXPECT_EQ(RiseFallBoth::rise()->to_string(), "^"); - EXPECT_EQ(RiseFallBoth::fall()->to_string(), "v"); + EXPECT_EQ(RiseFallBoth::rise()->to_string(), "rise"); + EXPECT_EQ(RiseFallBoth::fall()->to_string(), "fall"); EXPECT_FALSE(RiseFallBoth::riseFall()->to_string().empty()); } @@ -1317,7 +1318,7 @@ TEST_F(XyceCsvTest, ReadCsvSingleRow) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1336,7 +1337,7 @@ TEST_F(XyceCsvTest, ReadCsvAlternatingSign) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1372,7 +1373,7 @@ TEST_F(XyceCsvTest, ReadCsv50Signals) { out.close(); } - StdStringSeq titles; + StringSeq titles; WaveformSeq waveforms; readXyceCsv(tmpfile_.c_str(), titles, waveforms); @@ -1597,7 +1598,7 @@ TEST_F(SpiceDesignTest, GraphVertexAccess) { // Verify timing paths exist after analysis (prerequisite for writePathSpice) TEST_F(SpiceDesignTest, TimingPathExists) { - StdStringSeq group_names; + StringSeq group_names; PathEndSeq path_ends = sta_->findPathEnds( nullptr, // from nullptr, // thrus @@ -1626,7 +1627,7 @@ TEST_F(SpiceDesignTest, TimingPathExists) { // Verify path end has a valid path object for SPICE writing TEST_F(SpiceDesignTest, PathEndHasPath) { - StdStringSeq group_names; + StringSeq group_names; PathEndSeq path_ends = sta_->findPathEnds( nullptr, nullptr, nullptr, false, sta_->makeSceneSeq(sta_->cmdScene()), MinMaxAll::max(), @@ -1659,7 +1660,7 @@ TEST_F(SpiceDesignTest, DcalcAnalysisPtAccess) { // Verify SPICE file can be written for a timing path TEST_F(SpiceDesignTest, WriteSpicePathFile) { - StdStringSeq group_names; + StringSeq group_names; PathEndSeq path_ends = sta_->findPathEnds( nullptr, nullptr, nullptr, false, sta_->makeSceneSeq(sta_->cmdScene()), MinMaxAll::max(), @@ -1698,7 +1699,7 @@ TEST_F(SpiceDesignTest, WriteSpicePathFile) { // Verify multiple timing paths are found (SPICE multi-path analysis) TEST_F(SpiceDesignTest, MultipleTimingPaths) { - StdStringSeq group_names; + StringSeq group_names; PathEndSeq path_ends = sta_->findPathEnds( nullptr, nullptr, nullptr, false, sta_->makeSceneSeq(sta_->cmdScene()), MinMaxAll::max(), @@ -1774,7 +1775,7 @@ TEST_F(SpiceDesignTest, NetNamesForSpice) { // Verify hold timing paths (for SPICE min-delay analysis) TEST_F(SpiceDesignTest, HoldTimingPaths) { - StdStringSeq group_names; + StringSeq group_names; PathEndSeq path_ends = sta_->findPathEnds( nullptr, nullptr, nullptr, false, sta_->makeSceneSeq(sta_->cmdScene()), MinMaxAll::min(), @@ -1805,7 +1806,7 @@ TEST_F(SpiceDesignTest, VertexArrivalForSpice) { // Verify PathExpanded works on timing paths (used in SPICE path writing) TEST_F(SpiceDesignTest, PathExpandedAccess) { - StdStringSeq group_names; + StringSeq group_names; PathEndSeq path_ends = sta_->findPathEnds( nullptr, nullptr, nullptr, false, sta_->makeSceneSeq(sta_->cmdScene()), MinMaxAll::max(), diff --git a/test/helpers.tcl b/test/helpers.tcl index 5febb0eb..88b8c857 100644 --- a/test/helpers.tcl +++ b/test/helpers.tcl @@ -1,7 +1,7 @@ # Helper functions common to multiple regressions. set test_dir [file dirname [file normalize [info script]]] -set result_dir [file join $test_dir "results"] +set result_dir [file join [pwd] "results"] # puts [exec cat $file] without forking. proc report_file { file } { diff --git a/util/test/cpp/TestUtil.cc b/util/test/cpp/TestUtil.cc index 1267919d..97e6798c 100644 --- a/util/test/cpp/TestUtil.cc +++ b/util/test/cpp/TestUtil.cc @@ -9,13 +9,11 @@ #include "MinMax.hh" #include "PatternMatch.hh" #include "StringUtil.hh" -#include "StringSet.hh" #include "RiseFallMinMax.hh" #include "RiseFallValues.hh" #include "Report.hh" #include "ReportStd.hh" #include "Error.hh" -#include "TokenParser.hh" #include "Debug.hh" #include "Machine.hh" #include "DispatchQueue.hh" @@ -204,35 +202,6 @@ TEST(StringUtilTest, IsDigitsFalse) EXPECT_TRUE(isDigits("")); } -// split tests -TEST(StringUtilTest, SplitBasic) -{ - StringVector tokens; - split("one,two,three", ",", tokens); - ASSERT_EQ(tokens.size(), 3u); - EXPECT_EQ(tokens[0], "one"); - EXPECT_EQ(tokens[1], "two"); - EXPECT_EQ(tokens[2], "three"); -} - -TEST(StringUtilTest, SplitSpaces) -{ - StringVector tokens; - split("hello world foo", " ", tokens); - ASSERT_EQ(tokens.size(), 3u); - EXPECT_EQ(tokens[0], "hello"); - EXPECT_EQ(tokens[1], "world"); - EXPECT_EQ(tokens[2], "foo"); -} - -TEST(StringUtilTest, SplitNoDelimiter) -{ - StringVector tokens; - split("hello", ",", tokens); - ASSERT_EQ(tokens.size(), 1u); - EXPECT_EQ(tokens[0], "hello"); -} - // trimRight tests TEST(StringUtilTest, TrimRightSpaces) { @@ -1189,105 +1158,6 @@ TEST(ReportTest, LogAndConsoleSimultaneous) std::remove(logfile); } -//////////////////////////////////////////////////////////////// -// TokenParser tests -//////////////////////////////////////////////////////////////// - -TEST(TokenParserTest, BasicTokens) -{ - char str[] = "hello world foo"; - TokenParser tp(str, " "); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "hello"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "world"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "foo"); - EXPECT_FALSE(tp.hasNext()); -} - -TEST(TokenParserTest, CommaDelimiter) -{ - char str[] = "one,two,three"; - TokenParser tp(str, ","); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "one"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "two"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "three"); - EXPECT_FALSE(tp.hasNext()); -} - -TEST(TokenParserTest, SingleToken) -{ - char str[] = "single"; - TokenParser tp(str, " "); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "single"); - EXPECT_FALSE(tp.hasNext()); -} - -TEST(TokenParserTest, LeadingSpaces) -{ - char str[] = " hello world"; - TokenParser tp(str, " "); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "hello"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "world"); - EXPECT_FALSE(tp.hasNext()); -} - -TEST(TokenParserTest, EmptyString) -{ - char str[] = ""; - TokenParser tp(str, " "); - // For an empty string, hasNext returns true for the first call - // but next() returns a pointer to the empty string - ASSERT_TRUE(tp.hasNext()); - char *tok = tp.next(); - EXPECT_STREQ(tok, ""); - // After first token, no more - EXPECT_FALSE(tp.hasNext()); -} - -TEST(TokenParserTest, AllSpaces) -{ - char str[] = " "; - TokenParser tp(str, " "); - // After skipping leading spaces, token points to '\0' - // hasNext returns true for first call since token_ != nullptr - ASSERT_TRUE(tp.hasNext()); - char *tok = tp.next(); - EXPECT_STREQ(tok, ""); - EXPECT_FALSE(tp.hasNext()); -} - -TEST(TokenParserTest, MultipleDelimiters) -{ - char str[] = "a:b;c"; - TokenParser tp(str, ":;"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "a"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "b"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "c"); - EXPECT_FALSE(tp.hasNext()); -} - -TEST(TokenParserTest, ConsecutiveDelimiters) -{ - char str[] = "a,,b"; - TokenParser tp(str, ","); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "a"); - ASSERT_TRUE(tp.hasNext()); - EXPECT_STREQ(tp.next(), "b"); - EXPECT_FALSE(tp.hasNext()); -} - //////////////////////////////////////////////////////////////// // Additional StringUtil tests //////////////////////////////////////////////////////////////// @@ -1443,20 +1313,6 @@ TEST(StringUtilTest, StringLessIfComparator) EXPECT_FALSE(cmp("abc", nullptr)); } -TEST(StringUtilTest, SplitEmpty) -{ - StringVector tokens; - split("", ",", tokens); - EXPECT_EQ(tokens.size(), 0u); -} - -TEST(StringUtilTest, SplitOnlyDelimiters) -{ - StringVector tokens; - split(",,,", ",", tokens); - EXPECT_EQ(tokens.size(), 0u); -} - //////////////////////////////////////////////////////////////// // Debug tests //////////////////////////////////////////////////////////////// @@ -1821,8 +1677,8 @@ TEST(TransitionCovTest, RiseFallFindShortName) // RiseFallBoth::to_string and shortName TEST(TransitionCovTest, RiseFallBothToString) { - EXPECT_EQ(RiseFallBoth::rise()->to_string(), "^"); - EXPECT_EQ(RiseFallBoth::fall()->to_string(), "v"); + 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"); } @@ -1956,8 +1812,8 @@ TEST(TransitionCovTest, TransitionMaxIndex) // RiseFall::to_string TEST(TransitionCovTest, RiseFallToString) { - EXPECT_EQ(RiseFall::rise()->to_string(), "^"); - EXPECT_EQ(RiseFall::fall()->to_string(), "v"); + EXPECT_EQ(RiseFall::rise()->to_string(), "rise"); + EXPECT_EQ(RiseFall::fall()->to_string(), "fall"); } //////////////////////////////////////////////////////////////// @@ -2258,21 +2114,6 @@ TEST(ExceptionCovTest, ExceptionLineConstructor) EXPECT_STREQ(ex.what(), "test exception line"); } -//////////////////////////////////////////////////////////////// -// StringSet deleteContents coverage test -//////////////////////////////////////////////////////////////// - -TEST(StringSetCovTest, DeleteContents) -{ - StringSet *strings = new StringSet; - // Use stringCopy to allocate strings that can be freed by stringDelete - strings->insert(stringCopy("hello")); - strings->insert(stringCopy("world")); - EXPECT_EQ(strings->size(), 2u); - deleteContents(strings); - delete strings; -} - //////////////////////////////////////////////////////////////// // RiseFall::asRiseFallBoth non-const coverage test //////////////////////////////////////////////////////////////// diff --git a/verilog/test/verilog_bus.ok b/verilog/test/verilog_bus.ok index f259ec31..3da16a8c 100644 --- a/verilog/test/verilog_bus.ok +++ b/verilog/test/verilog_bus.ok @@ -248,10 +248,10 @@ Instance reg0 Q output data_out[0] QN output (unconnected) Other pins: - IQ internal (unconnected) - IQN internal (unconnected) VDD power (unconnected) VSS ground (unconnected) + IQ internal (unconnected) + IQN internal (unconnected) Instance reg1 Cell: DFF_X1 Library: NangateOpenCellLibrary @@ -263,10 +263,10 @@ Instance reg1 Q output data_out[1] QN output (unconnected) Other pins: - IQ internal (unconnected) - IQN internal (unconnected) VDD power (unconnected) VSS ground (unconnected) + IQ internal (unconnected) + IQN internal (unconnected) --- fanin/fanout --- fanin to data_out[0]: 3 fanout from data_in[0]: 6