[Liblas-commits] hg-main-tree: use proper comparator

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Aug 11 16:29:52 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/79589109d6bf
changeset: 1038:79589109d6bf
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Aug 11 13:28:12 2011 -0700
description:
use proper comparator
Subject: hg-main-tree: added comment about comparators

details:   http://hg.libpc.orghg-main-tree/rev/d3e2cdb09606
changeset: 1039:d3e2cdb09606
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Aug 11 13:29:33 2011 -0700
description:
added comment about comparators

diffstat:

 test/unit/FileUtilsTest.cpp |  10 +++++-----
 test/unit/main.cpp          |   8 ++++++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r f31c9dca686c -r d3e2cdb09606 test/unit/FileUtilsTest.cpp
--- a/test/unit/FileUtilsTest.cpp	Thu Aug 11 15:05:37 2011 -0500
+++ b/test/unit/FileUtilsTest.cpp	Thu Aug 11 13:29:33 2011 -0700
@@ -106,23 +106,23 @@
 
     // check 1-arg version: make absolute when file is relative, via current working dir
     const string a = FileUtils::toAbsolutePath("foo.txt");
-    BOOST_CHECK(a == root + "/" + "foo.txt");
+    BOOST_CHECK_EQUAL(a, root + "/" + "foo.txt");
 
     // check 1-arg version: make absolute when file is already absolute
     const string b = FileUtils::toAbsolutePath(drive + "/baz/foo.txt");
-    BOOST_CHECK(b == "A:/baz/foo.txt");
+    BOOST_CHECK_EQUAL(b, "A:/baz/foo.txt");
 
     // check 2-arg version: make absolute when file relative, via given base
     const string c = FileUtils::toAbsolutePath("foo.txt", drive + "/a/b/c/d");
-    BOOST_CHECK(c == drive + "/a/b/c/d/foo.txt");
+    BOOST_CHECK_EQUAL(c, drive + "/a/b/c/d/foo.txt");
 
     // check 2-arg version: make absolute when file is relative, via given base (which isn't absolute)
     const string d = FileUtils::toAbsolutePath("foo.txt", "x/y/z");
-    BOOST_CHECK(d == root + "/" + "x/y/z/" + "foo.txt");
+    BOOST_CHECK_EQUAL(d, root + "/" + "x/y/z/" + "foo.txt");
 
     // check 1-arg version: make absolute when file is already absolute
     const string e = FileUtils::toAbsolutePath(drive+"/baz/foo.txt", drive+"/a/b/c/d");
-    BOOST_CHECK(e == drive+"/baz/foo.txt");
+    BOOST_CHECK_EQUAL(e, drive+"/baz/foo.txt");
 
     return;
 }
diff -r f31c9dca686c -r d3e2cdb09606 test/unit/main.cpp
--- a/test/unit/main.cpp	Thu Aug 11 15:05:37 2011 -0500
+++ b/test/unit/main.cpp	Thu Aug 11 13:29:33 2011 -0700
@@ -42,8 +42,12 @@
 // Testing macros:
 //   BOOST_TEST_MESSAGE("...")
 //   BOOST_CHECK(bool)
-
-// for comparing to floating point values, use
+//   BOOST_CHECK_EQUAL(t1, t2)
+//
+// The 'CHECK_EQUAL function is preferred to plain 'CHECK, because the former
+// prints out the values of both arguments in the error message.
+//
+// For comparing to floating point values, use
 //   BOOST_CHECK_CLOSE(a,b,perc)
 // where perc is a percentage value in the range [0..100] (typically)
 


More information about the Liblas-commits mailing list