simplify and make test more specific
This commit is contained in:
@ -678,12 +678,10 @@ void Thermo::modify_params(int narg, char **arg)
|
|||||||
format_int_user.replace(found, 1, std::string(BIGINT_FORMAT).substr(1));
|
format_int_user.replace(found, 1, std::string(BIGINT_FORMAT).substr(1));
|
||||||
} else if (strcmp(arg[iarg + 1], "float") == 0) {
|
} else if (strcmp(arg[iarg + 1], "float") == 0) {
|
||||||
format_float_user = arg[iarg + 2];
|
format_float_user = arg[iarg + 2];
|
||||||
} else if (! utils::is_integer(arg[iarg + 1])
|
} else if (utils::strmatch(arg[iarg + 1], "^\\d*\\*\\d*$")) {
|
||||||
&& utils::is_type(arg[iarg + 1]) == 0) {
|
|
||||||
// handles cases such as 2*6; currently doesn't allow negatives
|
// handles cases such as 2*6; currently doesn't allow negatives
|
||||||
int nlo, nhi;
|
int nlo, nhi;
|
||||||
utils::bounds(FLERR, arg[iarg + 1], 1, nfield_initial, nlo, nhi,
|
utils::bounds(FLERR, arg[iarg + 1], 1, nfield_initial, nlo, nhi, error);
|
||||||
error);
|
|
||||||
int icol = -1;
|
int icol = -1;
|
||||||
for (int i = nlo - 1; i < nhi; i++) {
|
for (int i = nlo - 1; i < nhi; i++) {
|
||||||
if (i < 0) icol = nfield_initial + i + 1; // doesn't happen currently
|
if (i < 0) icol = nfield_initial + i + 1; // doesn't happen currently
|
||||||
|
|||||||
@ -631,6 +631,18 @@ TEST(Utils, strmatch_whitespace_nonwhitespace)
|
|||||||
ASSERT_TRUE(utils::strmatch(" 5.0 angles\n", "^\\s*\\S+\\s+\\S+\\s"));
|
ASSERT_TRUE(utils::strmatch(" 5.0 angles\n", "^\\s*\\S+\\s+\\S+\\s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Utils, strmatch_range)
|
||||||
|
{
|
||||||
|
ASSERT_TRUE(utils::strmatch("*11", "^\\d*\\*\\d*$"));
|
||||||
|
ASSERT_TRUE(utils::strmatch("2*11", "^\\d*\\*\\d*$"));
|
||||||
|
ASSERT_TRUE(utils::strmatch("5*", "^\\d*\\*\\d*$"));
|
||||||
|
ASSERT_TRUE(utils::strmatch("*", "^\\d*\\*\\d*$"));
|
||||||
|
ASSERT_FALSE(utils::strmatch("x5*", "^\\d*\\*\\d*$"));
|
||||||
|
ASSERT_FALSE(utils::strmatch("x*", "^\\d*\\*\\d*$"));
|
||||||
|
ASSERT_FALSE(utils::strmatch("*a", "^\\d*\\*\\d*$"));
|
||||||
|
ASSERT_FALSE(utils::strmatch("1*2d", "^\\d*\\*\\d*$"));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Utils, strfind_beg)
|
TEST(Utils, strfind_beg)
|
||||||
{
|
{
|
||||||
ASSERT_THAT(utils::strfind("rigid/small/omp", "^rigid"), StrEq("rigid"));
|
ASSERT_THAT(utils::strfind("rigid/small/omp", "^rigid"), StrEq("rigid"));
|
||||||
|
|||||||
Reference in New Issue
Block a user