STK. - Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > STK. - Stack >

STK. - Commands

Testscript for STK.

Previous Top Next


MiniRobotLanguage (MRL)

 

Testscript for STK.

You can see Samples how STK. - works

 

 

'================================================================================

' Test Script for STK Commands

'================================================================================

'-----------------------------------------------------------

$$MSG=(1) Test STK.New with default type

STK.New|$$STK

JIZ.$$STK|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(2) Test STK.New with String type

STK.New|$$STK|s

JIZ.$$STK|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(3) Test STK.New with Integer type

STK.New|$$STK|i

JIZ.$$STK|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(4) Test STK.New with Float type

STK.New|$$STK|f

JIZ.$$STK|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(5) Test STK.Validate with valid handle

STK.New|$$STK

STK.Validate|$$STK|$$RES

JIV.$$RES!1|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(6) Test STK.Validate with invalid handle

STK.New|$$STK

STK.End|$$STK

STK.Validate|$$STK|$$RES

JIV.$$RES!0|Lab_failed

'-----------------------------------------------------------

$$MSG=(7) Test STK.Clear

STK.New|$$STK

STK.Push|$$STK|Hello

STK.Clear|$$STK

STK.Count|$$STK|$$RES

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(8) Test STK.Count

STK.New|$$STK

STK.Push|$$STK|Hello

STK.Push|$$STK|World

STK.Count|$$STK|$$RES

JIV.$$RES!2|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(9) Test STK.Push with String type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Count|$$STK|$$RES

JIV.$$RES!1|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(10) Test STK.Push with Integer type

STK.New|$$STK|i

STK.Push|$$STK|123

STK.Count|$$STK|$$RES

JIV.$$RES!1|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(11) Test STK.Push with Float type

STK.New|$$STK|f

STK.Push|$$STK|3.14

STK.Count|$$STK|$$RES

JIV.$$RES!1|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(12) Test STK.Peek with String type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Peek|$$STK|$$RES

JIS.$$RES!Hello|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(13) Test STK.Peek with Integer type

STK.New|$$STK|i

STK.Push|$$STK|123

STK.Peek|$$STK|$$RES

JIV.$$RES!123|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(14) Test STK.Peek with Float type

STK.New|$$STK|f

STK.Push|$$STK|3.14

STK.Peek|$$STK|$$RES

JIV.$$RES!3.14|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(15) Test STK.Pop with String type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Pop|$$STK|$$RES

JIS.$$RES!Hello|Lab_failed

STK.Count|$$STK|$$RES

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(16) Test STK.Pop with Integer type

STK.New|$$STK|i

STK.Push|$$STK|123

STK.Pop|$$STK|$$RES

JIV.$$RES!123|Lab_failed

STK.Count|$$STK|$$RES

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(17) Test STK.Pop with Float type

STK.New|$$STK|f

STK.Push|$$STK|3.14

STK.Pop|$$STK|$$RES

JIV.$$RES!3.14|Lab_failed

STK.Count|$$STK|$$RES

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(18) Test STK.Peek with multiple pushes

STK.New|$$STK

STK.Push|$$STK|First

STK.Push|$$STK|Second

STK.Peek|$$STK|$$RES

JIS.$$RES!Second|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(19) Test STK.Pop with multiple pushes

STK.New|$$STK

STK.Push|$$STK|First

STK.Push|$$STK|Second

STK.Pop|$$STK|$$RES

JIS.$$RES!Second|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!First|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(20) Test STK.End

STK.New|$$STK

STK.End|$$STK

STK.Validate|$$STK|$$RES

JIV.$$RES!0|Lab_failed

'-----------------------------------------------------------

$$MSG=(21) Test STK.GetType

STK.New|$$STK|s

STK.GetType|$$STK|$$RES

' 1 corresponds to String type

JIV.$$RES!1|Lab_failed  

STK.End|$$STK

 

STK.New|$$STK|i

STK.GetType|$$STK|$$RES

' 2 corresponds to Integer type

JIV.$$RES!2|Lab_failed  

STK.End|$$STK

 

