forked from bblanchon/ArduinoJson
Test IsString<String>
and IsString<StringSumHelper>
This commit is contained in:
@ -62,7 +62,7 @@ class String {
|
|||||||
size_t _maxCapacity;
|
size_t _maxCapacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StringSumHelper;
|
class StringSumHelper : public ::String {};
|
||||||
|
|
||||||
inline bool operator==(const std::string& lhs, const ::String& rhs) {
|
inline bool operator==(const std::string& lhs, const ::String& rhs) {
|
||||||
return lhs == rhs.c_str();
|
return lhs == rhs.c_str();
|
||||||
|
@ -87,29 +87,14 @@ TEST_CASE("custom_string") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("IsString<T>") {
|
TEST_CASE("IsString<T>") {
|
||||||
SECTION("std::string") {
|
CHECK(IsString<std::string>::value == true);
|
||||||
CHECK(IsString<std::string>::value == true);
|
CHECK(IsString<std::basic_string<wchar_t> >::value == false);
|
||||||
}
|
CHECK(IsString<custom_string>::value == true);
|
||||||
|
CHECK(IsString<const __FlashStringHelper*>::value == true);
|
||||||
SECTION("basic_string<wchar_t>") {
|
CHECK(IsString<const char*>::value == true);
|
||||||
CHECK(IsString<std::basic_string<wchar_t> >::value == false);
|
CHECK(IsString<const char[8]>::value == true);
|
||||||
}
|
CHECK(IsString< ::String>::value == true);
|
||||||
|
CHECK(IsString< ::StringSumHelper>::value == true);
|
||||||
SECTION("custom_string") {
|
|
||||||
CHECK(IsString<custom_string>::value == true);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("const __FlashStringHelper*") {
|
|
||||||
CHECK(IsString<const __FlashStringHelper*>::value == true);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("const char*") {
|
|
||||||
CHECK(IsString<const char*>::value == true);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("const char[]") {
|
|
||||||
CHECK(IsString<const char[8]>::value == true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("stringCompare") {
|
TEST_CASE("stringCompare") {
|
||||||
|
Reference in New Issue
Block a user