Improved tests (and fixed a bug in the tests); thanks to Richard Smith for the suggestion

llvm-svn: 186022
This commit is contained in:
Marshall Clow 2013-07-10 18:01:34 +00:00
parent b34939aaf5
commit 48c9fe29b2
1 changed files with 13 additions and 2 deletions

View File

@ -23,7 +23,11 @@ int main()
assert ( std::exchange ( v, 23 ) == 12 );
assert ( v == 23 );
assert ( std::exchange ( v, 67.2 ) == 23 );
assert ( v = 67 );
assert ( v == 67 );
assert ((std::exchange<int, float> ( v, {} )) == 67 );
assert ( v == 0 );
}
{
@ -40,8 +44,15 @@ int main()
assert ( s3 == s2 );
assert ( std::exchange ( s3, "Hi Mom!" ) == s2 );
assert ( s3 == s1 );
assert ( std::exchange ( s3, "" ) == s1 );
s3 = s2; // Dad
assert ( std::exchange ( s3, {} ) == s2 );
assert ( s3.size () == 0 );
s3 = s2; // Dad
assert ( std::exchange ( s3, "" ) == s2 );
assert ( s3.size () == 0 );
}
#endif
}