STK.New|$$STK|f

STK.GetType|$$STK|$$RES

' 3 corresponds to Float type

JIV.$$RES!3|Lab_failed  

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(22) Test STK.Push with multiple data types (mixed)

STK.New|$$STK

STK.Push|$$STK|Hello

STK.Push|$$STK|123

STK.Push|$$STK|3.14

STK.Count|$$STK|$$RES

JIV.$$RES!3|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(23) Test STK.Peek on an empty stack

STK.New|$$STK

STK.Peek|$$STK|$$RES

JIS.$$RES|Lab_failed  

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(24) Test STK.Pop on an empty stack

STK.New|$$STK

STK.Pop|$$STK|$$RES

JIS.$$RES|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(25) Test STK.Clear on an empty stack

STK.New|$$STK

STK.Clear|$$STK

STK.Count|$$STK|$$RES

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(26) Test STK.Push with very large integer

STK.New|$$STK|i

STK.Push|$$STK|999999999999

STK.Peek|$$STK|$$RES

JIV.$$RES!999999999999|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(27) Test STK.Push with very small float

STK.New|$$STK|f

STK.Push|$$STK|0.000000000000001

STK.Peek|$$STK|$$RES

JIV.$$RES!0.000000000000001|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(28) Test STK.Push with empty string

STK.New|$$STK|s

STK.Push|$$STK|

STK.Peek|$$STK|$$RES

JIS.$$RES!|Lab_failed  ' Should return empty string

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(29) Test STK.Push with special characters

STK.New|$$STK|s

STK.Push|$$STK|!@#$%^&*()

STK.Peek|$$STK|$$RES

JIS.$$RES!!@#$%^&*()|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(30) Test STK.Push with long string

STK.New|$$STK|s

STK.Push|$$STK|ThisIsAVeryLongStringToTestStackFunctionality

STK.Peek|$$STK|$$RES

JIS.$$RES!ThisIsAVeryLongStringToTestStackFunctionality|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(31) Test STK.Pop after multiple pushes and pops

STK.New|$$STK

STK.Push|$$STK|First

STK.Push|$$STK|Second

STK.Pop|$$STK|$$RES

JIS.$$RES!Second|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!First|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(32) Test STK.Peek after multiple pushes

STK.New|$$STK

STK.Push|$$STK|First

STK.Push|$$STK|Second

STK.Peek|$$STK|$$RES

JIS.$$RES!Second|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(33) Test STK.Count after multiple pops

STK.New|$$STK

STK.Push|$$STK|First

STK.Push|$$STK|Second

STK.Pop|$$STK|$$RES

STK.Count|$$STK|$$RES

JIV.$$RES!1|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(34) Test STK.Validate after STK.End

STK.New|$$STK

STK.End|$$STK

STK.Validate|$$STK|$$RES

JIV.$$RES!0|Lab_failed

'-----------------------------------------------------------

$$MSG=(35) Test STK.Push with negative integer

STK.New|$$STK|i

STK.Push|$$STK|-123

STK.Peek|$$STK|$$RES

JIV.$$RES!-123|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(36) Test STK.Push with negative float

STK.New|$$STK|f

STK.Push|$$STK|-3.14

STK.Peek|$$STK|$$RES

JIV.$$RES!-3.14|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(37) Test STK.Push with zero

STK.New|$$STK|i

STK.Push|$$STK|0

STK.Peek|$$STK|$$RES

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(38) Test STK.Push with zero float

STK.New|$$STK|f

STK.Push|$$STK|0.0

STK.Peek|$$STK|$$RES

JIV.$$RES!0.0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(39) Test STK.Push and STK.Pop with alternating operations

STK.New|$$STK

STK.Push|$$STK|First

STK.Pop|$$STK|$$RES

JIS.$$RES!First|Lab_failed

STK.Push|$$STK|Second

STK.Pop|$$STK|$$RES

JIS.$$RES!Second|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

 

 

'-----------------------------------------------------------

$$MSG=(42) Test STK.Import with String type and default delimiter

STK.New|$$STK|s

