mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 08:25:03 -05:00
(#434) Added unit tests for NRLib/well
This commit is contained in:
1 parent
68662d2968
commit
f4df58006c
7 files changed
+32090
No files matched your search
Vendored
+3
@@ -27,3 +27,6 @@ add_library( ${PROJECT_NAME}
|
||||
${NRLIB_IOTOOLS_SRC}
|
||||
${NRLIB_WELL_SRC}
|
||||
)
|
||||
|
||||
add_subdirectory(well_UnitTests)
|
||||
|
||||
+10431
File diff suppressed because it is too large.
Load diff
+10331
File diff suppressed because it is too large.
Load diff
+11231
File diff suppressed because it is too large.
Load diff
+33
@@ -0,0 +1,33 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
project ( well_UnitTests )
|
||||
|
||||
|
||||
include_directories (
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
|
||||
${NR_well_SOURCE_DIR}
|
||||
)
|
||||
|
||||
|
||||
set( PROJECT_FILES
|
||||
|
||||
well_UnitTests.cpp
|
||||
../../gtest/gtest-all.cc
|
||||
|
||||
wellBasicTest.cpp
|
||||
)
|
||||
|
||||
# add the executable
|
||||
add_executable (${PROJECT_NAME}
|
||||
${PROJECT_FILES}
|
||||
)
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
target_link_libraries ( ${PROJECT_NAME}
|
||||
NRLib
|
||||
)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "well.hpp"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(WellBaseTest, ReadFromFile)
|
||||
{
|
||||
std::string wellName = "C:/dev/projects/ResInsight/GitHub/NRWellProject/well_UnitTests/Bean_A.las";
|
||||
|
||||
int wellFormat = NRLib::Well::LAS;
|
||||
NRLib::Well* well = NRLib::Well::ReadWell(wellName, wellFormat);
|
||||
|
||||
std::cout << "Well name : " << well->GetWellName() << "\n";
|
||||
|
||||
std::cout << "Total number of logs : " << well->GetNlog() << "\n";
|
||||
|
||||
const std::map<std::string, std::vector<double> >& continuousLogs = well->GetContLog();
|
||||
|
||||
std::cout << "Continuous log names : " << "\n";
|
||||
|
||||
std::vector<std::string> names;
|
||||
std::map<std::string, std::vector<double> >::const_iterator it;
|
||||
for (it = continuousLogs.begin(); it != continuousLogs.end(); it++)
|
||||
{
|
||||
std::cout << " " << it->first << "data value count : " << it->second.size() << "\n";
|
||||
names.push_back(it->first);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < 20; i++)
|
||||
{
|
||||
for (size_t n = 0; n < names.size(); n++)
|
||||
{
|
||||
std::cout << "\t" << continuousLogs.at(names[n])[i];
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
int result = RUN_ALL_TESTS();
|
||||
|
||||
char text[5];
|
||||
std::cin.getline(text, 5);
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in new issue
Block a user