Changeset View
Changeset View
Standalone View
Standalone View
unittests/gcodetests.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 62 | { | |||
---|---|---|---|---|---|
63 | QVERIFY(GCode::toCommand(GCode::G2) == GCode::commandNotSupported); | 63 | QVERIFY(GCode::toCommand(GCode::G2) == GCode::commandNotSupported); | ||
64 | } | 64 | } | ||
65 | 65 | | |||
66 | bool GCodeTests::testMCodeNeedsArg(GCode::MCommands code) | 66 | bool GCodeTests::testMCodeNeedsArg(GCode::MCommands code) | ||
67 | { | 67 | { | ||
68 | return GCode::toCommand(code) == GCode::commandRequiresArgument.arg(QStringLiteral("M"), QString::number(code)); | 68 | return GCode::toCommand(code) == GCode::commandRequiresArgument.arg(QStringLiteral("M"), QString::number(code)); | ||
69 | } | 69 | } | ||
70 | 70 | | |||
71 | void GCodeTests::command_M20() | ||||
72 | { | ||||
73 | QVERIFY(GCode::toCommand(GCode::M20) == QStringLiteral("M20")); | ||||
74 | } | ||||
75 | | ||||
76 | void GCodeTests::command_M21() | ||||
77 | { | ||||
78 | QVERIFY(GCode::toCommand(GCode::M21) == QStringLiteral("M21")); | ||||
79 | QVERIFY(GCode::toCommand(GCode::M21, QStringLiteral("2")) == QStringLiteral("M21 P2")); | ||||
80 | } | ||||
81 | | ||||
82 | void GCodeTests::command_M22() | ||||
83 | { | ||||
84 | QVERIFY(GCode::toCommand(GCode::M22) == QStringLiteral("M22")); | ||||
85 | QVERIFY(GCode::toCommand(GCode::M22, QStringLiteral("5")) == QStringLiteral("M22 P5")); | ||||
86 | } | ||||
87 | | ||||
88 | void GCodeTests::command_M23() | ||||
89 | { | ||||
90 | QVERIFY(testMCodeNeedsArg(GCode::M23)); | ||||
91 | QVERIFY(GCode::toCommand(GCode::M23, QStringLiteral("FileName")) == QStringLiteral("M23 FileName")); | ||||
92 | } | ||||
93 | | ||||
94 | void GCodeTests::command_M24() | ||||
95 | { | ||||
96 | QVERIFY(GCode::toCommand(GCode::M24) == QStringLiteral("M24")); | ||||
97 | } | ||||
98 | | ||||
99 | void GCodeTests::command_M25() | ||||
100 | { | ||||
101 | QVERIFY(GCode::toCommand(GCode::M25) == QStringLiteral("M25")); | ||||
102 | } | ||||
103 | | ||||
104 | void GCodeTests::command_M26() | ||||
105 | { | ||||
106 | QVERIFY(testMCodeNeedsArg(GCode::M26)); | ||||
107 | QVERIFY(GCode::toCommand(GCode::M26, QStringLiteral("15%")) == QStringLiteral("M26 P0.15")); | ||||
108 | QVERIFY(GCode::toCommand(GCode::M26, QStringLiteral("15")) == QStringLiteral("M26 S15")); | ||||
109 | | ||||
110 | } | ||||
111 | | ||||
112 | void GCodeTests::command_M27() | ||||
113 | { | ||||
114 | QVERIFY(GCode::toCommand(GCode::M27) == QStringLiteral("M27")); | ||||
115 | } | ||||
116 | | ||||
117 | void GCodeTests::command_M28() | ||||
118 | { | ||||
119 | QVERIFY(testMCodeNeedsArg(GCode::M28)); | ||||
120 | QVERIFY(GCode::toCommand(GCode::M28, QStringLiteral("FileName")) == QStringLiteral("M28 FileName")); | ||||
121 | } | ||||
122 | | ||||
123 | void GCodeTests::command_M29() | ||||
124 | { | ||||
125 | QVERIFY(testMCodeNeedsArg(GCode::M29)); | ||||
126 | QVERIFY(GCode::toCommand(GCode::M29, QStringLiteral("FileName")) == QStringLiteral("M29 FileName")); | ||||
127 | } | ||||
128 | | ||||
129 | void GCodeTests::command_M30() | ||||
130 | { | ||||
131 | QVERIFY(testMCodeNeedsArg(GCode::M30)); | ||||
132 | QVERIFY(GCode::toCommand(GCode::M30, QStringLiteral("FileName")) == QStringLiteral("M30 FileName")); | ||||
133 | } | ||||
134 | | ||||
71 | void GCodeTests::command_M84() | 135 | void GCodeTests::command_M84() | ||
72 | { | 136 | { | ||
73 | QVERIFY(GCode::toCommand(GCode::M84) == QStringLiteral("M84")); | 137 | QVERIFY(GCode::toCommand(GCode::M84) == QStringLiteral("M84")); | ||
74 | QVERIFY(GCode::toCommand(GCode::M84, QStringLiteral("10")) == QStringLiteral("M84 S10")); | 138 | QVERIFY(GCode::toCommand(GCode::M84, QStringLiteral("10")) == QStringLiteral("M84 S10")); | ||
75 | } | 139 | } | ||
76 | 140 | | |||
77 | void GCodeTests::command_M104() | 141 | void GCodeTests::command_M104() | ||
78 | { | 142 | { | ||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |