test/cpp changes

Signed-off-by: dsengupta0628 <[email protected]>
This commit is contained in:
dsengupta0628
2026-04-05 00:18:45 +00:00
parent d6c13c424a
commit fc7ac6c16c
7 changed files with 73 additions and 45 deletions
+4
View File
@@ -184,6 +184,7 @@ TEST_F(SdcDesignTest, CycleAcctingSourceTargetCycle) {
TEST_F(SdcInitTest, ExceptionThruAsString) {
ASSERT_NO_THROW(( [&](){
Sdc *sdc = sta_->cmdSdc();
(void)sdc;
Network *network = sta_->cmdNetwork();
// Create ExceptionThru with no objects
ExceptionThru *thru = new ExceptionThru(nullptr, nullptr, nullptr,
@@ -230,6 +231,7 @@ TEST_F(SdcInitTest, ExceptionFromHash) {
TEST_F(SdcInitTest, ExceptionPathMergeable) {
Sdc *sdc = sta_->cmdSdc();
(void)sdc;
FalsePath *fp1 = new FalsePath(nullptr, nullptr, nullptr,
MinMaxAll::all(), true, "");
FalsePath *fp2 = new FalsePath(nullptr, nullptr, nullptr,
@@ -507,6 +509,7 @@ TEST_F(SdcDesignTest, WriteSdcWithDerating) {
TEST_F(SdcDesignTest, WriteSdcWithDisable) {
Graph *graph = sta_->graph();
Network *network = sta_->cmdNetwork();
(void)network;
Pin *pin = findPin("r1/D");
if (pin && graph) {
Vertex *v = graph->pinLoadVertex(pin);
@@ -608,6 +611,7 @@ TEST_F(SdcDesignTest, SdcClockLatencyEdge) {
Sdc *sdc = sta_->cmdSdc();
Graph *graph = sta_->graph();
Network *network = sta_->cmdNetwork();
(void)network;
Pin *pin = findPin("r1/CK");
if (pin && graph) {
Vertex *v = graph->pinLoadVertex(pin);
+6 -28
View File
@@ -35,31 +35,6 @@
namespace sta {
static std::string
readTextFile(const char *filename)
{
std::ifstream in(filename);
if (!in.is_open())
return "";
return std::string((std::istreambuf_iterator<char>(in)),
std::istreambuf_iterator<char>());
}
static size_t
countSubstring(const std::string &text,
const std::string &needle)
{
if (needle.empty())
return 0;
size_t count = 0;
size_t pos = 0;
while ((pos = text.find(needle, pos)) != std::string::npos) {
++count;
pos += needle.size();
}
return count;
}
////////////////////////////////////////////////////////////////
// SDC tests that require full Sta initialization
////////////////////////////////////////////////////////////////
@@ -1904,8 +1879,9 @@ TEST_F(SdcInitTest, DeratingFactorsIsOneValue2) {
bool is_one_value;
float value;
df.isOneValue(EarlyLate::early(), is_one_value, value);
if (is_one_value)
if (is_one_value) {
EXPECT_FLOAT_EQ(value, 0.9f);
}
}
// DeratingFactors isOneValue per clk_data
@@ -1917,8 +1893,9 @@ TEST_F(SdcInitTest, DeratingFactorsIsOneValueClkData2) {
float value;
df.isOneValue(PathClkOrData::clk, EarlyLate::early(),
is_one_value, value);
if (is_one_value)
if (is_one_value) {
EXPECT_FLOAT_EQ(value, 0.95f);
}
}
// DeratingFactorsGlobal
@@ -2034,8 +2011,9 @@ TEST_F(SdcInitTest, DeratingFactorsCellIsOneValue2) {
bool is_one;
float val;
dfc.isOneValue(EarlyLate::early(), is_one, val);
if (is_one)
if (is_one) {
EXPECT_FLOAT_EQ(val, 0.95f);
}
}
// DeratingFactorsNet