$$STR=Hello;World;Test

STK.Import|$$STK|$$STR|;

STK.Count|$$STK|$$RES

JIV.$$RES!3|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Test|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!World|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Hello|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(43) Test STK.Import with Integer type and custom delimiter

STK.New|$$STK|i

$$STR=123;456;789

STK.Import|$$STK|$$STR|;

STK.Count|$$STK|$$RES

JIV.$$RES!3|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!789|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!456|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!123|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(44) Test STK.Import with Float type and custom delimiter

STK.New|$$STK|f

$$STR=1.23,4.56,7.89

STK.Import|$$STK|$$STR|,

STK.Count|$$STK|$$RES

JIV.$$RES!3|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!7.89|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!4.56|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(45) Test STK.Import with empty string

STK.New|$$STK|s

$$STR=

STK.Import|$$STK|$$STR

STK.Count|$$STK|$$RES

STK.Show|$$STK

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(46) Test STK.Export with String type and default delimiter

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Push|$$STK|World

STK.Push|$$STK|Test

STK.Export|$$STK|;|$$STR

JIS.$$STR!Hello;World;Test|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(47) Test STK.Export with Integer type and custom delimiter

STK.New|$$STK|i

STK.Push|$$STK|123

STK.Push|$$STK|456

STK.Push|$$STK|789

STK.Reverse|$$STK

STK.Export|$$STK|;|$$STR

JIS.$$STR!789;456;123|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(48) Test STK.Export with Float type and custom delimiter

STK.New|$$STK|f

STK.Push|$$STK|1.23

STK.Push|$$STK|4.56

STK.Push|$$STK|7.89

STK.Reverse|$$STK

STK.Export|$$STK|,|$$STR

JIS.$$STR!7.89,4.56,1.23|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(49) Test STK.Export with empty stack

STK.New|$$STK|s

STK.Export|$$STK||$$STR

JIS.$$STR!|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(50) Test STK.GetType with String type

STK.New|$$STK|s

STK.GetType|$$STK|$$RES

JIV.$$RES!1|Lab_failed 

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(51) Test STK.GetType with Integer type

STK.New|$$STK|i

STK.GetType|$$STK|$$RES

JIV.$$RES!2|Lab_failed 

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(52) Test STK.GetType with Float type

STK.New|$$STK|f

STK.GetType|$$STK|$$RES

JIV.$$RES!3|Lab_failed 

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(53) Test STK.GetType with invalid handle

STK.New|$$STK

STK.End|$$STK

STK.GetType|$$STK|$$RES

JIV.$$RES!0|Lab_failed 

'-----------------------------------------------------------

'-----------------------------------------------------------

$$MSG=(54) Test STK.Clear with String type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Push|$$STK|World

STK.Clear|$$STK

STK.Count|$$STK|$$RES

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(55) Test STK.Validate with valid handle

STK.New|$$STK|s

STK.Validate|$$STK|$$RES

JIV.$$RES!1|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(56) Test STK.Validate with invalid handle

STK.New|$$STK|s

STK.EndAll|$$STK

STK.Validate|$$STK|$$RES

JIV.$$RES!0|Lab_failed

'-----------------------------------------------------------

$$MSG=(57) Test STK.Peek with String type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Push|$$STK|World

STK.Peek|$$STK|$$RES

JIS.$$RES!World|Lab_failed

STK.Count|$$STK|$$RES

JIV.$$RES!2|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(58) Test STK.Add with Integer type

STK.New|$$STK|i

STK.Push|$$STK|10

STK.Push|$$STK|20

STK.Push|$$STK|30

STK.Add|$$STK|3

STK.Pop|$$STK|$$RES

JIV.$$RES!60|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(59) Test STK.Dup with Float type

STK.New|$$STK|f

STK.Push|$$STK|1.23

STK.Dup|$$STK|2

STK.Count|$$STK|$$RES

JIV.$$RES!3|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(60) Test STK.Swap with String type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Push|$$STK|World

STK.Swap|$$STK

STK.Pop|$$STK|$$RES

