feat(back-end): db connections and other stuff
This commit is contained in:
@@ -52,6 +52,26 @@ class GCodeParserTest {
|
||||
assertEquals(750, stats.printTimeSeconds()); // 12*60 + 30
|
||||
assertEquals(5.0, stats.filamentWeightGrams(), 0.001);
|
||||
|
||||
tempFile.delete();
|
||||
}
|
||||
@Test
|
||||
void parse_withExtraTextInTimeLine_returnsCorrectStats() throws IOException {
|
||||
// Arrange
|
||||
File tempFile = File.createTempFile("test_extra", ".gcode");
|
||||
try (FileWriter writer = new FileWriter(tempFile)) {
|
||||
writer.write("; generated by OrcaSlicer\n");
|
||||
// Simulate the variation that was causing issues
|
||||
writer.write("; estimated printing time (normal mode) = 1h 2m 3s\n");
|
||||
writer.write("; filament used [g] = 10.5\n");
|
||||
writer.write("; filament used [mm] = 3000.0\n");
|
||||
}
|
||||
|
||||
GCodeParser parser = new GCodeParser();
|
||||
PrintStats stats = parser.parse(tempFile);
|
||||
|
||||
assertEquals(3723L, stats.printTimeSeconds());
|
||||
assertEquals("1h 2m 3s", stats.printTimeFormatted());
|
||||
|
||||
tempFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user