Lots of work on status representation
This commit is contained in:
+23
-1
@@ -1,6 +1,8 @@
|
||||
#include "grbl.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "grbl.h"
|
||||
#include "machine.h"
|
||||
|
||||
TEST(grbl_program, default_state) {
|
||||
grbl::program pgm;
|
||||
|
||||
@@ -25,4 +27,24 @@ X3.87739 Y78.52820
|
||||
EXPECT_EQ("", pgm.filename);
|
||||
EXPECT_EQ(6, pgm.number_of_instructions());
|
||||
EXPECT_EQ(true, pgm.is_loaded);
|
||||
}
|
||||
|
||||
TEST(grbl_status_report, parse) {
|
||||
auto content = "<Idle|MPos:0.000,1.000,2.000|Bf:35,1022|FS:0,0|Pn:Z|Ov:100,100,100>";
|
||||
grbl::realtime_status_report r;
|
||||
grbl::parse_status_report(content, r);
|
||||
|
||||
EXPECT_EQ(grbl::machine_status::idle, r.status);
|
||||
EXPECT_EQ("", r.sub_status);
|
||||
|
||||
EXPECT_EQ(0, r.machine_pos[0]);
|
||||
EXPECT_EQ(1, r.machine_pos[1]);
|
||||
EXPECT_EQ(2, r.machine_pos[2]);
|
||||
|
||||
EXPECT_EQ(35, r.buffers_free);
|
||||
|
||||
//
|
||||
grbl::parse_status_report("<Home|MPos:0.000,0.000,0.000|Bf:35,1022|FS:0,0|Pn:Z|Ov:100,100,100>", r);
|
||||
EXPECT_EQ(grbl::machine_status::home, r.status);
|
||||
EXPECT_EQ(1022, r.rx_chars_free);
|
||||
}
|
||||
Reference in New Issue
Block a user