Skip to content
Snippets Groups Projects
Commit c735a4b1 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

TEST: add test checking the validity of the test system

parent 84058fc0
Branches
Tags
No related merge requests found
......@@ -19,6 +19,7 @@ SET(EPS 0.001)
SET(TESTSYSTEM_TESTS ${CXX_TEST_PATH}/otbTestSystemTests)
#Test a basic ascii comparison
ADD_TEST(tsTvCompareAscii ${TESTSYSTEM_TESTS}
--compare-ascii ${NOTOL}
${TEMP}/tsTvCompareAsciiRef.txt
......@@ -28,6 +29,7 @@ ADD_TEST(tsTvCompareAscii ${TESTSYSTEM_TESTS}
${TEMP}/tsTvCompareAsciiTest.txt
)
#make sure that it fails when it has to.. (baseline shorter than test)
ADD_TEST(tsTvCompareAscii2 ${TESTSYSTEM_TESTS}
--compare-ascii ${NOTOL}
${TEMP}/tsTvCompareAsciiRef2.txt
......@@ -39,11 +41,46 @@ ADD_TEST(tsTvCompareAscii2 ${TESTSYSTEM_TESTS}
SET_TESTS_PROPERTIES(tsTvCompareAscii2 PROPERTIES WILL_FAIL true)
#with reverse order (test shorter than baseline)
ADD_TEST(tsTvCompareAscii2reverse ${TESTSYSTEM_TESTS}
--compare-ascii ${NOTOL}
${TEMP}/tsTvCompareAsciiRef2reverse.txt
${TEMP}/tsTvCompareAsciiTest2reverse.txt
otbCompareAsciiTests2
${TEMP}/tsTvCompareAsciiTest2reverse.txt
${TEMP}/tsTvCompareAsciiRef2reverse.txt
)
SET_TESTS_PROPERTIES(tsTvCompareAscii2reverse PROPERTIES WILL_FAIL true)
#ignoring the line order
ADD_TEST(tsTvCompareAscii3 ${TESTSYSTEM_TESTS}
--ignore-order --compare-ascii ${NOTOL}
${TEMP}/tsTvCompareAsciiRef3.txt
${TEMP}/tsTvCompareAsciiTest3.txt
otbCompareAsciiTests3
${TEMP}/tsTvCompareAsciiRef3.txt
${TEMP}/tsTvCompareAsciiTest3.txt
)
#fails if the line order is not ignored
ADD_TEST(tsTvCompareAscii3order ${TESTSYSTEM_TESTS}
--compare-ascii ${NOTOL}
${TEMP}/tsTvCompareAsciiRef3order.txt
${TEMP}/tsTvCompareAsciiTest3order.txt
otbCompareAsciiTests3
${TEMP}/tsTvCompareAsciiRef3order.txt
${TEMP}/tsTvCompareAsciiTest3order.txt
)
SET_TESTS_PROPERTIES(tsTvCompareAscii3order PROPERTIES WILL_FAIL true)
# ------- CXX source files -----------------------------------
SET(TESTSYSTEM_SRCS
otbTestSystemTests.cxx
otbCompareAsciiTests.cxx
otbCompareAsciiTests2.cxx
otbCompareAsciiTests3.cxx
)
INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code)
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <iostream>
#include <fstream>
#include "itkExceptionObject.h"
#include "otbMacro.h"
int otbCompareAsciiTests3(int argc, char * argv[])
{
if ( argc != 3 )
{
std::cerr << "Usage: " << argv[0];
std::cerr << " referenceFile testFile" << std::endl;
return EXIT_FAILURE;
}
std::ofstream fileRef;
fileRef.open(argv[1]);
fileRef << "1\n";
fileRef << "2\n";
fileRef << "3\n";
fileRef << "2\n";
fileRef.close();
std::ofstream fileTest;
fileTest.open(argv[2]);
fileTest << "2\n";
fileTest << "2\n";
fileTest << "3\n";
fileTest << "1\n";
fileTest.close();
return EXIT_SUCCESS;
}
......@@ -28,4 +28,5 @@ void RegisterTests()
{
REGISTER_TEST(otbCompareAsciiTests);
REGISTER_TEST(otbCompareAsciiTests2);
REGISTER_TEST(otbCompareAsciiTests3);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment