Test whitespace handling in std::complex extraction
* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc: Add tests using noskipws. From-SVN: r255632
This commit is contained in:
parent
4d39941ea9
commit
f297ebafdc
|
@ -1,5 +1,8 @@
|
||||||
2017-12-14 Jonathan Wakely <jwakely@redhat.com>
|
2017-12-14 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
|
||||||
|
Add tests using noskipws.
|
||||||
|
|
||||||
* testsuite/26_numerics/complex/dr2714.cc: Move to ...
|
* testsuite/26_numerics/complex/dr2714.cc: Move to ...
|
||||||
* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
|
* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
|
||||||
... Here. Remove duplicate header and dg-options. Check first invalid
|
... Here. Remove duplicate header and dg-options. Check first invalid
|
||||||
|
|
|
@ -145,10 +145,38 @@ test03()
|
||||||
in.clear();
|
in.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test04()
|
||||||
|
{
|
||||||
|
// Test noskipws handling
|
||||||
|
std::istringstream in;
|
||||||
|
const char* bad_inputs[] = {
|
||||||
|
" 1", " (2)", "( 2)", "(2 )", "(2 ,3)", "(2,3 )", 0
|
||||||
|
};
|
||||||
|
const std::complex<double> c0(-1, -1);
|
||||||
|
std::complex<double> c;
|
||||||
|
for (int i = 0; bad_inputs[i]; ++i)
|
||||||
|
{
|
||||||
|
c = c0;
|
||||||
|
in.clear();
|
||||||
|
in.str(bad_inputs[i]);
|
||||||
|
in >> std::noskipws >> c;
|
||||||
|
VERIFY( in.fail() );
|
||||||
|
VERIFY( c == c0 );
|
||||||
|
|
||||||
|
in.clear();
|
||||||
|
in.str(bad_inputs[i]);
|
||||||
|
in >> std::skipws >> c;
|
||||||
|
VERIFY( !in.fail() );
|
||||||
|
VERIFY( c != c0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
test01();
|
test01();
|
||||||
test02();
|
test02();
|
||||||
test03();
|
test03();
|
||||||
|
test04();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue