feat(back-end): db connections implemented and created users
This commit is contained in:
@@ -74,4 +74,40 @@ class GCodeParserTest {
|
||||
|
||||
tempFile.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
void parse_colonFormattedTime_returnsCorrectStats() throws IOException {
|
||||
File tempFile = File.createTempFile("test_colon", ".gcode");
|
||||
try (FileWriter writer = new FileWriter(tempFile)) {
|
||||
writer.write("; generated by OrcaSlicer\n");
|
||||
writer.write("; print time: 01:02:03\n");
|
||||
writer.write("; filament used [g] = 7.5\n");
|
||||
}
|
||||
|
||||
GCodeParser parser = new GCodeParser();
|
||||
PrintStats stats = parser.parse(tempFile);
|
||||
|
||||
assertEquals(3723L, stats.printTimeSeconds());
|
||||
assertEquals("01:02:03", stats.printTimeFormatted());
|
||||
|
||||
tempFile.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
void parse_totalEstimatedTimeInline_returnsCorrectStats() throws IOException {
|
||||
File tempFile = File.createTempFile("test_total", ".gcode");
|
||||
try (FileWriter writer = new FileWriter(tempFile)) {
|
||||
writer.write("; generated by OrcaSlicer\n");
|
||||
writer.write("; model printing time: 5m 17s; total estimated time: 5m 21s\n");
|
||||
writer.write("; filament used [g] = 2.0\n");
|
||||
}
|
||||
|
||||
GCodeParser parser = new GCodeParser();
|
||||
PrintStats stats = parser.parse(tempFile);
|
||||
|
||||
assertEquals(321L, stats.printTimeSeconds());
|
||||
assertEquals("5m 21s", stats.printTimeFormatted());
|
||||
|
||||
tempFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user