This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove testsuite/23_containers/map/operators/1.cc ?


On 04/06/2014 22:52, Jonathan Wakely wrote:
On 04/06/14 22:32 +0200, Paolo Carlini wrote:
Hi,

On 06/04/2014 10:22 PM, François Dumont wrote:
Hello

Do you see any objection in removing this file ? It doesn't look like a test at all to me, just send some datas to std::cerr. There is also a weird comment talking about multiset while code is using map.
The comment seems a pasto, which should be fixed. Likewise the uses of the inserters should be either turned into VERIFYs or alternately the testcase changed to do-compile (the original issue was a compile-time issue, but years ago we used to mostly add to the library testsuite do-run testcases). Indeed, we could also move it to where the other insert tests are (I think the reason of the weird directory has to do with the semantics of the operator[] in C++98).

It looks like it only needs to do this, as a compile-only test:

   typedef std::map<int,const int> MapInt;

   MapInt m;
   for (MapInt::const_iterator i=m.begin();i!=m.end();++i)
   { }

   for (MapInt::const_iterator i=m.begin();m.end()!=i;++i)
   { }

The bug that it tests was in iterator comparisons:
https://gcc.gnu.org/ml/libstdc++/2000-11/msg00093.html


Ok, I checked the PR too and simplified the test.

Can I commit this ?

Shall I add a ChangeLog entry for such a simple modification ?

François

Index: testsuite/23_containers/map/operators/1.cc
===================================================================
--- testsuite/23_containers/map/operators/1.cc	(revision 211288)
+++ testsuite/23_containers/map/operators/1.cc	(working copy)
@@ -1,3 +1,5 @@
+// { dg-do compile }
+
 // 2000-09-07 bgarcia@laurelnetworks.com
 
 // Copyright (C) 2000-2014 Free Software Foundation, Inc.
@@ -17,17 +19,15 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// 23.3.4 template class multiset
+// 23.4.4 template class map
 
 #include <map>
-#include <string>
-#include <iostream>
 
 // libstdc++/737
 // http://gcc.gnu.org/ml/libstdc++/2000-11/msg00093.html
 void test02()
 {
-  typedef std::map<int, int> MapInt;
+  typedef std::map<int, const int> MapInt;
   
   MapInt m;
   
@@ -35,10 +35,10 @@
     m.insert(MapInt::value_type(i,i));
   
   for (MapInt::const_iterator i = m.begin(); i != m.end(); ++i)
-    std::cerr << i->second << ' ';
+    { }
   
   for (MapInt::const_iterator i = m.begin(); m.end() != i; ++i)
-    std::cerr << i->second << ' ';
+    { }
 }
 
 int main()

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]