Add utils::count_words and utils::trim_comment

This commit is contained in:
Richard Berger
2020-05-15 15:46:38 -04:00
parent 807130c771
commit db46521d64
4 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "utils.h"
#include <string>
using namespace LAMMPS_NS;
using ::testing::Eq;
TEST(Utils, trim_comment) {
auto trimmed = utils::trim_comment("some text # comment");
ASSERT_THAT(trimmed, Eq("some text "));
}
TEST(Utils, count_words) {
ASSERT_EQ(utils::count_words("some text # comment"), 2);
}