RifElementPropertyTableReader unit tests

This commit is contained in:
Bjørn Erik Jensen 2018-01-09 15:39:17 +01:00
parent f632b36993
commit 3e11f9fbd6
4 changed files with 8706 additions and 0 deletions

View File

@ -40,6 +40,7 @@ ${CEE_CURRENT_LIST_DIR}FixedWidthDataParser-Test.cpp
${CEE_CURRENT_LIST_DIR}RigTimeCurveHistoryMerger-Test.cpp
${CEE_CURRENT_LIST_DIR}ListKeywordsForObjectsAndFields-Test.cpp
${CEE_CURRENT_LIST_DIR}RiaProjectFileVersionTools-Test.cpp
${CEE_CURRENT_LIST_DIR}RicElementPropertyTableReader-Test.cpp
)
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)

View File

@ -0,0 +1,53 @@
#include "gtest/gtest.h"
#include "RiaTestDataDirectory.h"
#include "RifElementPropertyTableReader.h"
#include <QString>
#include <numeric>
static const QString TEST_DATA_DIRECTORY = QString("%1/ElementPropertyTable/").arg(TEST_DATA_DIR);
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RicElementPropertyTableReaderTest, BasicUsage)
{
RifElementPropertyMetadata metadata = RifElementPropertyTableReader::readMetadata(TEST_DATA_DIRECTORY + "ELASTIC_TABLE.inp");
RifElementPropertyTable table;
RifElementPropertyTableReader::readData(&metadata, &table);
EXPECT_TRUE(table.hasData);
EXPECT_EQ(2, metadata.dataColumns.size());
EXPECT_STREQ("MODULUS", metadata.dataColumns[0].toStdString().c_str());
EXPECT_STREQ("RATIO", metadata.dataColumns[1].toStdString().c_str());
EXPECT_EQ(2, table.data.size());
EXPECT_EQ(4320, table.elementIds.size());
EXPECT_EQ(4320, table.data[0].size());
EXPECT_EQ(4320, table.data[1].size());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RicElementPropertyTableReaderTest, ParseFailed)
{
try
{
RifElementPropertyMetadata metadata = RifElementPropertyTableReader::readMetadata(TEST_DATA_DIRECTORY + "ELASTIC_TABLE_error.inp");
RifElementPropertyTable table;
RifElementPropertyTableReader::readData(&metadata, &table);
EXPECT_TRUE(false);
}
catch (FileParseException e)
{
EXPECT_TRUE(e.message.startsWith("Number of columns mismatch"));
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff