Differential D51268 Diff 174864 test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
Changeset View
Changeset View
Standalone View
Standalone View
test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | int main() | ||||
is.width(4); | is.width(4); | ||||
signed char s[20]; | signed char s[20]; | ||||
is >> s; | is >> s; | ||||
assert(!is.eof()); | assert(!is.eof()); | ||||
assert(!is.fail()); | assert(!is.fail()); | ||||
assert(std::string((char*)s) == "abc"); | assert(std::string((char*)s) == "abc"); | ||||
assert(is.width() == 0); | assert(is.width() == 0); | ||||
} | } | ||||
#if TEST_STD_VER > 17 | |||||
{ | |||||
testbuf<char> sb(" abcdefghijk "); | |||||
std::istream is(&sb); | |||||
signed char s[4]; | |||||
is >> s; | |||||
assert(!is.eof()); | |||||
assert(!is.fail()); | |||||
assert(std::string((char*)s) == "abc"); | |||||
} | |||||
#endif | |||||
{ | { | ||||
testbuf<char> sb(" abcdefghijk"); | testbuf<char> sb(" abcdefghijk"); | ||||
std::istream is(&sb); | std::istream is(&sb); | ||||
signed char s[20]; | signed char s[20]; | ||||
is >> s; | is >> s; | ||||
assert( is.eof()); | assert( is.eof()); | ||||
assert(!is.fail()); | assert(!is.fail()); | ||||
assert(std::string((char*)s) == "abcdefghijk"); | assert(std::string((char*)s) == "abcdefghijk"); | ||||
assert(is.width() == 0); | assert(is.width() == 0); | ||||
} | } | ||||
{ | { | ||||
testbuf<char> sb(" abcdefghijk"); | testbuf<char> sb(" abcdefghijk"); | ||||
std::istream is(&sb); | std::istream is(&sb); | ||||
signed char s[20]; | signed char s[20]; | ||||
is.width(1); | is.width(1); | ||||
is >> s; | is >> s; | ||||
assert(!is.eof()); | assert(!is.eof()); | ||||
assert( is.fail()); | assert( is.fail()); | ||||
assert(std::string((char*)s) == ""); | assert(std::string((char*)s) == ""); | ||||
assert(is.width() == 0); | assert(is.width() == 0); | ||||
} | } | ||||
#if TEST_STD_VER > 17 | |||||
{ | |||||
testbuf<char> sb(" abcdefghijk"); | |||||
std::istream is(&sb); | |||||
signed char s[1]; | |||||
is >> s; | |||||
assert(!is.eof()); | |||||
assert( is.fail()); | |||||
assert(std::string((char*)s) == ""); | |||||
} | |||||
#endif | |||||
} | } |