Import LinuxCNC source tree
This commit is contained in:
20
tests/interp/return-value/expected
Normal file
20
tests/interp/return-value/expected
Normal file
@@ -0,0 +1,20 @@
|
||||
N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
|
||||
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
N..... SET_XY_ROTATION(0.0000)
|
||||
N..... SET_FEED_REFERENCE(CANON_XYZ)
|
||||
N..... ON_RESET()
|
||||
N..... MESSAGE("line 6.000000: _value: - expected 0.000000, got 0.000000")
|
||||
N..... MESSAGE("line 28.000000: call with arg1=2.000000 expect 246.000000, got 246.000000")
|
||||
N..... MESSAGE("line 37.000000: call with arg1=-1.000000 expect 0.000000, got 0.000000")
|
||||
N..... MESSAGE("line 47.000000: call with arg1=0.000000 expect 4712.000000, got 4712.000000")
|
||||
N..... MESSAGE("line 53.000000: _value=4712.000000 - expected 4712.000000")
|
||||
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
N..... SET_XY_ROTATION(0.0000)
|
||||
N..... SET_FEED_MODE(0, 0)
|
||||
N..... SET_FEED_RATE(0.0000)
|
||||
N..... STOP_SPINDLE_TURNING(0)
|
||||
N..... SET_SPINDLE_MODE(0 0.0000)
|
||||
N..... PROGRAM_END()
|
||||
N..... ON_RESET()
|
||||
N..... ON_RESET()
|
||||
55
tests/interp/return-value/test.ngc
Normal file
55
tests/interp/return-value/test.ngc
Normal file
@@ -0,0 +1,55 @@
|
||||
; test that #<_value> is accessible and is 0
|
||||
|
||||
; test for proper initialization of #<_value> if program is re-run
|
||||
; see note at end of program
|
||||
#<expect> = 0
|
||||
(debug,line #<_line>: _value: - expected #<expect>, got #<_value>)
|
||||
o200 if [#<_value> NE 0]
|
||||
(debug, fail: _value=#<_value> - expecting 0)
|
||||
o200 endif
|
||||
|
||||
|
||||
o1000 sub
|
||||
o1010 if [#1 GT 0]
|
||||
o1010 return [123*[#1]]
|
||||
o1010 endif
|
||||
|
||||
o1020 if [#1 LT 0]
|
||||
o1020 return
|
||||
o1020 endif
|
||||
|
||||
o1000 endsub [4712]
|
||||
|
||||
|
||||
; test returning value via 'return'
|
||||
#<arg> = 2
|
||||
#<expect> = 246
|
||||
o1000 call [#<arg>]
|
||||
(debug,line #<_line>: call with arg1=#<arg> expect #<expect>, got #<_value>)
|
||||
o3000 if [#<_value> NE #<expect>]
|
||||
(debug,line #<_line>: 'return' return value=#<_value> - expected #<expect>)
|
||||
o3000 endif
|
||||
|
||||
; test returning no value at all - plain old style 'return'
|
||||
#<arg> = -1
|
||||
#<expect> = 0
|
||||
o1000 call [#<arg>]
|
||||
(debug,line #<_line>: call with arg1=#<arg> expect #<expect>, got #<_value>)
|
||||
o4000 if [#<_value> NE #<expect>]
|
||||
(debug,line #<_line>: 'plain return' return value=#<_value> - expected #<expect>)
|
||||
o4000 endif
|
||||
|
||||
|
||||
; test returning value via 'endsub'
|
||||
#<arg> = 0
|
||||
#<expect> = 4712
|
||||
o1000 call [#<arg>]
|
||||
(debug,line #<_line>: call with arg1=#<arg> expect #<expect>, got #<_value>)
|
||||
o2000 if [#<_value> NE #<expect>]
|
||||
(debug,line #<_line>: 'endsub' return value=#<_value> - expected #<expect>)
|
||||
o2000 endif
|
||||
|
||||
; note #<_value> is 4712 at this point.
|
||||
(debug,line #<_line>: _value=#<_value> - expected #<expect>)
|
||||
|
||||
m2
|
||||
3
tests/interp/return-value/test.sh
Normal file
3
tests/interp/return-value/test.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
rs274 -g test.ngc | awk '{$1=""; print}'
|
||||
exit "${PIPESTATUS[0]}"
|
||||
Reference in New Issue
Block a user