Small tweaks to make Lepton test compile/link with MSVC

This commit is contained in:
Axel Kohlmeyer
2022-12-29 22:22:45 -05:00
parent 6c318b5e8e
commit 064e1abd5b
2 changed files with 5 additions and 7 deletions

View File

@ -20,12 +20,8 @@ target_link_libraries(test_platform PRIVATE lammps GTest::GMockMain)
add_test(NAME Platform COMMAND test_platform)
if(PKG_LEPTON)
get_target_property(LEPTON_DEF lepton COMPILE_DEFINITIONS)
get_target_property(LEPTON_INC lepton INCLUDE_DIRECTORIES)
add_executable(test_lepton test_lepton.cpp)
target_link_libraries(test_lepton PRIVATE lammps GTest::GMockMain)
target_compile_definitions(test_lepton PRIVATE ${LEPTON_DEF})
target_include_directories(test_lepton PRIVATE ${LEPTON_INC})
target_link_libraries(test_lepton PRIVATE lepton lammps GTest::GMockMain)
add_test(NAME Lepton COMMAND test_lepton)
endif()

View File

@ -39,8 +39,10 @@ protected:
testbinary = "LeptonUtilsTest";
args = {"-log", "none", "-echo", "screen", "-nocite", "-v", "num", "1"};
LAMMPSTest::SetUp();
BEGIN_HIDE_OUTPUT();
command("region box block 0 1 0 1 0 1");
command("create_box 1 box");
END_HIDE_OUTPUT();
variable = lmp->input->variable;
}
};
@ -68,7 +70,7 @@ TEST_F(LeptonUtilsTest, substitute)
ASSERT_THAT(LeptonUtils::substitute("v_num", lmp), StrEq("1"));
ASSERT_THAT(LeptonUtils::substitute("eps*v_val1*k", lmp), StrEq("eps*100.0*k"));
ASSERT_THAT(LeptonUtils::substitute("(2.5/v_pre)", lmp), StrEq("(2.5/0)"));
lmp->update->reset_timestep(100, false);
lmp->update->reset_timestep(100LL, false);
ASSERT_THAT(LeptonUtils::substitute("(2.5/v_pre)", lmp), StrEq("(2.5/0.1)"));
if (LAMMPS_NS::Info::has_exceptions()) {
@ -240,7 +242,7 @@ void verifyInvalidExpression(const std::string &expression)
if (verbose) std::cout << "Checking invalid expression: " << expression << "\n";
try {
Lepton::Parser::parse(expression);
} catch (const std::exception &ex) {
} catch (const std::exception &) {
return;
}
throw std::exception();