[libcxx] r186022 - Improved tests (and fixed a bug in the tests); thanks to Richard Smith for the suggestion

Marshall Clow mclow.lists at gmail.com
Wed Jul 10 11:01:34 PDT 2013


Author: marshall
Date: Wed Jul 10 13:01:34 2013
New Revision: 186022

URL: http://llvm.org/viewvc/llvm-project?rev=186022&view=rev
Log:
Improved tests (and fixed a bug in the tests); thanks to Richard Smith for the suggestion

Modified:
    libcxx/trunk/test/utilities/utility/exchange/exchange.pass.cpp

Modified: libcxx/trunk/test/utilities/utility/exchange/exchange.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/utility/exchange/exchange.pass.cpp?rev=186022&r1=186021&r2=186022&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/utility/exchange/exchange.pass.cpp (original)
+++ libcxx/trunk/test/utilities/utility/exchange/exchange.pass.cpp Wed Jul 10 13:01:34 2013
@@ -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
 }





More information about the cfe-commits mailing list