-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
failed lib/utils/test/src/test_stack_string.cc
- Loading branch information
Showing
1 changed file
with
69 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
// #include "test/utils/doctest.h" | ||
// #include "utils/stack_string.h" | ||
#include "test/utils/doctest.h" | ||
#include "utils/stack_string.h" | ||
|
||
// using namespace FlexFlow; | ||
using namespace FlexFlow; | ||
|
||
// TEST_SUITE(FF_TEST_SUITE) { | ||
// TEST_CASE_TEMPLATE("StackStringConstruction", T, char) { | ||
// constexpr std::size_t MAXSIZE = 5; | ||
// using StackString = stack_string<MAXSIZE>; | ||
TEST_SUITE(FF_TEST_SUITE) { | ||
TEST_CASE_TEMPLATE("StackStringConstruction", T, char) { | ||
constexpr std::size_t MAXSIZE = 5; | ||
using StackString = stack_string<MAXSIZE>; | ||
|
||
// SUBCASE("DefaultConstruction") { | ||
// StackString str; | ||
// CHECK(str.size() == 0); | ||
// CHECK(str.length() == 0); | ||
// CHECK(static_cast<std::string>(str) == ""); | ||
// } | ||
SUBCASE("DefaultConstruction") { | ||
StackString str; | ||
CHECK(str.size() == 0); | ||
CHECK(str.length() == 0); | ||
CHECK(static_cast<std::string>(str) == ""); | ||
} | ||
|
||
// SUBCASE("CStringConstruction") { | ||
// char const *cstr = "Hello"; | ||
// StackString str(cstr); | ||
// CHECK(str.size() == 5); | ||
// CHECK(str.length() == 5); | ||
// CHECK(static_cast<std::string>(str) == "Hello"); | ||
// } | ||
SUBCASE("CStringConstruction") { | ||
char const *cstr = "Hello"; | ||
StackString str(cstr); | ||
CHECK(str.size() == 5); | ||
CHECK(str.length() == 5); | ||
CHECK(static_cast<std::string>(str) == "Hello"); | ||
} | ||
|
||
// SUBCASE("ShortCStringConstruction") { | ||
// char const *cstr = "CMU"; | ||
// StackString str(cstr); | ||
// CHECK(str.size() == 3); | ||
// CHECK(str.length() == 3); | ||
// CHECK(static_cast<std::string>(str) == "CMU"); | ||
// } | ||
SUBCASE("ShortCStringConstruction") { | ||
char const *cstr = "CMU"; | ||
StackString str(cstr); | ||
CHECK(str.size() == 3); | ||
CHECK(str.length() == 3); | ||
CHECK(static_cast<std::string>(str) == "CMU"); | ||
} | ||
|
||
// SUBCASE("StdStringConstruction") { | ||
// std::basic_string<T> stdStr = "World"; | ||
// StackString str(stdStr); | ||
// CHECK(str.size() == 5); | ||
// CHECK(str.length() == 5); | ||
// CHECK(static_cast<std::string>(str) == "World"); | ||
// } | ||
// } | ||
SUBCASE("StdStringConstruction") { | ||
std::basic_string<T> stdStr = "World"; | ||
StackString str(stdStr); | ||
CHECK(str.size() == 5); | ||
CHECK(str.length() == 5); | ||
CHECK(static_cast<std::string>(str) == "World"); | ||
} | ||
} | ||
|
||
// TEST_CASE_TEMPLATE("StackStringComparison", T, char) { | ||
// constexpr std::size_t MAXSIZE = 5; | ||
// using StackString = stack_string<MAXSIZE>; | ||
TEST_CASE_TEMPLATE("StackStringComparison", T, char) { | ||
constexpr std::size_t MAXSIZE = 5; | ||
using StackString = stack_string<MAXSIZE>; | ||
|
||
// StackString str1{"abc"}; | ||
// StackString str2{"def"}; | ||
// StackString str3{"abc"}; | ||
StackString str1{"abc"}; | ||
StackString str2{"def"}; | ||
StackString str3{"abc"}; | ||
|
||
// CHECK(str1 == str1); | ||
// CHECK(str1 == str3); | ||
// CHECK(str1 != str2); | ||
// CHECK(str2 != str3); | ||
// CHECK(str1 < str2); | ||
// } | ||
CHECK(str1 == str1); | ||
CHECK(str1 == str3); | ||
CHECK(str1 != str2); | ||
CHECK(str2 != str3); | ||
CHECK(str1 < str2); | ||
} | ||
|
||
// TEST_CASE_TEMPLATE("StackStringSize", T, char) { | ||
// constexpr std::size_t MAXSIZE = 5; | ||
// using StackString = stack_string<MAXSIZE>; | ||
TEST_CASE_TEMPLATE("StackStringSize", T, char) { | ||
constexpr std::size_t MAXSIZE = 5; | ||
using StackString = stack_string<MAXSIZE>; | ||
|
||
// SUBCASE("EmptyString") { | ||
// StackString str; | ||
// CHECK(str.size() == 0); | ||
// CHECK(str.length() == 0); | ||
// } | ||
SUBCASE("EmptyString") { | ||
StackString str; | ||
CHECK(str.size() == 0); | ||
CHECK(str.length() == 0); | ||
} | ||
|
||
// SUBCASE("NonEmptyString") { | ||
// StackString str{"Hello"}; | ||
// CHECK(str.size() == 5); | ||
// CHECK(str.length() == 5); | ||
// } | ||
// } | ||
SUBCASE("NonEmptyString") { | ||
StackString str{"Hello"}; | ||
CHECK(str.size() == 5); | ||
CHECK(str.length() == 5); | ||
} | ||
} | ||
|
||
// TEST_CASE_TEMPLATE("StackStringConversion", T, char) { | ||
// constexpr std::size_t MAXSIZE = 5; | ||
// using StackString = stack_string<MAXSIZE>; | ||
TEST_CASE_TEMPLATE("StackStringConversion", T, char) { | ||
constexpr std::size_t MAXSIZE = 5; | ||
using StackString = stack_string<MAXSIZE>; | ||
|
||
// StackString str{"Hello"}; | ||
// std::string stdStr = static_cast<std::string>(str); | ||
// CHECK(stdStr == "Hello"); | ||
// } | ||
// } | ||
StackString str{"Hello"}; | ||
std::string stdStr = static_cast<std::string>(str); | ||
CHECK(stdStr == "Hello"); | ||
} | ||
} |