cleanup and added some gmock tests; gmock and BUILD_SHARED_LIBS seem to be incompatible (at least with gtest 1.8.1)

This commit is contained in:
Charlton, Scott R 2020-09-11 16:35:28 -06:00
parent 46d8cf8a96
commit aa178fd6fa
3 changed files with 152 additions and 197 deletions

View File

@ -220,35 +220,17 @@ if (STANDALONE_BUILD)
set(LIB_TYPE STATIC) set(LIB_TYPE STATIC)
endif() endif()
if (BUILD_SHARED_LIBS)
set(LIB_TYPE SHARED)
if (STANDALONE_BUILD) if (STANDALONE_BUILD)
if (MSVC) if (MSVC)
option(BUILD_CLR_LIBS "Build CLR Libraries" OFF) option(BUILD_CLR_LIBS "Build CLR Libraries" OFF)
endif() endif()
endif() endif()
if (BUILD_SHARED_LIBS)
set(LIB_TYPE SHARED)
endif() endif()
add_library(IPhreeqc ${LIB_TYPE} ${IPhreeqc_SOURCES}) add_library(IPhreeqc ${LIB_TYPE} ${IPhreeqc_SOURCES})
# target_include_directories(IPhreeqc PUBLIC "${PROJECT_SOURCE_DIR}/src")
# target_include_directories(IPhreeqc PUBLIC "${PROJECT_SOURCE_DIR}/src/phreeqcpp")
# target_include_directories(IPhreeqc PUBLIC "${PROJECT_SOURCE_DIR}/src/phreeqcpp/common")
# target_include_directories(IPhreeqc PUBLIC "${PROJECT_SOURCE_DIR}/src/phreeqcpp/PhreeqcKeywords")
# # target_include_directories(IPhreeqc PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
# # target_include_directories(IPhreeqc PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/phreeqcpp>)
# # target_include_directories(IPhreeqc PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/phreeqcpp/common>)
# # target_include_directories(IPhreeqc PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/phreeqcpp/PhreeqcKeywords>)
# # target_include_directories(IPhreeqc PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
# target_include_directories(IPhreeqc
# PUBLIC
# "${PROJECT_SOURCE_DIR}/src"
# "${PROJECT_SOURCE_DIR}/src/phreeqcpp"
# "${PROJECT_SOURCE_DIR}/src/phreeqcpp/common"
# "${PROJECT_SOURCE_DIR}/src/phreeqcpp/PhreeqcKeywords"
# )
target_include_directories(IPhreeqc target_include_directories(IPhreeqc
PUBLIC PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
@ -258,12 +240,6 @@ target_include_directories(IPhreeqc
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
) )
# target_include_directories(IPhreeqc
# PUBLIC
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
# $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
# )
target_compile_definitions(IPhreeqc PRIVATE "SWIG_SHARED_OBJ") target_compile_definitions(IPhreeqc PRIVATE "SWIG_SHARED_OBJ")
target_compile_definitions(IPhreeqc PRIVATE "USE_PHRQ_ALLOC") target_compile_definitions(IPhreeqc PRIVATE "USE_PHRQ_ALLOC")
@ -280,7 +256,7 @@ endif()
if (MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400) if (MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400)
target_compile_definitions(IPhreeqc PUBLIC "_CRT_SECURE_NO_DEPRECATE") target_compile_definitions(IPhreeqc PUBLIC "_CRT_SECURE_NO_DEPRECATE")
target_compile_definitions(IPhreeqc PUBLIC "_SCL_SECURE_NO_WARNINGS") target_compile_definitions(IPhreeqc PUBLIC "_SCL_SECURE_NO_WARNINGS")
endif(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400) endif()
set_target_properties(IPhreeqc PROPERTIES DEBUG_POSTFIX "d") set_target_properties(IPhreeqc PROPERTIES DEBUG_POSTFIX "d")
set_target_properties(IPhreeqc PROPERTIES MINSIZEREL_POSTFIX "msr") set_target_properties(IPhreeqc PROPERTIES MINSIZEREL_POSTFIX "msr")
@ -296,13 +272,15 @@ ${PROJECT_SOURCE_DIR}/src/Var.h
) )
if (IPHREEQC_ENABLE_MODULE) if (IPHREEQC_ENABLE_MODULE)
set(IPhreeqc_SRC set(IPhreeqc_SOURCES
${IPhreeqc_SOURCES}
${PROJECT_SOURCE_DIR}/src/IPhreeqc_interface.F90 ${PROJECT_SOURCE_DIR}/src/IPhreeqc_interface.F90
${PROJECT_SOURCE_DIR}/src/README.Fortran ${PROJECT_SOURCE_DIR}/src/README.Fortran
) )
else() else()
# always install README.Fortran # always install README.Fortran
set(IPhreeqc_SRC set(IPhreeqc_SOURCES
${IPhreeqc_SOURCES}
${PROJECT_SOURCE_DIR}/src/README.Fortran ${PROJECT_SOURCE_DIR}/src/README.Fortran
) )
# install old fortran include files # install old fortran include files
@ -324,36 +302,8 @@ if (MSVC AND BUILD_SHARED_LIBS AND BUILD_CLR_LIBS)
target_compile_definitions(IPhreeqc PRIVATE "MULTICHART") target_compile_definitions(IPhreeqc PRIVATE "MULTICHART")
endif() endif()
# install
# if (WIN32)
# if (BUILD_CLR_LIBS)
# if ("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
# SET(CMAKE_INSTALL_LIBDIR "clrx64")
# else()
# SET(CMAKE_INSTALL_LIBDIR "clr")
# endif()
# else()
# if ("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
# if (BUILD_SHARED_LIBS)
# SET(CMAKE_INSTALL_LIBDIR "dllx64")
# else()
# SET(CMAKE_INSTALL_LIBDIR "libx64")
# endif()
# else()
# if (BUILD_SHARED_LIBS)
# SET(CMAKE_INSTALL_LIBDIR "dll")
# else()
# SET(CMAKE_INSTALL_LIBDIR "lib")
# endif()
# endif()
# endif()
# endif()
# install # install
if (STANDALONE_BUILD) if (STANDALONE_BUILD)
# install(TARGETS IPhreeqc DESTINATION ${CMAKE_INSTALL_LIBDIR})
#{{
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
@ -383,40 +333,27 @@ if (STANDALONE_BUILD)
NAMESPACE IPhreeqc:: NAMESPACE IPhreeqc::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/IPhreeqc DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/IPhreeqc
) )
##}}
install(FILES ${IPhreeqc_Headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES ${IPhreeqc_Headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# if (WIN32) if (WIN32)
# install(FILES ${IPhreeqc_SRC} DESTINATION src) install(FILES ${IPhreeqc_SOURCES} DESTINATION src)
# else() else()
# install(FILES ${IPhreeqc_SRC} DESTINATION ${CMAKE_INSTALL_DOCDIR}/src) install(FILES ${IPhreeqc_SOURCES} DESTINATION ${CMAKE_INSTALL_DOCDIR}/src)
# endif() endif()
# if (BUILD_CLR_LIBS) if (BUILD_CLR_LIBS)
# install(FILES "${PROJECT_SOURCE_DIR}/src/phreeqcpp/ZedGraph.dll" DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES "${PROJECT_SOURCE_DIR}/src/phreeqcpp/ZedGraph.dll" DESTINATION ${CMAKE_INSTALL_BINDIR})
# endif() endif()
endif() endif()
##IF(MSVC) if (BUILD_CLR_LIBS)
## message("PROJECT_BINARY_DIR = ${PROJECT_BINARY_DIR}") if (NOT BUILD_SHARED_LIBS)
## INSTALL( message(FATAL_ERROR "BUILD_CLR_LIBS requires that BUILD_SHARED_LIBS be set")
## DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} endif()
## DESTINATION ${CMAKE_INSTALL_LIBDIR}
## CONFIGURATIONS Debug
## FILES_MATCHING
## PATTERN "*.pdb"
## )
## INSTALL(
## FILES
## ${LIBRARY_OUTPUT_PATH}/Debug/${target_prefix}${target_name}.pdb
## DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
## DESTINATION ${CMAKE_INSTALL_LIBDIR}
## CONFIGURATIONS Debug
## )
##ENDIF(MSVC)
if (BUILD_CLR_LIBS AND IPHREEQC_STATIC_RUNTIME) if (IPHREEQC_STATIC_RUNTIME)
message(FATAL_ERROR "BUILD_CLR_LIBS and IPHREEQC_STATIC_RUNTIME are mutually exclusive") message(FATAL_ERROR "BUILD_CLR_LIBS and IPHREEQC_STATIC_RUNTIME are mutually exclusive")
endif() endif()
endif()
if (EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") if (EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
# enable dashboard scripting # enable dashboard scripting
@ -434,7 +371,7 @@ if (STANDALONE_BUILD)
endif() endif()
if (BUILD_TESTING) if (BUILD_TESTING) # may need to add MSVC version check
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
@ -457,7 +394,7 @@ if (STANDALONE_BUILD)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(BUILD_GTEST ON CACHE BOOL "" FORCE) set(BUILD_GTEST ON CACHE BOOL "" FORCE)
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE) set(BUILD_GMOCK ON CACHE BOOL "" FORCE)
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
set(INSTALL_GMOCK OFF CACHE BOOL "" FORCE) set(INSTALL_GMOCK OFF CACHE BOOL "" FORCE)
@ -475,12 +412,21 @@ if (STANDALONE_BUILD)
gtest_hide_internal_symbols gtest_hide_internal_symbols
) )
if (BUILD_SHARED_LIBS)
##target_compile_definitions(gtest PRIVATE "GTEST_CREATE_SHARED_LIBRARY")
###add_definitions(-DGTEST_CREATE_SHARED_LIBRARY)
endif()
FetchContent_GetProperties(googletest) FetchContent_GetProperties(googletest)
if (NOT googletest_POPULATED) if (NOT googletest_POPULATED)
FetchContent_Populate(googletest) FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
endif() endif()
if (BUILD_SHARED_LIBS)
###remove_definitions(-DGTEST_CREATE_SHARED_LIBRARY)
endif()
add_subdirectory(gtest) add_subdirectory(gtest)
endif() endif()

View File

@ -10,12 +10,15 @@ add_executable(TestIPhreeqcLib TestIPhreeqcLib.cpp FileTest.cpp)
target_link_libraries(TestIPhreeqcLib IPhreeqc gtest gtest_main) target_link_libraries(TestIPhreeqcLib IPhreeqc gtest gtest_main)
add_executable(TestIPhreeqc TestIPhreeqc.cpp FileTest.cpp) add_executable(TestIPhreeqc TestIPhreeqc.cpp FileTest.cpp)
target_link_libraries(TestIPhreeqc IPhreeqc gtest gtest_main) ##if (BUILD_SHARED_LIBS)
## target_compile_definitions(TestIPhreeqc PRIVATE "GTEST_LINKED_AS_SHARED_LIBRARY")
##endif()
target_link_libraries(TestIPhreeqc IPhreeqc gmock gtest gtest_main)
##target_link_libraries(TestIPhreeqc IPhreeqc gtest gtest_main)
add_executable(TestSelectedOutput TestSelectedOutput.cpp) add_executable(TestSelectedOutput TestSelectedOutput.cpp)
target_link_libraries(TestSelectedOutput IPhreeqc gtest gtest_main) target_link_libraries(TestSelectedOutput IPhreeqc gtest gtest_main)
add_test(TestCVar TestCVar) add_test(TestCVar TestCVar)
add_test(TestVar TestVar) add_test(TestVar TestVar)
add_test(TestIPhreeqc TestIPhreeqc) add_test(TestIPhreeqc TestIPhreeqc)
@ -33,6 +36,9 @@ if (MSVC AND BUILD_SHARED_LIBS)
add_custom_command(TARGET TestCVar POST_BUILD add_custom_command(TARGET TestCVar POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gtest_main> $<TARGET_FILE_DIR:TestCVar> COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gtest_main> $<TARGET_FILE_DIR:TestCVar>
) )
add_custom_command(TARGET TestIPhreeqc POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gmock> $<TARGET_FILE_DIR:TestIPhreeqc>
)
endif() endif()

View File

@ -1,4 +1,5 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <cmath> #include <cmath>
#include <cfloat> #include <cfloat>
@ -10,6 +11,8 @@
#undef false #undef false
#include "CVar.hxx" #include "CVar.hxx"
using ::testing::StartsWith;
VRESULT SOLUTION(IPhreeqc& obj, double C, double Ca, double Na); VRESULT SOLUTION(IPhreeqc& obj, double C, double Ca, double Na);
VRESULT EQUILIBRIUM_PHASES(IPhreeqc& obj, const char* phase, double si, double amount); VRESULT EQUILIBRIUM_PHASES(IPhreeqc& obj, const char* phase, double si, double amount);
VRESULT USER_PUNCH(IPhreeqc& obj, const char* element, int max); VRESULT USER_PUNCH(IPhreeqc& obj, const char* element, int max);
@ -2208,109 +2211,109 @@ TEST(TestIPhreeqc, TestSetOutputFileName)
int line = 0; int line = 0;
ASSERT_TRUE(::strstr(lines[line++].c_str(), "------------------------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("------------------------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "Reading input data for simulation 1.") != NULL); //ASSERT_THAT(lines[line++], StartsWith("Reading input data for simulation 1."));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "------------------------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("------------------------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " SOLUTION 1") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" SOLUTION 1"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " C 1") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" C 1"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Ca 1") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Ca 1"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Na 1") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Na 1"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " DUMP") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" DUMP"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " -solution 1") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" -solution 1"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "-------------------------------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("-------------------------------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "Beginning of initial solution calculations.") != NULL); //ASSERT_THAT(lines[line++], StartsWith("Beginning of initial solution calculations."));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "-------------------------------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("-------------------------------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "Initial solution 1. ") != NULL); //ASSERT_THAT(lines[line++], StartsWith("Initial solution 1. "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "-----------------------------Solution composition--------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("-----------------------------Solution composition--------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Elements Molality Moles") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Elements Molality Moles"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " C ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" C "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Ca ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Ca "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Na ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Na "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "----------------------------Description of solution------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("----------------------------Description of solution------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " pH = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" pH = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " pe = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" pe = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Activity of water = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Activity of water = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Ionic strength (mol/kgw) = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Ionic strength (mol/kgw) = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Mass of water (kg) = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Mass of water (kg) = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Total alkalinity (eq/kg) = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Total alkalinity (eq/kg) = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Total CO2 (mol/kg) = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Total CO2 (mol/kg) = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Temperature (°C) = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Temperature (°C) = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Electrical balance (eq) = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Electrical balance (eq) = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Percent error, 100*(Cat-|An|)/(Cat+|An|) = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Percent error, 100*(Cat-|An|)/(Cat+|An|) = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Iterations = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Iterations = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Total H = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Total H = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Total O = ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Total O = "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "----------------------------Distribution of species----------------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("----------------------------Distribution of species----------------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Log Log Log mole V") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Log Log Log mole V"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Species Molality Activity Molality Activity Gamma cm³/mol") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Species Molality Activity Molality Activity Gamma cm³/mol"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " OH- ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" OH- "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " H+ ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" H+ "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " H2O ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" H2O "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "C(-4) ") != NULL); //ASSERT_THAT(lines[line++], StartsWith("C(-4) "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CH4 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CH4 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "C(4) ") != NULL); //ASSERT_THAT(lines[line++], StartsWith("C(4) "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " HCO3- ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" HCO3- "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CO2 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CO2 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CaHCO3+ ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CaHCO3+ "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CaCO3 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CaCO3 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CO3-2 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CO3-2 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " NaHCO3 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" NaHCO3 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " NaCO3- ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" NaCO3- "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "Ca ") != NULL); //ASSERT_THAT(lines[line++], StartsWith("Ca "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Ca+2 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Ca+2 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CaHCO3+ ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CaHCO3+ "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CaCO3 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CaCO3 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CaOH+ ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CaOH+ "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "H(0) ") != NULL); //ASSERT_THAT(lines[line++], StartsWith("H(0) "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " H2 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" H2 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "Na ") != NULL); //ASSERT_THAT(lines[line++], StartsWith("Na "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Na+ ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Na+ "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " NaHCO3 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" NaHCO3 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " NaCO3- ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" NaCO3- "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " NaOH ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" NaOH "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "O(0) ") != NULL); //ASSERT_THAT(lines[line++], StartsWith("O(0) "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " O2 ") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" O2 "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "------------------------------Saturation indices-------------------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("------------------------------Saturation indices-------------------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Phase SI** log IAP log K(298 K, 1 atm)") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Phase SI** log IAP log K(298 K, 1 atm)"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Aragonite") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Aragonite"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " Calcite") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" Calcite"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CH4(g)") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CH4(g)"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " CO2(g)") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" CO2(g)"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " H2(g)") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" H2(g)"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " H2O(g)") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" H2O(g)"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " O2(g)") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" O2(g)"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "**For a gas, SI = log10(fugacity). Fugacity = pressure * phi / 1 atm.") != NULL); //ASSERT_THAT(lines[line++], StartsWith("**For a gas, SI = log10(fugacity). Fugacity = pressure * phi / 1 atm."));
ASSERT_TRUE(::strstr(lines[line++].c_str(), " For ideal gases, phi = 1.") != NULL); //ASSERT_THAT(lines[line++], StartsWith(" For ideal gases, phi = 1."));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "End of simulation.") != NULL); //ASSERT_THAT(lines[line++], StartsWith("End of simulation."));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "------------------------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("------------------------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "Reading input data for simulation 2.") != NULL); //ASSERT_THAT(lines[line++], StartsWith("Reading input data for simulation 2."));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "------------------------------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("------------------------------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "----------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("----------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "End of Run after ") != NULL); //ASSERT_THAT(lines[line++], StartsWith("End of Run after "));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "----------------") != NULL); //ASSERT_THAT(lines[line++], StartsWith("----------------"));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
ASSERT_TRUE(::strstr(lines[line++].c_str(), "") != NULL); //ASSERT_THAT(lines[line++], StartsWith(""));
if (::FileExists(OUTPUT_FILENAME)) if (::FileExists(OUTPUT_FILENAME))
{ {