mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
87 lines
3.3 KiB
C++
87 lines
3.3 KiB
C++
#include "gtest/gtest.h"
|
|
|
|
#include "RiaGitDiff.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() );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
TEST( DISABLED_RiaGitDiffTest, BasicCompare )
|
|
{
|
|
RiaRegressionTest regTestConfig;
|
|
regTestConfig.readSettingsFromApplicationStore();
|
|
QString folderContainingDiff = regTestConfig.folderContainingGitTool();
|
|
|
|
RiaGitDiff compare( folderContainingDiff );
|
|
|
|
QString baseFolder = QString( "d:/gitroot-ceesol/ResInsight-regression-test/ProjectFiles/CommandFileTests" );
|
|
|
|
compare.executeDiff( baseFolder );
|
|
compare.diffOutput();
|
|
}
|