From 7475ae2d38e08f221d7fbdc1da5e02ef1543ad38 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Wed, 11 Nov 2009 16:58:36 +0800
Subject: [PATCH] TEST: add baseline checking for test

---
 Examples/Projections/CMakeLists.txt              |  4 ++++
 Examples/Projections/CoordinateToNameExample.cxx | 12 +++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Examples/Projections/CMakeLists.txt b/Examples/Projections/CMakeLists.txt
index f627e3b621..b0d60fa5a1 100644
--- a/Examples/Projections/CMakeLists.txt
+++ b/Examples/Projections/CMakeLists.txt
@@ -116,8 +116,12 @@ ADD_TEST(prTePlaceNameToLonLatExampleTest ${EXE_TESTS2}
         Toulouse
 )
 ADD_TEST(prTeCoordinateToNameExampleTest ${EXE_TESTS2}
+         --compare-ascii ${TOL}
+         ${BASELINE}/CoordinateToNameExample.txt
+         ${TEMP}/CoordinateToNameExample.txt
     CoordinateToNameExampleTest
          103.78 1.29
+         ${TEMP}/CoordinateToNameExample.txt
 )
 ENDIF( OTB_USE_CURL )
 
diff --git a/Examples/Projections/CoordinateToNameExample.cxx b/Examples/Projections/CoordinateToNameExample.cxx
index 727eaad4ef..bdc7f56281 100644
--- a/Examples/Projections/CoordinateToNameExample.cxx
+++ b/Examples/Projections/CoordinateToNameExample.cxx
@@ -19,21 +19,22 @@
 #pragma warning ( disable : 4786 )
 #endif
 
+#include <fstream>
 
 #include "otbCoordinateToName.h"
 
-
 int main( int argc, char* argv[] )
 {
 
-  if (argc!=3)
+  if (argc!=4)
   {
-    std::cout << argv[0] <<" <lon> <lat>"
+    std::cout << argv[0] <<" <lon> <lat> <outputfile>"
               << std::endl;
 
     return EXIT_FAILURE;
   }
 
+  const char * outFileName = argv[3];
 
   otb::CoordinateToName::Pointer conv = otb::CoordinateToName::New();
   conv->SetLon(atof(argv[1]));
@@ -46,6 +47,11 @@ int main( int argc, char* argv[] )
   std::cout << "Nearby place: " << name << std::endl;
   std::cout << "Country: " << country << std::endl;
 
+  std::ofstream file;
+  file.open(outFileName);
+  file << "Nearby place: " << name << std::endl;
+  file << "Country: " << country << std::endl;
+  file.close();
 
   return EXIT_SUCCESS;
 
-- 
GitLab