update unit tests for variable command
This commit is contained in:
@ -170,7 +170,8 @@ void Variable::set(int narg, char **arg)
|
|||||||
// doesn't matter if variable no longer exists
|
// doesn't matter if variable no longer exists
|
||||||
|
|
||||||
if (strcmp(arg[1],"delete") == 0) {
|
if (strcmp(arg[1],"delete") == 0) {
|
||||||
if (narg != 2) error->all(FLERR,"Illegal variable command: expected 2 argument but found {}", narg);
|
if (narg != 2)
|
||||||
|
error->all(FLERR,"Illegal variable delete command: expected 2 arguments but found {}", narg);
|
||||||
if (find(arg[0]) >= 0) remove(find(arg[0]));
|
if (find(arg[0]) >= 0) remove(find(arg[0]));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -197,11 +197,11 @@ TEST_F(VariableTest, CreateDelete)
|
|||||||
ASSERT_EQ(variable->internalstyle(variable->find("ten")), 1);
|
ASSERT_EQ(variable->internalstyle(variable->find("ten")), 1);
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable"););
|
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable"););
|
||||||
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy index"););
|
TEST_FAILURE(".*ERROR: Illegal variable index command.*", command("variable dummy index"););
|
||||||
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy delete xxx"););
|
TEST_FAILURE(".*ERROR: Illegal variable delete command: expected 2 arguments but found 3.*", command("variable dummy delete xxx"););
|
||||||
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy loop -1"););
|
TEST_FAILURE(".*ERROR: Invalid variable loop argument: -1.*", command("variable dummy loop -1"););
|
||||||
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy loop 10 1"););
|
TEST_FAILURE(".*ERROR: Illegal variable loop command.*", command("variable dummy loop 10 1"););
|
||||||
TEST_FAILURE(".*ERROR: Illegal variable command.*", command("variable dummy xxxx"););
|
TEST_FAILURE(".*ERROR: Unknown variable keyword: xxx.*", command("variable dummy xxxx"););
|
||||||
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
|
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
|
||||||
command("variable two string xxx"););
|
command("variable two string xxx"););
|
||||||
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
|
TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*",
|
||||||
|
|||||||
Reference in New Issue
Block a user