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]

[PATCH] Tweak collate_byname.cc


Hi,

while looking again at the collate tests (which are still unexplicably failing
on alpha-linux :( any idea why, by the way?) I noticed that collate_byname.cc
should be modified consistently with the changes which went in for
collate_members_xx.cc.

Tested i686-pc-linux-gnu.

Ok?

Ciao, Paolo.

///////////////

2002-03-23  Paolo Carlini  <pcarlini@unitus.it>

        * testsuite/22_locale/collate_byname.cc
        (test01): compare the result of collate::compare with
        that of collate::transform + string::compare, not with
        that of collate::transform + collate::compare; values
        returned by collate::compare are normalized, therefore
        test against +-1.

--- collate_byname.cc.~1.3.~ Tue Feb 19 06:59:09 2002
+++ collate_byname.cc Sat Mar 23 18:58:02 2002
@@ -57,20 +57,20 @@

   int size3 = strlen(strlit3) - 1;
   i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7);
-  VERIFY ( i1 > 0 );
+  VERIFY ( i1 == 1 );
   i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size3);
-  VERIFY ( i1 < 0 );
+  VERIFY ( i1 == -1 );
   i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7);
   VERIFY ( i1 == 0 );

   i1 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14);
-  VERIFY ( i1 < 0 );
+  VERIFY ( i1 == -1 );

   int size4 = strlen(strlit4) - 1;
   i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13);
-  VERIFY ( i2 > 0 );
+  VERIFY ( i2 == 1 );
   i2 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4);
-  VERIFY ( i2 < 0 );
+  VERIFY ( i2 == -1 );
   i2 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4);
   VERIFY ( i2 == 0 );

@@ -83,10 +83,10 @@

   string str3 = coll_de.transform(strlit3, strlit3 + size3);
   string str4 = coll_de.transform(strlit4, strlit4 + size4);
-  i1 = coll_de.compare(str3.c_str(), str3.c_str() + size3,
-         str4.c_str(), str4.c_str() + size4);
+  i1 = str3.compare(str4);
   i2 = coll_de.compare(strlit3, strlit3 + size3, strlit4, strlit4 + size4);
-  VERIFY(i1 == i2);
+  VERIFY ( i2 == -1 );
+  VERIFY ( i1 * i2 > 0 );


   // Check byname locale
@@ -96,20 +96,20 @@
   long l4;
   size4 = strlen(strlit3) - 1;
   i3 = coll_de.compare(strlit3, strlit3 + size4, strlit3, strlit3 + 7);
-  VERIFY ( i3 > 0 );
+  VERIFY ( i3 == 1 );
   i3 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size4);
-  VERIFY ( i3 < 0 );
+  VERIFY ( i3 == -1 );
   i3 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7);
   VERIFY ( i3 == 0 );

   i3 = coll_de.compare(strlit3, strlit3 + 6, strlit3 + 8, strlit3 + 14);
-  VERIFY ( i3 < 0 );
+  VERIFY ( i3 == -1 );

   size4 = strlen(strlit4) - 1;
   i4 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + 13);
-  VERIFY ( i4 > 0 );
+  VERIFY ( i4 == 1 );
   i4 = coll_de.compare(strlit4, strlit4 + 13, strlit4, strlit4 + size4);
-  VERIFY ( i4 < 0 );
+  VERIFY ( i4 == -1 );
   i4 = coll_de.compare(strlit4, strlit4 + size4, strlit4, strlit4 + size4);
   VERIFY ( i4 == 0 );

@@ -122,10 +122,10 @@

   string str5 = coll_de.transform(strlit3, strlit3 + size3);
   string str6 = coll_de.transform(strlit4, strlit4 + size4);
-  i3 = coll_de.compare(str5.c_str(), str5.c_str() + size3,
-         str6.c_str(), str6.c_str() + size4);
+  i3 = str5.compare(str6);
   i4 = coll_de.compare(strlit3, strlit3 + size4, strlit4, strlit4 + size4);
-  VERIFY(i3 == i4);
+  VERIFY ( i4 == -1 );
+  VERIFY ( i3 * i4 > 0 );

   // Verify byname == de
   VERIFY ( str5 == str3 );




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