Allow using wxStrtox() functions with nullptr with MSVS too
Add a unit test checking that it compiles (and works).
This extends the changes of 63b1f00eb8
to
cover MSVS as well.
This commit is contained in:
@@ -844,7 +844,7 @@ template<> struct wxStrtoxCharType<int>
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#if __cplusplus >= 201103
|
#ifdef wxHAS_NULLPTR_T
|
||||||
template<> struct wxStrtoxCharType<std::nullptr_t>
|
template<> struct wxStrtoxCharType<std::nullptr_t>
|
||||||
{
|
{
|
||||||
typedef const char* Type;
|
typedef const char* Type;
|
||||||
|
@@ -233,3 +233,33 @@ TEST_CASE("CRT::Strnlen", "[crt][strnlen]")
|
|||||||
CHECK( wxStrnlen("1234" "\0" "78", 12) == 4 );
|
CHECK( wxStrnlen("1234" "\0" "78", 12) == 4 );
|
||||||
CHECK( wxStrnlen(L"1234" L"\0" L"5678", 12) == 4 );
|
CHECK( wxStrnlen(L"1234" L"\0" L"5678", 12) == 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("CRT::Strtod", "[crt][strtod]")
|
||||||
|
{
|
||||||
|
const wxString s = "123@";
|
||||||
|
const double d = 123.0;
|
||||||
|
|
||||||
|
SECTION("char")
|
||||||
|
{
|
||||||
|
char* end = NULL;
|
||||||
|
CHECK( wxStrtod(s, &end) == d );
|
||||||
|
REQUIRE( end );
|
||||||
|
CHECK( *end == '@' );
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("wchar_t")
|
||||||
|
{
|
||||||
|
wchar_t* end = NULL;
|
||||||
|
CHECK( wxStrtod(s, &end) == d );
|
||||||
|
REQUIRE( end );
|
||||||
|
CHECK( *end == L'@' );
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("other")
|
||||||
|
{
|
||||||
|
CHECK( wxStrtod(s, 0) == d );
|
||||||
|
#ifdef wxHAS_NULLPTR_T
|
||||||
|
CHECK( wxStrtod(s, nullptr) == d );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user