JIS.$$RES!Hello|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!World|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(61) Test STK.Swapx with Integer type

STK.New|$$STK|i

STK.Push|$$STK|10

STK.Push|$$STK|20

STK.Push|$$STK|30

STK.Push|$$STK|40

STK.Push|$$STK|50

STK.Push|$$STK|60

STK.Swapx|$$STK|1|5

STK.Pop|$$STK|$$RES

JIV.$$RES!20|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!50|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!40|Lab_failed

STK.Pop|$$STK|$$RES

STK.Pop|$$STK|$$RES

JIV.$$RES!60|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(62) Test STK.Clone with String type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Push|$$STK|World

STK.Clone|$$STK|$$CLN

STK.Count|$$CLN|$$RES

JIV.$$RES!2|Lab_failed

STK.Pop|$$CLN|$$RES

JIS.$$RES!World|Lab_failed

STK.Pop|$$CLN|$$RES

JIS.$$RES!Hello|Lab_failed

STK.End|$$STK

STK.End|$$CLN

'-----------------------------------------------------------

'-----------------------------------------------------------

$$MSG=(63) Test STK.Rotate with Integer type

STK.New|$$STK|i

STK.Push|$$STK|10

STK.Push|$$STK|20

STK.Push|$$STK|30

STK.Push|$$STK|40

STK.Push|$$STK|50

STK.Push|$$STK|60

STK.Rotate|$$STK

STK.Pop|$$STK|$$RES

JIV.$$RES!50|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!40|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!30|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(64) Test STK.InvRotate with Float type

STK.New|$$STK|f

STK.Push|$$STK|9.89

STK.Push|$$STK|127.89

STK.Push|$$STK|1.23

STK.Push|$$STK|4.56

STK.Push|$$STK|7.89

'STK.Show|$$STK

STK.InvRotate|$$STK|3

'STK.Show|$$STK|c

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!7.89|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!4.56|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(65) Test STK.Swapx with default parameters (Top and Bottom)

STK.New|$$STK|s

STK.Push|$$STK|First

STK.Push|$$STK|Middle

STK.Push|$$STK|Last

STK.Swapx|$$STK

STK.Pop|$$STK|$$RES

JIS.$$RES!First|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Middle|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Last|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(66) Test STK.Rotate with all elements ($$ANZ = 0)

STK.New|$$STK|i

STK.Push|$$STK|10

STK.Push|$$STK|20

STK.Push|$$STK|30

STK.Rotate|$$STK|0

'STK.InvRotate|$$STK|0

STK.Pop|$$STK|$$RES

JIV.$$RES!20|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!10|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!30|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(67) Test STK.InvRotate with all elements ($$ANZ = 0)

STK.New|$$STK|f

STK.Push|$$STK|1.23

STK.Push|$$STK|4.56

STK.Push|$$STK|7.89

'STK.Show|$$STK

STK.InvRotate|$$STK|0

'STK.Show|$$STK|c

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!7.89|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!4.56|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

'-----------------------------------------------------------

$$MSG=(68) Test STK.Count with integer type

STK.New|$$STK|i

STK.Push|$$STK|42

STK.Count|$$STK|$$RES

JIV.$$RES!1|Lab_failed

STK.Push|$$STK|99

STK.Count|$$STK|$$RES

JIV.$$RES!2|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(69) Test STK.Count with float type

STK.New|$$STK|f

STK.Push|$$STK|1.11

STK.Count|$$STK|$$RES

JIV.$$RES!1|Lab_failed

STK.Push|$$STK|2.22

STK.Push|$$STK|3.33

STK.Count|$$STK|$$RES

JIV.$$RES!3|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(70) Test STK.Count with string type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Count|$$STK|$$RES

JIS.$$RES!1|Lab_failed

STK.Push|$$STK|World

STK.Push|$$STK|Testing

STK.Count|$$STK|$$RES

JIS.$$RES!3|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(71) Test STK.Push with integer type

STK.New|$$STK|i

STK.Push|$$STK|123

STK.Peek|$$STK|$$RES

