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:
parent
7969f3f81c
commit
55efc9e607
@ -844,7 +844,7 @@ template<> struct wxStrtoxCharType<int>
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
#if __cplusplus >= 201103
|
||||
#ifdef wxHAS_NULLPTR_T
|
||||
template<> struct wxStrtoxCharType<std::nullptr_t>
|
||||
{
|
||||
typedef const char* Type;
|
||||
|
@ -233,3 +233,33 @@ TEST_CASE("CRT::Strnlen", "[crt][strnlen]")
|
||||
CHECK( wxStrnlen("1234" "\0" "78", 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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user