Import LinuxCNC source tree
This commit is contained in:
4
tests/interp/value-returned/README
Normal file
4
tests/interp/value-returned/README
Normal file
@@ -0,0 +1,4 @@
|
||||
exercise the _value_returned predicate
|
||||
|
||||
1 if the last o-word function returned a value
|
||||
0 if the last o-word function did not return a value
|
||||
15
tests/interp/value-returned/expected
Normal file
15
tests/interp/value-returned/expected
Normal file
@@ -0,0 +1,15 @@
|
||||
executing
|
||||
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
|
||||
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
4 N..... SET_XY_ROTATION(0.0000)
|
||||
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
|
||||
6 N..... ON_RESET()
|
||||
7 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
8 N..... SET_XY_ROTATION(0.0000)
|
||||
9 N..... SET_FEED_MODE(0, 0)
|
||||
10 N..... SET_FEED_RATE(0.0000)
|
||||
11 N..... STOP_SPINDLE_TURNING(0)
|
||||
12 N..... SET_SPINDLE_MODE(0 0.0000)
|
||||
13 N..... PROGRAM_END()
|
||||
14 N..... ON_RESET()
|
||||
31
tests/interp/value-returned/oword.py
Normal file
31
tests/interp/value-returned/oword.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# This is a component of LinuxCNC
|
||||
# Copyright 2011 Michael Haberler <git@mah.priv.at>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
def nonereturned(self, *args):
|
||||
return None
|
||||
|
||||
def endswithpass(self, *args):
|
||||
pass
|
||||
|
||||
def returns4711(self,*args):
|
||||
return 4711.0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
18
tests/interp/value-returned/subs.py
Normal file
18
tests/interp/value-returned/subs.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# This is a component of LinuxCNC
|
||||
# Copyright 2011 Michael Haberler <git@mah.priv.at>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
import oword
|
||||
11
tests/interp/value-returned/test.ini
Normal file
11
tests/interp/value-returned/test.ini
Normal file
@@ -0,0 +1,11 @@
|
||||
[EMC]
|
||||
DEBUG=0
|
||||
LOG_LEVEL=0
|
||||
|
||||
[PYTHON]
|
||||
PATH_PREPEND=.
|
||||
TOPLEVEL=subs.py
|
||||
LOG_LEVEL=0
|
||||
|
||||
|
||||
|
||||
62
tests/interp/value-returned/test.ngc
Normal file
62
tests/interp/value-returned/test.ngc
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
; return a value via endsub
|
||||
o<function1> sub
|
||||
o<function1> endsub [4711]
|
||||
|
||||
; return a value via return
|
||||
o<function2> sub
|
||||
o100 return [4712]
|
||||
o<function2> endsub
|
||||
|
||||
; a procedure without return value
|
||||
o<proc> sub
|
||||
o<proc> endsub
|
||||
|
||||
;py,from interpreter import *
|
||||
|
||||
;;;py,print this.return_value
|
||||
;;;py,print this.value_returned
|
||||
|
||||
;py,assert equal(this.return_value,0.0)
|
||||
;py,assert this.value_returned == 0
|
||||
|
||||
o<function1> call
|
||||
; make sure they are properly set
|
||||
;py,assert equal(this.return_value,4711.0)
|
||||
;py,assert this.value_returned == 1
|
||||
|
||||
o<proc> call
|
||||
; make sure they are cleared
|
||||
;py,assert equal(this.return_value,0.0)
|
||||
;py,assert this.value_returned == 0
|
||||
|
||||
o<function2> call
|
||||
; make sure they are properly set again
|
||||
;py,assert equal(this.return_value,4712.0)
|
||||
;py,assert this.value_returned == 1
|
||||
|
||||
o<proc> call
|
||||
; make sure they are cleared again
|
||||
;py,assert equal(this.return_value,0.0)
|
||||
;py,assert this.value_returned == 0
|
||||
|
||||
; now the same for Python oword subs
|
||||
o<returns4711> call
|
||||
;py,assert equal(this.return_value,4711.0)
|
||||
;py,assert this.value_returned == 1
|
||||
|
||||
o<nonereturned> call
|
||||
; make sure they are cleared again
|
||||
;;py,assert equal(this.return_value,0.0)
|
||||
;;py,assert this.value_returned == 0
|
||||
|
||||
o<returns4711> call
|
||||
;py,assert equal(this.return_value,4711.0)
|
||||
;py,assert this.value_returned == 1
|
||||
|
||||
o<endswithpass> call
|
||||
; make sure they are cleared again
|
||||
;py,assert equal(this.return_value,0.0)
|
||||
;py,assert this.value_returned == 0
|
||||
|
||||
m2
|
||||
2
tests/interp/value-returned/test.sh
Executable file
2
tests/interp/value-returned/test.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
exec rs274 -i test.ini -n 0 -g test.ngc 2>&1
|
||||
Reference in New Issue
Block a user