JIV.$$RES!123|Lab_failed

STK.Push|$$STK|456

STK.Pop|$$STK|$$RES

JIV.$$RES!456|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!123|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(72) Test STK.Peek with integer type

STK.New|$$STK|i

STK.Push|$$STK|777

STK.Push|$$STK|888

STK.Peek|$$STK|$$TOP

JIV.$$TOP!888|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!888|Lab_failed

STK.Peek|$$STK|$$TOP

JIV.$$TOP!777|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(73) Test STK.Pop with integer type

STK.New|$$STK|i

STK.Push|$$STK|10

STK.Push|$$STK|20

STK.Pop|$$STK|$$RES

JIV.$$RES!20|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!10|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(74) Test STK.Import with integer type

STK.New|$$STK|i

STK.Import|$$STK|10;20;30

STK.Count|$$STK|$$RES

JIV.$$RES!3|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!30|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!20|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!10|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(75) Test STK.Export with integer type

STK.New|$$STK|i

STK.Push|$$STK|100

STK.Push|$$STK|200

STK.Push|$$STK|300

'STK.Show|$$STK

STK.Export|$$STK|;|$$STR

STK.Clear|$$STK

STK.Import|$$STK|$$STR|;

'STK.SHow|$$STK|c

' Expecting "100;200;300" in $$STR

JIS.$$STR!100;200;300|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(76) Test STK.GetType with integer type

STK.New|$$STK|i

STK.GetType|$$STK|$$TYP

' Expecting 2 for integer

JIV.$$TYP!2|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(77) Test STK.Reverse with string type

STK.New|$$STK|s

STK.Push|$$STK|Alpha

STK.Push|$$STK|Beta

STK.Push|$$STK|Gamma

STK.Reverse|$$STK

STK.Pop|$$STK|$$RES

JIS.$$RES!Alpha|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Beta|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Gamma|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(78) Test STK.Add with integer type

STK.New|$$STK|i

STK.Push|$$STK|5

STK.Push|$$STK|10

STK.Push|$$STK|15

STK.Add|$$STK|2

' Should add 15 + 10 = 25 and push result

STK.Pop|$$STK|$$RES

JIV.$$RES!25|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!5|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(79) Test STK.Dup with integer type

STK.New|$$STK|i

STK.Push|$$STK|7

STK.Dup|$$STK|2

' Should now have 7,7,7 on stack

STK.Pop|$$STK|$$RES

JIV.$$RES!7|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!7|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!7|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(80) Test STK.Swap with integer type

STK.New|$$STK|i

STK.Push|$$STK|1000

STK.Push|$$STK|2000

STK.Swap|$$STK

STK.Pop|$$STK|$$RES

JIV.$$RES!1000|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!2000|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(81) Test STK.Clone with float type

STK.New|$$STK|f

STK.Push|$$STK|1.5

STK.Push|$$STK|2.5

STK.Clone|$$STK|$$CLN

STK.Count|$$CLN|$$NUM

JIZ.$$CLN|Lab_failed

' Pop from original

STK.Pop|$$STK|$$RES

JIV.$$RES!2.5|Lab_failed

' Pop from cloned

STK.Pop|$$CLN|$$RES

JIV.$$RES!2.5|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(82) Test STK.Swapx with string type

STK.New|$$STK|s

STK.Push|$$STK|One

STK.Push|$$STK|Two

STK.Push|$$STK|Three

' Swap item 1 (top) with item 3 (bottom)

'STK.Show|$$STK

STK.Swapx|$$STK|1|3

'STK.Show|$$STK

STK.Pop|$$STK|$$RES

JIS.$$RES!One|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Two|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Three|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(83) Test STK.Rotate with float type

STK.New|$$STK|f

STK.Push|$$STK|3.33

STK.Push|$$STK|6.66

STK.Push|$$STK|9.99

STK.Rotate|$$STK|2

STK.Pop|$$STK|$$RES

JIV.$$RES!6.66|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!9.99|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!3.33|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(84) Test STK.InvRotate with string type

STK.New|$$STK|s

