aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-01-24 15:39:19 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2019-01-24 15:39:19 +0000
commit400a08e28429f2c56c2298908be673a5951d5e20 (patch)
tree50f9629d1b7f1fec20b3cf14708f03ef2317e697
parent738c56d4104867713d8fe64dd0ddbdef56f9c67b (diff)
downloadgcc-400a08e28429f2c56c2298908be673a5951d5e20.zip
gcc-400a08e28429f2c56c2298908be673a5951d5e20.tar.gz
gcc-400a08e28429f2c56c2298908be673a5951d5e20.tar.bz2
Fix failing test due to inconsistent strcmp results
* testsuite/27_io/filesystem/path/compare/strings.cc: Only compare sign of results. From-SVN: r268238
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc6
2 files changed, 9 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 4fd9fee..dd27078 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc
index 3f0aa4b..83487ae 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc
@@ -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())) );
}
}