refactor loops using (auto var : container) syntax
This commit is contained in:
@ -54,14 +54,14 @@ TEST_F(LibraryCommands, from_file)
|
||||
const char cont_file[] = "in.cont";
|
||||
|
||||
fp = fopen(demo_file, "w");
|
||||
for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) {
|
||||
fputs(demo_input[i], fp);
|
||||
for (auto & inp : demo_input) {
|
||||
fputs(inp, fp);
|
||||
fputc('\n', fp);
|
||||
}
|
||||
fclose(fp);
|
||||
fp = fopen(cont_file, "w");
|
||||
for (unsigned int i = 0; i < sizeof(cont_input) / sizeof(char *); ++i) {
|
||||
fputs(cont_input[i], fp);
|
||||
for (auto & inp : cont_input) {
|
||||
fputs(inp, fp);
|
||||
fputc('\n', fp);
|
||||
}
|
||||
fclose(fp);
|
||||
@ -84,8 +84,8 @@ TEST_F(LibraryCommands, from_line)
|
||||
{
|
||||
EXPECT_EQ(lammps_get_natoms(lmp), 0);
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) {
|
||||
lammps_command(lmp, demo_input[i]);
|
||||
for (auto & inp : demo_input) {
|
||||
lammps_command(lmp, inp);
|
||||
}
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(lammps_get_natoms(lmp), 1);
|
||||
@ -105,12 +105,12 @@ TEST_F(LibraryCommands, from_string)
|
||||
{
|
||||
std::string cmds("");
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) {
|
||||
cmds += demo_input[i];
|
||||
for (auto & inp : demo_input) {
|
||||
cmds += inp;
|
||||
cmds += "\n";
|
||||
}
|
||||
for (unsigned int i = 0; i < sizeof(cont_input) / sizeof(char *); ++i) {
|
||||
cmds += cont_input[i];
|
||||
for (auto & inp : cont_input) {
|
||||
cmds += inp;
|
||||
cmds += "\n";
|
||||
}
|
||||
EXPECT_EQ(lammps_get_natoms(lmp), 0);
|
||||
@ -125,12 +125,12 @@ TEST_F(LibraryCommands, from_string)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
|
||||
cmds.clear();
|
||||
for (unsigned int i = 0; i < sizeof(demo_input) / sizeof(char *); ++i) {
|
||||
cmds += demo_input[i];
|
||||
for (auto & inp : demo_input) {
|
||||
cmds += inp;
|
||||
cmds += "\r\n";
|
||||
}
|
||||
for (unsigned int i = 0; i < sizeof(cont_input) / sizeof(char *); ++i) {
|
||||
cmds += cont_input[i];
|
||||
for (auto & inp : cont_input) {
|
||||
cmds += inp;
|
||||
cmds += "\r\n";
|
||||
}
|
||||
EXPECT_EQ(lammps_get_natoms(lmp), 0);
|
||||
|
||||
Reference in New Issue
Block a user