[Liblas-commits] hg-main-tree: default test for each of the apps

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Aug 12 13:37:34 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/d17d4f084b1b
changeset: 1072:d17d4f084b1b
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Fri Aug 12 10:37:22 2011 -0700
description:
default test for each of the apps

diffstat:

 test/unit/pc2pcTest.cpp      |  20 ++++++++++++++++++++
 test/unit/pcinfoTest.cpp     |  20 ++++++++++++++++++--
 test/unit/pcpipelineTest.cpp |  22 +++++++++++++++++++++-
 3 files changed, 59 insertions(+), 3 deletions(-)

diffs (112 lines):

diff -r e14101254dc5 -r d17d4f084b1b test/unit/pc2pcTest.cpp
--- a/test/unit/pc2pcTest.cpp	Fri Aug 12 10:23:07 2011 -0700
+++ b/test/unit/pc2pcTest.cpp	Fri Aug 12 10:37:22 2011 -0700
@@ -33,6 +33,8 @@
 ****************************************************************************/
 
 #include <boost/test/unit_test.hpp>
+#include <pdal/FileUtils.hpp>
+#include "Support.hpp"
 
 #include <iostream>
 #include <sstream>
@@ -41,8 +43,26 @@
 
 BOOST_AUTO_TEST_SUITE(pc2pcTest)
 
+
+static std::string appName()
+{
+    const std::string app = Support::binpath(Support::exename("pc2pc"));
+    BOOST_CHECK(pdal::FileUtils::fileExists(app));
+    return app;
+}
+
+
 BOOST_AUTO_TEST_CASE(pc2pcTest_test1)
 {
+    const std::string cmd = appName();
+
+    std::string output;
+    int stat = Support::run_command(cmd, output);
+    BOOST_CHECK_EQUAL(stat, 1);
+
+    const std::string expected = "Usage error: --input";
+    BOOST_CHECK_EQUAL(output.substr(0, expected.length()), expected);
+
     return;
 }
 
diff -r e14101254dc5 -r d17d4f084b1b test/unit/pcinfoTest.cpp
--- a/test/unit/pcinfoTest.cpp	Fri Aug 12 10:23:07 2011 -0700
+++ b/test/unit/pcinfoTest.cpp	Fri Aug 12 10:37:22 2011 -0700
@@ -43,10 +43,26 @@
 
 BOOST_AUTO_TEST_SUITE(pcinfoTest)
 
+
+static std::string appName()
+{
+    const std::string app = Support::binpath(Support::exename("pcinfo"));
+    BOOST_CHECK(pdal::FileUtils::fileExists(app));
+    return app;
+}
+
+
 BOOST_AUTO_TEST_CASE(pcinfoTest_1)
 {
-    const std::string cmd = Support::binpath(Support::exename("pcinfo"));
-    BOOST_CHECK(pdal::FileUtils::fileExists(cmd));
+    const std::string cmd = appName();
+
+    std::string output;
+    int stat = Support::run_command(cmd, output);
+    BOOST_CHECK_EQUAL(stat, 1);
+
+    const std::string expected = "Usage error: input file name required";
+    BOOST_CHECK_EQUAL(output.substr(0, expected.length()), expected);
+
     return;
 }
 
diff -r e14101254dc5 -r d17d4f084b1b test/unit/pcpipelineTest.cpp
--- a/test/unit/pcpipelineTest.cpp	Fri Aug 12 10:23:07 2011 -0700
+++ b/test/unit/pcpipelineTest.cpp	Fri Aug 12 10:37:22 2011 -0700
@@ -33,6 +33,8 @@
 ****************************************************************************/
 
 #include <boost/test/unit_test.hpp>
+#include <pdal/FileUtils.hpp>
+#include "Support.hpp"
 
 #include <iostream>
 #include <sstream>
@@ -41,9 +43,27 @@
 
 BOOST_AUTO_TEST_SUITE(pcpipelineTest)
 
+
+static std::string appName()
+{
+    const std::string app = Support::binpath(Support::exename("pcpipeline"));
+    BOOST_CHECK(pdal::FileUtils::fileExists(app));
+    return app;
+}
+
+
 BOOST_AUTO_TEST_CASE(pcpipelineTest_1)
 {
-      return;
+    const std::string cmd = appName();
+
+    std::string output;
+    int stat = Support::run_command(cmd, output);
+    BOOST_CHECK_EQUAL(stat, 1);
+
+    const std::string expected = "Usage error: --input";
+    BOOST_CHECK_EQUAL(output.substr(0, expected.length()), expected);
+
+    return;
 }
 
 BOOST_AUTO_TEST_SUITE_END()


More information about the Liblas-commits mailing list