STK.Push|$$STK|Red

STK.Push|$$STK|Green

STK.Push|$$STK|Blue

STK.InvRotate|$$STK|3

' Inverse rotate top 3 -> moves bottom of top-3 to TOS => [Green,Blue,Red]

STK.Pop|$$STK|$$RES

JIS.$$RES!Red|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Blue|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Green|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(85) Test STK.Import with float type

STK.New|$$STK|f

STK.Import|$$STK|1.1;2.2;3.3

STK.Count|$$STK|$$RES

JIV.$$RES!3|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!3.3|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!2.2|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!1.1|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(86) Test STK.Export with string type

STK.New|$$STK|s

STK.Push|$$STK|Alpha

STK.Push|$$STK|Beta

STK.Push|$$STK|Gamma

STK.Export|$$STK| |$$RES

JIS.$$RES!Alpha Beta Gamma|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(87) Test STK.Reverse with integer type

STK.New|$$STK|i

STK.Push|$$STK|11

STK.Push|$$STK|22

STK.Push|$$STK|33

STK.Reverse|$$STK

STK.Pop|$$STK|$$RES

JIV.$$RES!11|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!22|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!33|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

'-----------------------------------------------------------

$$MSG=(88) Test STK.Dup with float type

STK.New|$$STK|f

STK.Push|$$STK|1.23

STK.Dup|$$STK|2

' Now stack should be [1.23, 1.23, 1.23] (top first)

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!1.23|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(89) Test STK.Add with float type

STK.New|$$STK|f

STK.Push|$$STK|1.1

STK.Push|$$STK|2.2

STK.Push|$$STK|3.3

STK.Add|$$STK|2

' This adds 3.3 + 2.2 = 5.5 on top; stack becomes [1.1, 5.5]

STK.Pop|$$STK|$$RES

JIV.$$RES!5.5|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!1.1|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(90) Test STK.Clone with integer type

STK.New|$$STK|i

STK.Push|$$STK|10

STK.Push|$$STK|20

STK.Clone|$$STK|$$CLN

' Pop from original

STK.Pop|$$STK|$$R01

JIV.$$R01!20|Lab_failed

' Pop from the clone

STK.Pop|$$CLN|$$R02

JIV.$$R02!20|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(91) Test STK.Swap with float type

STK.New|$$STK|f

STK.Push|$$STK|1.11

STK.Push|$$STK|2.22

STK.Swap|$$STK

' After swap, top is 1.11

STK.Pop|$$STK|$$RES

JIV.$$RES!1.11|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!2.22|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(92) Test STK.Count with empty stack

STK.New|$$STK|i

STK.Count|$$STK|$$RES

' Expecting 0

JIV.$$RES!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(93) Test STK.Reverse with single element

STK.New|$$STK|s

STK.Push|$$STK|Solo

STK.Reverse|$$STK

STK.Pop|$$STK|$$RES

' Must still be "Solo"

JIS.$$RES!Solo|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(94) Test STK.Rotate with 1 element

STK.New|$$STK|i

STK.Push|$$STK|999

STK.Rotate|$$STK|1

STK.Pop|$$STK|$$RES

JIV.$$RES!999|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(95) Test STK.InvRotate with 2 elements

STK.New|$$STK|i

STK.Push|$$STK|123

STK.Push|$$STK|456

STK.InvRotate|$$STK|2

STK.Pop|$$STK|$$R01

JIV.$$R01!123|Lab_failed

STK.Pop|$$STK|$$R02

JIV.$$R02!456|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(96) Test STK.Push negative integer

STK.New|$$STK|i

STK.Push|$$STK|-50

STK.Peek|$$STK|$$RES

JIV.$$RES!-50|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(97) Test STK.Peek with string type

STK.New|$$STK|s

STK.Push|$$STK|Hello

STK.Peek|$$STK|$$TOP

JIS.$$TOP!Hello|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Hello|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(98) Test STK.Swapx with same index

STK.New|$$STK|i

STK.Push|$$STK|10

STK.Push|$$STK|20

' Swapping the same index does nothing

