[Liblas-commits] hg-main-tree: output tests passing

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Apr 26 13:35:06 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/b1a5d46b86a2
changeset: 663:b1a5d46b86a2
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Tue Apr 26 10:34:57 2011 -0700
description:
output tests passing

diffstat:

 include/libpc/Range.hpp  |   2 +-
 test/unit/BoundsTest.cpp |  27 +++++++++++----------------
 test/unit/RangeTest.cpp  |  16 ++++++++++++----
 3 files changed, 24 insertions(+), 21 deletions(-)

diffs (87 lines):

diff -r 199ee57d3576 -r b1a5d46b86a2 include/libpc/Range.hpp
--- a/include/libpc/Range.hpp	Tue Apr 26 10:23:28 2011 -0700
+++ b/include/libpc/Range.hpp	Tue Apr 26 10:34:57 2011 -0700
@@ -192,7 +192,7 @@
 template<class T>
 std::ostream& operator<<(std::ostream& ostr, const Range<T>& range)
 {
-    ostr << "[" << range.getMinimum() << " , " << range.getMaximum() << "]";
+    ostr << "[" << range.getMinimum() << ", " << range.getMaximum() << "]";
     return ostr;
 }
 
diff -r 199ee57d3576 -r b1a5d46b86a2 test/unit/BoundsTest.cpp
--- a/test/unit/BoundsTest.cpp	Tue Apr 26 10:23:28 2011 -0700
+++ b/test/unit/BoundsTest.cpp	Tue Apr 26 10:34:57 2011 -0700
@@ -216,16 +216,6 @@
     return;
 }
 
-BOOST_AUTO_TEST_CASE(test_dump)
-{
-    Bounds<int> r(1,2,3,7,8,9);
-  
-    std::ostringstream s;
-    s << r;
-
-    BOOST_CHECK(s.str() == "([1 .. 7], [2 .. 8], [3 .. 9])");
-    return;
-}
 
 BOOST_AUTO_TEST_CASE(test_static)
 {
@@ -247,15 +237,20 @@
 
 BOOST_AUTO_TEST_CASE(test_output)
 {
-    Bounds<double> b2(1,2,101,102);
-    Bounds<double> b3(1,2,3,101,102,103);
+    const Bounds<int> b2(1,2,101,102);
+    const Bounds<double> b3(1.1,2.2,3.3,101.1,102.2,103.3);
     
-    std::stringstream oss;
-    oss << b2;
+    std::stringstream ss2(std::stringstream::in | std::stringstream::out);
+    std::stringstream ss3(std::stringstream::in | std::stringstream::out);
 
-    std::string b2s = oss.str();
+    ss2 << b2;
+    ss3 << b3;
 
-    BOOST_CHECK(b2s == "([1 , 101], [2, 102])");
+    const std::string out2 = ss2.str();
+    const std::string out3 = ss3.str();
+
+    BOOST_CHECK(out2 == "([1, 101], [2, 102])");
+    BOOST_CHECK(out3 == "([1.1, 101.1], [2.2, 102.2], [3.3, 103.3])");
 
     return;
 }
diff -r 199ee57d3576 -r b1a5d46b86a2 test/unit/RangeTest.cpp
--- a/test/unit/RangeTest.cpp	Tue Apr 26 10:23:28 2011 -0700
+++ b/test/unit/RangeTest.cpp	Tue Apr 26 10:34:57 2011 -0700
@@ -197,12 +197,20 @@
 
 BOOST_AUTO_TEST_CASE(test_output)
 {
-    Range<int> r(10,20);
+    const Range<int> r1(1,2);
+    const Range<double> r2(1.1,2.2);
   
-    std::stringstream oss;
-    oss << r;
+    std::stringstream ss1(std::stringstream::in | std::stringstream::out);
+    std::stringstream ss2(std::stringstream::in | std::stringstream::out);
 
-    BOOST_CHECK(oss.str() == "[10 .. 20]");
+    ss1 << r1;
+    ss2 << r2;
+
+    const std::string out1 = ss1.str();
+    const std::string out2 = ss2.str();
+
+    BOOST_CHECK(out1 == "[1, 2]");
+    BOOST_CHECK(out2 == "[1.1, 2.2]");
 
     return;
 }


More information about the Liblas-commits mailing list