(#434) Added unit tests for NRLib/well

This commit is contained in:
Pål Hagen 2015-09-14 09:02:27 +02:00
parent 68662d2968
commit f4df58006c
7 changed files with 32090 additions and 0 deletions

View File

@ -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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

View 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
)

View 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";
}
}

View 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;
}