STK.Swapx|$$STK|2|2

STK.Pop|$$STK|$$R01

JIV.$$R01!20|Lab_failed

STK.Pop|$$STK|$$R02

JIV.$$R02!10|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(99) Test STK.Add with default parameter (top 2)

STK.New|$$STK|i

STK.Push|$$STK|7

STK.Push|$$STK|8

STK.Add|$$STK

' Adds 8 + 7 => 15

STK.Pop|$$STK|$$RES

JIV.$$RES!15|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(100) Test STK.Export with float type and custom delimiter

STK.New|$$STK|f

STK.Push|$$STK|0.5

STK.Push|$$STK|1.5

STK.Push|$$STK|2.5

STK.Export|$$STK|:|$$STR

' Expecting ".5:1.5:2.5" in $$STR

JIS.$$STR!.5:1.5:2.5|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(101) Test STK.Import with custom delimiter

STK.New|$$STK|s

' use comma as delimiter

STK.Import|$$STK|One|,

STK.Import|$$STK|Two|,

STK.Import|$$STK|Three|,

'STK.Show|$$STK

STK.Count|$$STK|$$CNT

JIV.$$CNT!3|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Three|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!Two|Lab_failed

STK.Pop|$$STK|$$RES

JIS.$$RES!One|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(102) Test STK.GetType on float stack

STK.New|$$STK|f

STK.GetType|$$STK|$$TYP

' Expecting 3 for extended/float

JIV.$$TYP!3|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(103) Test STK.Swapx with partial parameters (defaults)

STK.New|$$STK|s

STK.Push|$$STK|First

STK.Push|$$STK|Second

STK.Push|$$STK|Third

' With no extra parameters, it swaps top & bottom by default

STK.Swapx|$$STK

STK.Pop|$$STK|$$R01

JIS.$$R01!First|Lab_failed

STK.Pop|$$STK|$$R02

JIS.$$R02!Second|Lab_failed

STK.Pop|$$STK|$$R03

JIS.$$R03!Third|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(104) Test STK.Dup with single element

STK.New|$$STK|i

STK.Push|$$STK|999

STK.Dup|$$STK|1

' Now stack should be [999, 999]

STK.Pop|$$STK|$$RES

JIV.$$RES!999|Lab_failed

STK.Pop|$$STK|$$RES

JIV.$$RES!999|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(105) Test STK.Reverse with float type

STK.New|$$STK|f

STK.Push|$$STK|4.4

STK.Push|$$STK|5.5

STK.Push|$$STK|6.6

STK.Reverse|$$STK

' After reversing: TOS=4.4 => becomes [6.6, 5.5, 4.4]

STK.Pop|$$STK|$$R01

JIV.$$R01!4.4|Lab_failed

STK.Pop|$$STK|$$R02

JIV.$$R02!5.5|Lab_failed

STK.Pop|$$STK|$$R03

JIV.$$R03!6.6|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(106) Test STK.Clone with string type

STK.New|$$STK|s

STK.Push|$$STK|Alpha

STK.Clone|$$STK|$$CLN

STK.Push|$$STK|Beta

STK.Push|$$CLN|Gamma

' Original has [Alpha, Beta], clone has [Alpha, Gamma]

STK.Pop|$$STK|$$R01

JIS.$$R01!Beta|Lab_failed

STK.Pop|$$CLN|$$R02

JIS.$$R02!Gamma|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

$$MSG=(107) Test STK.Clone on empty stack

STK.New|$$STK|i

' No push => empty

STK.Clone|$$STK|$$CLN

STK.Count|$$STK|$$R01

JIV.$$R01!0|Lab_failed

STK.Count|$$CLN|$$R02

JIV.$$R02!0|Lab_failed

STK.End|$$STK

'-----------------------------------------------------------

 

'-----------------------------------------------------------

 

LST.ENDall

:Lab_passed

SAV.Restore

$$RES=108

ENR.

'===========================================================

 

:Lab_failed

MBX. Fehler in $script$ $crlf$bei $$MSG

$$RES=0

ENR.