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:
Daniel Agar
2024-01-10 09:46:04 -05:00
committed by GitHub
co-authored by bresch
parent 071565a8ad
commit d45c3d3407
8 changed files with 178 additions and 81 deletions
+11 -5
View File
@@ -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));