mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 19:43:33 +08:00
ekf2: verbose (DEBUG_BUILD) print status with Matrix improved print
* ekf2: verbose print status * matrix/Matrix improve print output * bold diagonal elements, print ring buffer entry size * print in scientific notation when >= 10 to respect max size --------- Co-authored-by: bresch <brescianimathieu@gmail.com>
This commit is contained in:
@@ -276,14 +276,20 @@ TEST(MatrixAssignmentTest, Assignment)
|
||||
}
|
||||
}
|
||||
|
||||
char print_out[] = " | 0 | 1 \n 0| 1.00000 1.2e+04\n 1| 1.2e+04 0.12346\n 2| 1.2e+10 1.2e+12\n";
|
||||
printf("%s\n", print_out); // for debugging in case of failure
|
||||
|
||||
// check print()
|
||||
// Redirect stdout
|
||||
EXPECT_TRUE(freopen("testoutput.txt", "w", stdout) != NULL);
|
||||
FILE *fp = freopen("testoutput.txt", "w", stdout);
|
||||
EXPECT_NE(fp, nullptr);
|
||||
|
||||
// write
|
||||
Comma.print();
|
||||
fclose(stdout);
|
||||
EXPECT_FALSE(fclose(fp)); // FIXME: this doesn't work as expected, further printf are not redirected to the console
|
||||
|
||||
// read
|
||||
FILE *fp = fopen("testoutput.txt", "r");
|
||||
fp = fopen("testoutput.txt", "r");
|
||||
EXPECT_NE(fp, nullptr);
|
||||
EXPECT_FALSE(fseek(fp, 0, SEEK_SET));
|
||||
|
||||
@@ -294,8 +300,8 @@ TEST(MatrixAssignmentTest, Assignment)
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%d %d %d\n", static_cast<int>(i), output[i], c);
|
||||
EXPECT_EQ(c, output[i]);
|
||||
printf("%d %d %d\n", static_cast<int>(i), print_out[i], c);
|
||||
EXPECT_EQ(c, print_out[i]);
|
||||
}
|
||||
|
||||
EXPECT_FALSE(fclose(fp));
|
||||
|
||||
Reference in New Issue
Block a user