summaryrefslogtreecommitdiff
path: root/gerber/tests
diff options
context:
space:
mode:
authorPaulo Henrique Silva <ph.silva@gmail.com>2015-11-13 03:31:32 -0200
committerPaulo Henrique Silva <ph.silva@gmail.com>2015-11-13 03:31:32 -0200
commit9ca75f991a240b0ea233382ff23264a009b0324e (patch)
tree131276ffbead64fb10b1dba8306bdf2f34e195f9 /gerber/tests
parent944c8329222b8c1166a4952df0ca553cbec71505 (diff)
downloadgerbonara-9ca75f991a240b0ea233382ff23264a009b0324e.tar.gz
gerbonara-9ca75f991a240b0ea233382ff23264a009b0324e.tar.bz2
gerbonara-9ca75f991a240b0ea233382ff23264a009b0324e.zip
Improve Excellon parsing coverage
Add some not so used codes that were generating unknown stmt.
Diffstat (limited to 'gerber/tests')
-rw-r--r--gerber/tests/test_excellon_statements.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/gerber/tests/test_excellon_statements.py b/gerber/tests/test_excellon_statements.py
index 1e8ef91..2f0ef10 100644
--- a/gerber/tests/test_excellon_statements.py
+++ b/gerber/tests/test_excellon_statements.py
@@ -123,6 +123,28 @@ def test_toolselection_dump():
stmt = ToolSelectionStmt.from_excellon(line)
assert_equal(stmt.to_excellon(), line)
+def test_z_axis_infeed_rate_factory():
+ """ Test ZAxisInfeedRateStmt factory method
+ """
+ stmt = ZAxisInfeedRateStmt.from_excellon('F01')
+ assert_equal(stmt.rate, 1)
+ stmt = ZAxisInfeedRateStmt.from_excellon('F2')
+ assert_equal(stmt.rate, 2)
+ stmt = ZAxisInfeedRateStmt.from_excellon('F03')
+ assert_equal(stmt.rate, 3)
+
+def test_z_axis_infeed_rate_dump():
+ """ Test ZAxisInfeedRateStmt to_excellon()
+ """
+ inputs = [
+ ('F01', 'F01'),
+ ('F2', 'F02'),
+ ('F00003', 'F03')
+ ]
+ for input_rate, expected_output in inputs:
+ stmt = ZAxisInfeedRateStmt.from_excellon(input_rate)
+ assert_equal(stmt.to_excellon(), expected_output)
+
def test_coordinatestmt_factory():
""" Test CoordinateStmt factory method
"""
@@ -323,6 +345,30 @@ def test_rewindstop_stmt():
stmt = RewindStopStmt()
assert_equal(stmt.to_excellon(None), '%')
+def test_z_axis_rout_position_stmt():
+ stmt = ZAxisRoutPositionStmt()
+ assert_equal(stmt.to_excellon(None), 'M15')
+
+def test_retract_with_clamping_stmt():
+ stmt = RetractWithClampingStmt()
+ assert_equal(stmt.to_excellon(None), 'M16')
+
+def test_retract_without_clamping_stmt():
+ stmt = RetractWithoutClampingStmt()
+ assert_equal(stmt.to_excellon(None), 'M17')
+
+def test_cutter_compensation_off_stmt():
+ stmt = CutterCompensationOffStmt()
+ assert_equal(stmt.to_excellon(None), 'G40')
+
+def test_cutter_compensation_left_stmt():
+ stmt = CutterCompensationLeftStmt()
+ assert_equal(stmt.to_excellon(None), 'G41')
+
+def test_cutter_compensation_right_stmt():
+ stmt = CutterCompensationRightStmt()
+ assert_equal(stmt.to_excellon(None), 'G42')
+
def test_endofprogramstmt_factory():
settings = FileSettings(units='inch')
stmt = EndOfProgramStmt.from_excellon('M30X01Y02', settings)
@@ -579,6 +625,10 @@ def test_routemode_stmt():
stmt = RouteModeStmt()
assert_equal(stmt.to_excellon(FileSettings()), 'G00')
+def test_linearmode_stmt():
+ stmt = LinearModeStmt()
+ assert_equal(stmt.to_excellon(FileSettings()), 'G01')
+
def test_drillmode_stmt():
stmt = DrillModeStmt()
assert_equal(stmt.to_excellon(FileSettings()), 'G05')