Fix failing test due to inconsistent strcmp results
authorJonathan Wakely <jwakely@redhat.com>
Thu, 24 Jan 2019 15:39:19 +0000 (15:39 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 24 Jan 2019 15:39:19 +0000 (15:39 +0000)
* testsuite/27_io/filesystem/path/compare/strings.cc: Only compare
sign of results.

From-SVN: r268238

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc

index 4fd9fee932ff0f582c3f7b209f367ac00de4c97b..dd270781a6c5ddd9c50753f2b26ea27fe431ba7f 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-24  Jonathan Wakely  <jwakely@redhat.com>
+
+       * testsuite/27_io/filesystem/path/compare/strings.cc: Only compare
+       sign of results.
+
 2019-01-22  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/88740
index 3f0aa4bde0693459d8a95897e0ceead74d405693..83487ae35b693080f58fa4c0ef5772eb7d28fb7b 100644 (file)
@@ -26,6 +26,8 @@
 
 using std::filesystem::path;
 
+int sign(int i) { return i > 0 ? 1 : i < 0 ? -1 : 0; }
+
 void
 test01()
 {
@@ -36,8 +38,8 @@ test01()
     path p(s);
     VERIFY( p.compare(s) == 0 );
     VERIFY( p.compare(s.c_str()) == 0 );
-    VERIFY( p.compare(p0) == p.compare(s0) );
-    VERIFY( p.compare(p0) == p.compare(s0.c_str()) );
+    VERIFY( sign(p.compare(p0)) == sign(p.compare(s0)) );
+    VERIFY( sign(p.compare(p0)) == sign(p.compare(s0.c_str())) );
   }
 }