Skip to content

Commit

Permalink
Add tests for rough edges
Browse files Browse the repository at this point in the history
  • Loading branch information
Quincunx271 committed Oct 27, 2021
1 parent bf32b46 commit 7b5e8e0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion unittests/Basic/ddg.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ makeDDG(const std::string &DDG,
FAIL() << "Unsupported operation convertSUnits()";
}
void convertRegFiles() override {
FAIL() << "Unsupported operation convertRegFile()";
FAIL() << "Unsupported operation convertRegFiles()";
}
};

Expand Down
49 changes: 49 additions & 0 deletions unittests/Basic/ddg_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "ddg.h"

#include "gtest/gtest-spi.h"
#include "gtest/gtest.h"

using namespace llvm::opt_sched;
Expand Down Expand Up @@ -111,4 +112,52 @@ dep 5 0 "other" 0

EXPECT_EQ(7, DDG->GetNodeCnt());
}

TEST(SimpleDDG, VirtualFunctionsFailWell) {
static std::shared_ptr<DataDepGraph> DDG = makeDDG(R"(
dag 3 "Simple"
{
dag_id fake:3
dag_weight 1.000000
compiler LLVM
dag_lb -1
dag_ub -1
nodes
node 0 "Inst"
sched_order 0
issue_cycle 0
node 1 "artificial" "__optsched_entry"
node 2 "artificial"
dependencies
dep 0 1 "other" 0
dep 1 2 "other" 0
}
)");

EXPECT_FATAL_FAILURE(DDG->convertRegFiles(),
"Unsupported operation convertRegFiles");
EXPECT_FATAL_FAILURE(DDG->convertSUnits(true, true),
"Unsupported operation convertSUnits");
}

TEST(SimpleDDG, MakeInvalidDDGFailsWell) {
EXPECT_NONFATAL_FAILURE(makeDDG(R"(
dag 3 "Simple"
{
dag_id fake:3
dag_weight 1.000000
compiler LLVM
dag_lb -1
dag_ub -1
nodes
node 0 "Inst"
sched_order 0
issue_cycle 0
node 1 "artificial" "__optsched_entry"
node 2 "artificial"
dependencies
}
)"),
"parse DDG");
}
} // namespace

0 comments on commit 7b5e8e0

Please sign in to comment.