#2000 Curve Creator : Fix initialization of map, and use std::string

This commit is contained in:
Magne Sjaastad 2017-10-24 14:19:36 +02:00
parent b62d4448d9
commit 95a0c47d1c
4 changed files with 1806 additions and 1786 deletions

View File

@ -31,6 +31,7 @@ ${CEE_CURRENT_LIST_DIR}RigHexIntersectionTools-Test.cpp
${CEE_CURRENT_LIST_DIR}ObservedDataParser-Test.cpp
${CEE_CURRENT_LIST_DIR}EclipseRftReader-Test.cpp
${CEE_CURRENT_LIST_DIR}RicExpressionParser-Test.cpp
${CEE_CURRENT_LIST_DIR}RiuSummaryVectorDescriptionMap-Test
)
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)

View File

@ -0,0 +1,24 @@
#include "gtest/gtest.h"
#include "RiuSummaryVectorDescriptionMap.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RiuSummaryVectorDescriptionMap, TestInit)
{
{
std::string s("SRSFC");
auto test = RiuSummaryVectorDescriptionMap::instance()->fieldInfo(s);
EXPECT_TRUE(test == "Reach brine concentration");
}
{
std::string s("does not exist");
auto test = RiuSummaryVectorDescriptionMap::instance()->fieldInfo(s);
EXPECT_TRUE(test.size() == 0);
}
}

View File

@ -19,20 +19,23 @@
#pragma once
#include <map>
#include <string>
class QString;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RiuSummaryVectorDescriptionMap
{
public:
static RiuSummaryVectorDescriptionMap* instance();
QString fieldInfo(const QString &field);
std::string fieldInfo(const std::string& field);
private:
RiuSummaryVectorDescriptionMap();
void populateFieldToInfoMap();
private:
std::map<QString, QString> m_summaryToDescMap;
std::map<std::string, std::string> m_summaryToDescMap;
};