mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#434) Added unit tests for NRLib/well
This commit is contained in:
parent
68662d2968
commit
f4df58006c
3
ThirdParty/NRLib/CMakeLists.txt
vendored
3
ThirdParty/NRLib/CMakeLists.txt
vendored
@ -27,3 +27,6 @@ add_library( ${PROJECT_NAME}
|
||||
${NRLIB_IOTOOLS_SRC}
|
||||
${NRLIB_WELL_SRC}
|
||||
)
|
||||
|
||||
add_subdirectory(well_UnitTests)
|
||||
|
||||
|
10431
ThirdParty/NRLib/well_UnitTests/Bean_A.las
vendored
Normal file
10431
ThirdParty/NRLib/well_UnitTests/Bean_A.las
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10331
ThirdParty/NRLib/well_UnitTests/Bean_B.las
vendored
Normal file
10331
ThirdParty/NRLib/well_UnitTests/Bean_B.las
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11231
ThirdParty/NRLib/well_UnitTests/Bean_C.las
vendored
Normal file
11231
ThirdParty/NRLib/well_UnitTests/Bean_C.las
vendored
Normal file
File diff suppressed because it is too large
Load Diff
33
ThirdParty/NRLib/well_UnitTests/CMakeLists.txt
vendored
Normal file
33
ThirdParty/NRLib/well_UnitTests/CMakeLists.txt
vendored
Normal file
@ -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
|
||||
)
|
||||
|
41
ThirdParty/NRLib/well_UnitTests/wellBasicTest.cpp
vendored
Normal file
41
ThirdParty/NRLib/well_UnitTests/wellBasicTest.cpp
vendored
Normal file
@ -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";
|
||||
}
|
||||
}
|
20
ThirdParty/NRLib/well_UnitTests/well_UnitTests.cpp
vendored
Normal file
20
ThirdParty/NRLib/well_UnitTests/well_UnitTests.cpp
vendored
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user