more test coverage for utils::bounds()
This commit is contained in:
@ -91,6 +91,10 @@ TEST_F(AdvancedUtils, bounds_int_fail)
|
|||||||
utils::bounds(FLERR, "?", -10, 5, nlo, nhi, error););
|
utils::bounds(FLERR, "?", -10, 5, nlo, nhi, error););
|
||||||
TEST_FAILURE("ERROR: Invalid range string: 3\\*:2 ",
|
TEST_FAILURE("ERROR: Invalid range string: 3\\*:2 ",
|
||||||
utils::bounds(FLERR, "3*:2", -10, 5, nlo, nhi, error););
|
utils::bounds(FLERR, "3*:2", -10, 5, nlo, nhi, error););
|
||||||
|
TEST_FAILURE("ERROR: Numeric index 1 is out of bounds \\(5-6\\).*",
|
||||||
|
utils::bounds(FLERR, "1*4", 5, 6, nlo, nhi, error););
|
||||||
|
TEST_FAILURE("ERROR: Numeric index 4 is out of bounds \\(1-3\\).*",
|
||||||
|
utils::bounds(FLERR, "1*4", 1, 3, nlo, nhi, error););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AdvancedUtils, bounds_bigint_fail)
|
TEST_F(AdvancedUtils, bounds_bigint_fail)
|
||||||
@ -108,6 +112,10 @@ TEST_F(AdvancedUtils, bounds_bigint_fail)
|
|||||||
utils::bounds(FLERR, "?", -10, 5, nlo, nhi, error););
|
utils::bounds(FLERR, "?", -10, 5, nlo, nhi, error););
|
||||||
TEST_FAILURE("ERROR: Invalid range string: 3\\*:2 ",
|
TEST_FAILURE("ERROR: Invalid range string: 3\\*:2 ",
|
||||||
utils::bounds(FLERR, "3*:2", -10, 5, nlo, nhi, error););
|
utils::bounds(FLERR, "3*:2", -10, 5, nlo, nhi, error););
|
||||||
|
TEST_FAILURE("ERROR: Numeric index 1 is out of bounds \\(5-6\\).*",
|
||||||
|
utils::bounds(FLERR, "1*4", 5, 6, nlo, nhi, error););
|
||||||
|
TEST_FAILURE("ERROR: Numeric index 4 is out of bounds \\(1-3\\).*",
|
||||||
|
utils::bounds(FLERR, "1*4", 1, 3, nlo, nhi, error););
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AdvancedUtils, expand_args)
|
TEST_F(AdvancedUtils, expand_args)
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
#include "lmptype.h"
|
#include "lmptype.h"
|
||||||
#include "pointers.h"
|
#include "pointers.h"
|
||||||
#include "tokenizer.h"
|
#include "tokenizer.h"
|
||||||
@ -989,6 +990,16 @@ TEST(Utils, boundsbig_case3)
|
|||||||
ASSERT_EQ(nhi, -1);
|
ASSERT_EQ(nhi, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Utils, bounds_typelabel_forward)
|
||||||
|
{
|
||||||
|
int nlo, nhi;
|
||||||
|
|
||||||
|
nlo = nhi = -1;
|
||||||
|
utils::bounds_typelabel(FLERR, "2*9", 0, 10, nlo, nhi, nullptr, Atom::ATOM);
|
||||||
|
ASSERT_EQ(nlo, 2);
|
||||||
|
ASSERT_EQ(nhi, 9);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Utils, parse_grid_id)
|
TEST(Utils, parse_grid_id)
|
||||||
{
|
{
|
||||||
auto words = utils::parse_grid_id(FLERR, "c_1:full:density", nullptr);
|
auto words = utils::parse_grid_id(FLERR, "c_1:full:density", nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user