Skip to content

Commit

Permalink
Add tests for IsPositiveInteger and IsNonNegativeInteger
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-hwoo committed Aug 14, 2023
1 parent d2614af commit 2e80c06
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/c++/perf_analyzer/test_perf_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,5 +370,35 @@ TEST_CASE("perf_utils: TensorToRegionName")
CHECK(TensorToRegionName("") == "");
}

TEST_CASE("perf_utils: Test string input numbers")
{
std::string pos{"123"};
std::string neg{"-123"};
std::string zero{"0"};
std::string not_number{"helloworld"};
std::string almost_number{"123hello"};
std::string empty{""};

SUBCASE("IsPositiveInteger")
{
CHECK(IsPositiveInteger(pos));
CHECK(!IsPositiveInteger(neg));
CHECK(!IsPositiveInteger(zero));
CHECK(!IsPositiveInteger(not_number));
CHECK(!IsPositiveInteger(almost_number));
CHECK(!IsPositiveInteger(empty));
}

SUBCASE("IsNonNegativeInteger")
{
CHECK(IsNonNegativeInteger(pos));
CHECK(!IsNonNegativeInteger(neg));
CHECK(IsNonNegativeInteger(zero));
CHECK(!IsNonNegativeInteger(not_number));
CHECK(!IsNonNegativeInteger(almost_number));
CHECK(!IsNonNegativeInteger(empty));
}
}


}} // namespace triton::perfanalyzer

0 comments on commit 2e80c06

Please sign in to comment.