summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.py2
-rw-r--r--tests/expects/RS2724x_offset.gtl14
-rw-r--r--tests/expects/RS2724x_rotate.gtl38
-rw-r--r--tests/expects/RS2724x_save.gtl14
-rw-r--r--tests/expects/RS2724x_to_inch.gtl14
-rw-r--r--tests/expects/RS2724x_to_metric.gtl14
-rw-r--r--tests/test_am_expression.py49
7 files changed, 73 insertions, 72 deletions
diff --git a/setup.py b/setup.py
index 6c42e5b..21341b4 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ def read(fname):
METADATA = {
'name': 'pcb-tools-extension',
- 'version': "0.1.5",
+ 'version': "0.1.6",
'author': 'Hiroshi Murayama <opiopan@gmail.com>',
'author_email': "opiopan@gmail.com",
'description': ("Extension for pcb-tools package to panelize gerber files"),
diff --git a/tests/expects/RS2724x_offset.gtl b/tests/expects/RS2724x_offset.gtl
index 9f15f4c..f54e85b 100644
--- a/tests/expects/RS2724x_offset.gtl
+++ b/tests/expects/RS2724x_offset.gtl
@@ -3,13 +3,13 @@
%INTop Layer*%
%IPPOS*%
%AMCOMP*
-20,1,0.2,0,0.1,0.4,0.1,$1*
-21,1,0.4,0.2,-0.2,-0.1,$1*
-1,1,0.4,-1.2,0,$1*
-4,1,4,1.2,0,1.4,-0.2,1.2,-0.4,1,-0.2,1.2,0,$1*
-5,1,6,1.2,0.2,0.4,$1*
-6,-0.7,0,0.5,0.05,0.15,2,0.05,0.6,$1*
-7,0.7,0,0.6,0.5,0.15,$1*%
+20,1,0.200000,0.000000,0.100000,0.400000,0.100000,$1*
+21,1,0.400000,0.200000,-0.200000,-0.100000,$1*
+1,1,0.400000,-1.200000,0.000000,$1*
+4,1,4,1.200000,0.000000,1.400000,-0.200000,1.200000,-0.400000,1.000000,-0.200000,1.200000,0.000000,$1*
+5,1,6.000000,1.200000,0.200000,0.400000,$1*
+6,-0.700000,0.000000,0.500000,0.050000,0.150000,2.000000,0.050000,0.600000,$1*
+7,0.700000,0.000000,0.600000,0.500000,0.150000,$1*%
%ADD10C,0.01*%
%ADD11C,1X0.4*%
%ADD12R,1X0.5X0.2*%
diff --git a/tests/expects/RS2724x_rotate.gtl b/tests/expects/RS2724x_rotate.gtl
index 0a2d1aa..9401fa7 100644
--- a/tests/expects/RS2724x_rotate.gtl
+++ b/tests/expects/RS2724x_rotate.gtl
@@ -3,33 +3,33 @@
%INTop Layer*%
%IPPOS*%
%AMCOMP*
-20,1,0.2,0,0.1,0.4,0.1,($1)+(20)*
-21,1,0.4,0.2,-0.2,-0.1,($1)+(20)*
-1,1,0.4,-1.2,0,($1)+(20)*
-4,1,4,1.2,0,1.4,-0.2,1.2,-0.4,1,-0.2,1.2,0,($1)+(20)*
-5,1,6,1.2,0.2,0.4,($1)+(20)*
-6,-0.7,0,0.5,0.05,0.15,2,0.05,0.6,($1)+(20)*
-7,0.7,0,0.6,0.5,0.15,($1)+(20)*%
+20,1,0.200000,0.000000,0.100000,0.400000,0.100000,($1)+(20.000000)*
+21,1,0.400000,0.200000,-0.200000,-0.100000,($1)+(20.000000)*
+1,1,0.400000,-1.200000,0.000000,($1)+(20.000000)*
+4,1,4,1.200000,0.000000,1.400000,-0.200000,1.200000,-0.400000,1.000000,-0.200000,1.200000,0.000000,($1)+(20.000000)*
+5,1,6.000000,1.200000,0.200000,0.400000,($1)+(20.000000)*
+6,-0.700000,0.000000,0.500000,0.050000,0.150000,2.000000,0.050000,0.600000,($1)+(20.000000)*
+7,0.700000,0.000000,0.600000,0.500000,0.150000,($1)+(20.000000)*%
%AMMACP*
-5,1,$2,0,0,$1,($3)+(20)*
-1,0,$4,0,0,20*%
+5,1,$2,0.000000,0.000000,$1,($3)+(20.000000)*
+1,0,$4,0.000000,0.000000,20.000000*%
%AMMACPO*
$4=($2)-($1)*
$5=($2)-($4)*
-21,1,$1,$5,0,0,20*
-1,1,$4,0,($4)/(2),20*
-1,1,$4,0,($4)/(-2),20*
-1,0,$3,0,0,20*%
+21,1,$1,$5,0.000000,0.000000,20.000000*
+1,1,$4,0.000000,($4)/(2.000000),20.000000*
+1,1,$4,0.000000,($4)/(-2.000000),20.000000*
+1,0,$3,0.000000,0.000000,20.000000*%
%AMMACLO*
$4=($1)-($2)*
$5=($1)-($4)*
-21,1,$5,$2,0,0,20*
-1,1,$4,($4)/(2),0,20*
-1,1,$4,($4)/(-2),0,20*
-1,0,$3,0,0,20*%
+21,1,$5,$2,0.000000,0.000000,20.000000*
+1,1,$4,($4)/(2.000000),0.000000,20.000000*
+1,1,$4,($4)/(-2.000000),0.000000,20.000000*
+1,0,$3,0.000000,0.000000,20.000000*%
%AMMACR*
-21,1,$1,$2,0,0,20*
-1,0,$3,0,0,20*%
+21,1,$1,$2,0.000000,0.000000,20.000000*
+1,0,$3,0.000000,0.000000,20.000000*%
%ADD10C,0.01*%
%ADD11C,1X0.4*%
%ADD12MACR,1X0.5X0.2*%
diff --git a/tests/expects/RS2724x_save.gtl b/tests/expects/RS2724x_save.gtl
index 02dbaa8..45841e8 100644
--- a/tests/expects/RS2724x_save.gtl
+++ b/tests/expects/RS2724x_save.gtl
@@ -3,13 +3,13 @@
%INTop Layer*%
%IPPOS*%
%AMCOMP*
-20,1,0.2,0,0.1,0.4,0.1,$1*
-21,1,0.4,0.2,-0.2,-0.1,$1*
-1,1,0.4,-1.2,0,$1*
-4,1,4,1.2,0,1.4,-0.2,1.2,-0.4,1,-0.2,1.2,0,$1*
-5,1,6,1.2,0.2,0.4,$1*
-6,-0.7,0,0.5,0.05,0.15,2,0.05,0.6,$1*
-7,0.7,0,0.6,0.5,0.15,$1*%
+20,1,0.200000,0.000000,0.100000,0.400000,0.100000,$1*
+21,1,0.400000,0.200000,-0.200000,-0.100000,$1*
+1,1,0.400000,-1.200000,0.000000,$1*
+4,1,4,1.200000,0.000000,1.400000,-0.200000,1.200000,-0.400000,1.000000,-0.200000,1.200000,0.000000,$1*
+5,1,6.000000,1.200000,0.200000,0.400000,$1*
+6,-0.700000,0.000000,0.500000,0.050000,0.150000,2.000000,0.050000,0.600000,$1*
+7,0.700000,0.000000,0.600000,0.500000,0.150000,$1*%
%ADD10C,0.01*%
%ADD11C,1X0.4*%
%ADD12R,1X0.5X0.2*%
diff --git a/tests/expects/RS2724x_to_inch.gtl b/tests/expects/RS2724x_to_inch.gtl
index 3ec60d8..36bc604 100644
--- a/tests/expects/RS2724x_to_inch.gtl
+++ b/tests/expects/RS2724x_to_inch.gtl
@@ -3,13 +3,13 @@
%INTop Layer*%
%IPPOS*%
%AMCOMP*
-20,1,0.00787402,0,0.00393701,0.015748,0.00393701,$1*
-21,1,0.015748,0.00787402,-0.00787402,-0.00393701,$1*
-1,1,0.015748,-0.0472441,0,$1*
-4,1,4,0.0472441,0,0.0551181,-0.00787402,0.0472441,-0.015748,0.0393701,-0.00787402,0.0472441,0,$1*
-5,1,6,0.0472441,0.00787402,0.015748,$1*
-6,-0.0275591,0,0.019685,0.0019685,0.00590551,2,0.0019685,0.023622,$1*
-7,0.0275591,0,0.023622,0.019685,0.00590551,$1*%
+20,1,0.007874,0.000000,0.003937,0.015748,0.003937,$1*
+21,1,0.015748,0.007874,-0.007874,-0.003937,$1*
+1,1,0.015748,-0.047244,0.000000,$1*
+4,1,4,0.047244,0.000000,0.055118,-0.007874,0.047244,-0.015748,0.039370,-0.007874,0.047244,0.000000,$1*
+5,1,6.000000,0.047244,0.007874,0.015748,$1*
+6,-0.027559,0.000000,0.019685,0.001969,0.005906,2.000000,0.001969,0.023622,$1*
+7,0.027559,0.000000,0.023622,0.019685,0.005906,$1*%
%ADD10C,0.0003937*%
%ADD11C,0.03937X0.01575*%
%ADD12R,0.03937X0.01969X0.007874*%
diff --git a/tests/expects/RS2724x_to_metric.gtl b/tests/expects/RS2724x_to_metric.gtl
index 93adfc1..72464f3 100644
--- a/tests/expects/RS2724x_to_metric.gtl
+++ b/tests/expects/RS2724x_to_metric.gtl
@@ -3,13 +3,13 @@
%INTop Layer*%
%IPPOS*%
%AMCOMP*
-20,1,0.2,0,0.1,0.399999,0.1,$1*
-21,1,0.399999,0.2,-0.2,-0.1,$1*
-1,1,0.399999,-1.2,0,$1*
-4,1,4,1.2,0,1.4,-0.2,1.2,-0.399999,1,-0.2,1.2,0,$1*
-5,1,6,1.2,0.2,0.399999,$1*
-6,-0.700001,0,0.499999,0.0499999,0.15,2,0.0499999,0.599999,$1*
-7,0.700001,0,0.599999,0.499999,0.15,$1*%
+20,1,0.200000,0.000000,0.100000,0.399999,0.100000,$1*
+21,1,0.399999,0.200000,-0.200000,-0.100000,$1*
+1,1,0.399999,-1.200000,0.000000,$1*
+4,1,4,1.200000,0.000000,1.400000,-0.200000,1.200000,-0.399999,1.000001,-0.200000,1.200000,0.000000,$1*
+5,1,6.000000,1.200000,0.200000,0.399999,$1*
+6,-0.700001,0.000000,0.499999,0.050000,0.150000,2.000000,0.050000,0.599999,$1*
+7,0.700001,0.000000,0.599999,0.499999,0.150000,$1*%
%ADD10C,0.01*%
%ADD11C,1X0.4*%
%ADD12R,1X0.5001X0.2*%
diff --git a/tests/test_am_expression.py b/tests/test_am_expression.py
index 6786cc3..0f064e6 100644
--- a/tests/test_am_expression.py
+++ b/tests/test_am_expression.py
@@ -27,8 +27,8 @@ class TestAMConstantExpression(unittest.TestCase):
self.assertEqual(ov.value, self.const_float_value)
def test_to_gerber(self):
- self.assertEqual(self.const_int.to_gerber(), '7')
- self.assertEqual(self.const_float.to_gerber(), '1.2345')
+ self.assertEqual(self.const_int.to_gerber(), '7.000000')
+ self.assertEqual(self.const_float.to_gerber(), '1.234500')
def test_to_instructions(self):
self.const_int.to_instructions()
@@ -120,15 +120,15 @@ class TestAMOperatorExpression(unittest.TestCase):
def test_to_gerber(self):
for op, expression in self.cc_exps:
self.assertEqual(expression.to_gerber(),
- '({0}){1}({2})'.format(self.c1, op, self.c2))
+ '(%.6f)%s(%.6f)' % (self.c1, op, self.c2))
for op, expression in self.cv_exps:
self.assertEqual(expression.to_gerber(),
- '({0}){1}(${2})'.format(self.c1, op, self.v2))
+ '(%.6f)%s($%d)' % (self.c1, op, self.v2))
for op, expression in self.vc_exps:
self.assertEqual(expression.to_gerber(),
- '(${0}){1}({2})'.format(self.v1, op, self.c2))
+ '($%d)%s(%.6f)' % (self.v1, op, self.c2))
self.assertEqual(self.composition.to_gerber(),
- '(({0})+({1}))+(({2})+({3}))'.format(
+ '((%.6f)+(%.6f))+((%.6f)+(%.6f))' % (
self.c1, self.c2, self.c1, self.c2
))
@@ -168,28 +168,29 @@ class TestAMExpression(unittest.TestCase):
class TestEvalMacro(unittest.TestCase):
def test_eval_macro(self):
macros = [
- '$1=5.5*',
- '$2=$3*',
- '$3=(1.23)+(4.56)*',
- '$3=(1.23)-(4.56)*',
- '$3=(1.23)X(4.56)*',
- '$3=(1.23)/(4.56)*',
- '$3=(10.2)X($2)*',
- '1,1.2*',
- '1,$2*',
- '1,($2)+($3)*',
- #'1,(2.0)-($3)*', # This doesn't pass due to pcb-tools bug
- '1,($2)X($3)*',
- '1,($2)/($3)*',
- '1,2.1,3.2*2,(3.1)/($1),$2*'
+ ('$1=5.5*', '$1=5.500000*'),
+ ('$1=0.0000001*', '$1=0.000000*'),
+ ('$2=$3*', '$2=$3*'),
+ ('$3=(1.23)+(4.56)*', '$3=(1.230000)+(4.560000)*'),
+ ('$3=(1.23)-(4.56)*', '$3=(1.230000)-(4.560000)*'),
+ ('$3=(1.23)X(4.56)*', '$3=(1.230000)X(4.560000)*'),
+ ('$3=(1.23)/(4.56)*', '$3=(1.230000)/(4.560000)*'),
+ ('$3=(10.2)X($2)*', '$3=(10.200000)X($2)*'),
+ ('1,1.2*', '1,1.200000*'),
+ ('1,$2*', '1,$2*'),
+ ('1,($2)+($3)*', '1,($2)+($3)*'),
+ #('1,(2.0)-($3)*', '1,(2.0)-($3)*'), # This doesn't pass due to pcb-tools bug
+ ('1,($2)X($3)*', '1,($2)X($3)*'),
+ ('1,($2)/($3)*', '1,($2)/($3)*'),
+ ('1,2.1,3.2*2,(3.1)/($1),$2*', '1,2.100000,3.200000*2,(3.100000)/($1),$2*'),
]
- for macro in macros:
- self._eval_macro_string(macro)
+ for macro, expected in macros:
+ self._eval_macro_string(macro, expected)
- def _eval_macro_string(self, macro):
+ def _eval_macro_string(self, macro, expected):
expressions = eval_macro(read_macro(macro))
gerber = self._to_gerber(expressions)
- self.assertEqual(macro, gerber)
+ self.assertEqual(gerber, expected)
def _to_gerber(self, expressions_list):
gerber = ''