diff --git a/ApplicationCode/UnitTests/CMakeLists_files.cmake b/ApplicationCode/UnitTests/CMakeLists_files.cmake index 7744bd48bf..c979307ca3 100644 --- a/ApplicationCode/UnitTests/CMakeLists_files.cmake +++ b/ApplicationCode/UnitTests/CMakeLists_files.cmake @@ -40,7 +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 +${CEE_CURRENT_LIST_DIR}RifElementPropertyTableReader-Test.cpp ) if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES) diff --git a/ApplicationCode/UnitTests/RicElementPropertyTableReader-Test.cpp b/ApplicationCode/UnitTests/RicElementPropertyTableReader-Test.cpp index cc19c06c12..6d4d42080b 100644 --- a/ApplicationCode/UnitTests/RicElementPropertyTableReader-Test.cpp +++ b/ApplicationCode/UnitTests/RicElementPropertyTableReader-Test.cpp @@ -8,7 +8,7 @@ #include -static const QString TEST_DATA_DIRECTORY = QString("%1/ElementPropertyTable/").arg(TEST_DATA_DIR); +static const QString TEST_DATA_DIRECTORY = QString("%1/RifElementPropertyTableReader/").arg(TEST_DATA_DIR); //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationCode/UnitTests/RifElementPropertyTableReader-Test.cpp b/ApplicationCode/UnitTests/RifElementPropertyTableReader-Test.cpp new file mode 100644 index 0000000000..6d4d42080b --- /dev/null +++ b/ApplicationCode/UnitTests/RifElementPropertyTableReader-Test.cpp @@ -0,0 +1,53 @@ +#include "gtest/gtest.h" + +#include "RiaTestDataDirectory.h" + +#include "RifElementPropertyTableReader.h" + +#include +#include + + +static const QString TEST_DATA_DIRECTORY = QString("%1/RifElementPropertyTableReader/").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")); + } +} diff --git a/ApplicationCode/UnitTests/TestData/ElementPropertyTable/ELASTIC_TABLE.inp b/ApplicationCode/UnitTests/TestData/RifElementPropertyTableReader/ELASTIC_TABLE.inp similarity index 100% rename from ApplicationCode/UnitTests/TestData/ElementPropertyTable/ELASTIC_TABLE.inp rename to ApplicationCode/UnitTests/TestData/RifElementPropertyTableReader/ELASTIC_TABLE.inp diff --git a/ApplicationCode/UnitTests/TestData/ElementPropertyTable/ELASTIC_TABLE_error.inp b/ApplicationCode/UnitTests/TestData/RifElementPropertyTableReader/ELASTIC_TABLE_error.inp similarity index 100% rename from ApplicationCode/UnitTests/TestData/ElementPropertyTable/ELASTIC_TABLE_error.inp rename to ApplicationCode/UnitTests/TestData/RifElementPropertyTableReader/ELASTIC_TABLE_error.inp