diff --git a/unittest/utils/test_fmtlib.cpp b/unittest/utils/test_fmtlib.cpp index f8adf30db4..a3e2d9732b 100644 --- a/unittest/utils/test_fmtlib.cpp +++ b/unittest/utils/test_fmtlib.cpp @@ -16,6 +16,7 @@ #include "gmock/gmock.h" #include "fmt/format.h" #include <string> +#include <exception> using namespace LAMMPS_NS; using ::testing::Eq; @@ -93,3 +94,13 @@ TEST(Fmtlib, insert_neg_double) { auto text = fmt::format("word {}",val); ASSERT_THAT(text, Eq("word -1.5")); } + +TEST(Fmtlib, int_for_double) { + const double val = -1.5; + ASSERT_THROW(fmt::format("word {:d}",val),std::exception); +} + +TEST(Fmtlib, double_for_int) { + const int val = 15; + ASSERT_THROW(fmt::format("word {:g}",val),std::exception); +}