mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#2554 Regression Test : Add text file compare tool and display folder in test config
This commit is contained in:
@@ -38,7 +38,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifElementPropertyTableReader-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimRelocatePath-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityCondenser-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseUnitTools-Test
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseUnitTools-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaTextFileCompare-Test.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RiaRegressionTest.h"
|
||||
#include "RiaTestDataDirectory.h"
|
||||
#include "RiaTextFileCompare.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RiaTextFileCompareTest, BasicCompareWithDiff)
|
||||
{
|
||||
RiaRegressionTest regTestConfig;
|
||||
regTestConfig.readSettingsFromApplicationStore();
|
||||
QString folderContainingDiff = regTestConfig.folderContainingDiffTool();
|
||||
|
||||
QString baseFolder = QString("%1/TextCompare/base").arg(TEST_DATA_DIR);
|
||||
QString referenceFolder = QString("%1/TextCompare/reference").arg(TEST_DATA_DIR);
|
||||
|
||||
RiaTextFileCompare compare(folderContainingDiff);
|
||||
|
||||
bool noDifference = compare.runComparison(baseFolder, referenceFolder);
|
||||
EXPECT_FALSE(noDifference);
|
||||
|
||||
QString diffOutput = compare.diffOutput();
|
||||
EXPECT_FALSE(diffOutput.isEmpty());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RiaTextFileCompareTest, BasicCompareNoDiff)
|
||||
{
|
||||
RiaRegressionTest regTestConfig;
|
||||
regTestConfig.readSettingsFromApplicationStore();
|
||||
QString folderContainingDiff = regTestConfig.folderContainingDiffTool();
|
||||
|
||||
QString baseFolder = QString("%1/TextCompare/base/folderB").arg(TEST_DATA_DIR);
|
||||
QString referenceFolder = QString("%1/TextCompare/reference/folderB").arg(TEST_DATA_DIR);
|
||||
|
||||
RiaTextFileCompare compare(folderContainingDiff);
|
||||
|
||||
bool noDifference = compare.runComparison(baseFolder, referenceFolder);
|
||||
EXPECT_TRUE(noDifference);
|
||||
|
||||
QString diffOutput = compare.diffOutput();
|
||||
EXPECT_TRUE(diffOutput.isEmpty());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RiaTextFileCompareTest, BasicCompareError)
|
||||
{
|
||||
RiaRegressionTest regTestConfig;
|
||||
regTestConfig.readSettingsFromApplicationStore();
|
||||
QString folderContainingDiff = regTestConfig.folderContainingDiffTool();
|
||||
|
||||
QString baseFolder = QString("%1/TextCompare/baseDoesNotExist").arg(TEST_DATA_DIR);
|
||||
QString referenceFolder = QString("%1/TextCompare/reference/folderB").arg(TEST_DATA_DIR);
|
||||
|
||||
RiaTextFileCompare compare(folderContainingDiff);
|
||||
|
||||
bool noDifference = compare.runComparison(baseFolder, referenceFolder);
|
||||
EXPECT_FALSE(noDifference);
|
||||
|
||||
QString error = compare.errorMessage();
|
||||
EXPECT_FALSE(error.isEmpty());
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
some text
|
||||
|
||||
some more text
|
||||
some more text
|
||||
some more text some more text some more text
|
||||
|
||||
some more text
|
||||
some more text
|
||||
some more text
|
||||
some more text
|
||||
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
some text
|
||||
|
||||
some more text
|
||||
some more text
|
||||
some more text some more text some more text
|
||||
|
||||
some more text
|
||||
some more text
|
||||
some more text
|
||||
some more text
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
some text
|
||||
|
||||
some more text
|
||||
some more text somthing has changed
|
||||
some more text some more text some more text
|
||||
|
||||
some more text
|
||||
some more text
|
||||
some more text
|
||||
some more text
|
||||
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
some text
|
||||
|
||||
some more text
|
||||
some more text
|
||||
some more text some more text some more text
|
||||
|
||||
some more text
|
||||
some more text
|
||||
some more text
|
||||
some more text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user