QUE. - Queue

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > QUE. - Queue >

QUE. - Queue

QUE. - Testscript

Previous Top Next


MiniRobotLanguage (MRL)

 

QUE.-Testscript

You can Test if Que's work

 

'SPR Script-file: -

'Purpose: 

'Author: Theo Gottwald

'Creation date: 01-12-2017 at 13:41:53

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

'#EXE:?path\

'#SPI:ForceWrite

#LIB:?path\..\Library

 

SAV.Save|$$LAA|$$LAB|$$LAC|$$LAD|$$COL|$$COA|$$QUE

' Testet QUE.

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

$$MSG=(0) Teste QUE.New

QUE.New|$$QUE

JIZ.$$QUE|Lab_failed

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

$$MSG=(1) Teste QUE.Count

$$LAA=Hamburg

$$LAB=Bremen

QUE.Push|$$QUE|$$LAA

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!1|Lab_failed

QUE.Push|$$QUE|$$LAB

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!2|Lab_failed

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

$$MSG=(2) Teste QUE.Peek

QUE.Peek|$$QUE|$$LAC

JIS.$$LAC!$$LAA|Lab_failed

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

$$MSG=(3) Teste QUE.Pop

QUE.Pop|$$QUE|$$LAC

JIS.$$LAC!$$LAA|Lab_failed

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

$$MSG=(4) Teste QUE.Pop

QUE.Pop|$$QUE|$$LAC

JIS.$$LAC!$$LAB|Lab_failed

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

$$MSG=(5) Teste QUE.Count

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(6) Teste QUE.Clear

QUE.Clear|$$QUE

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(7) Teste QUE.Push after Clear

QUE.Push|$$QUE|$$LAA

QUE.Peek|$$QUE|$$LAC

JIS.$$LAC!$$LAA|Lab_failed

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

$$MSG=(8) Teste QUE.Validate

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!1|Lab_failed

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

$$MSG=(9) Teste QUE.GetType

QUE.End all

QUE.New|$$QUE|s

QUE.GetType|$$QUE|$$LAC

JIS.$$LAC!1|Lab_failed

 

QUE.End all

QUE.New|$$QUE

QUE.GetType|$$QUE|$$LAC

JIS.$$LAC!1|Lab_failed

 

QUE.End all

QUE.New|$$QUE|i

QUE.GetType|$$QUE|$$LAC

JIS.$$LAC!2|Lab_failed

QUE.End|$$QUE

 

QUE.New|$$QUE|f

QUE.GetType|$$QUE|$$LAC

JIS.$$LAC!3|Lab_failed

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

$$MSG=(10) Teste QUE.Delete

$$LAB=Hallo

$$LAD=Peter

QUE.New|$$QUE

QUE.Push|$$QUE|$$LAB

QUE.Push|$$QUE|$$LAD

QUE.Push|$$QUE|und

QUE.Peek|$$QUE|$$LAA

JIS.$$LAA!$$LAB|Lab_failed

QUE.Delete|$$QUE

QUE.Pop|$$QUE|$$LAA

JIS.$$LAA!$$LAD|Lab_failed

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

$$MSG=(11) Teste QUE.New after Delete

QUE.New|$$QUE

QUE.Push|$$QUE|$$LAA

QUE.Peek|$$QUE|$$LAC

JIS.$$LAC!$$LAA|Lab_failed

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

$$MSG=(12) Teste QUE.End

QUE.End|$$QUE

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(13) Teste QUE.EndAll

QUE.New|$$QUE

QUE.Push|$$QUE|$$LAA

QUE.EndAll

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(14) Teste QUE.EndAll

QUE.New|$$QUE

QUE.New|$$QUA|f

QUE.New|$$QUB|i

QUE.Push|$$QUE|$$LAA

QUE.EndAll

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

QUE.Validate|$$QUA|$$LAC

JIV.$$LAC!0|Lab_failed

QUE.Validate|$$QUB|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(15) Teste QUE.Push with different data types

QUE.New|$$QUE|s

QUE.Push|$$QUE|Hello

QUE.Push|$$QUE|World

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!2|Lab_failed

 

QUE.New|$$QUE|i

QUE.Push|$$QUE|123

QUE.Push|$$QUE|456

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!2|Lab_failed

 

QUE.New|$$QUE|f

QUE.Push|$$QUE|3.14

QUE.Push|$$QUE|2.71

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!2|Lab_failed

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

$$MSG=(16) Teste QUE.Peek with different data types

QUE.New|$$QUE|s

QUE.Push|$$QUE|Hello

QUE.Peek|$$QUE|$$LAC

JIS.$$LAC!Hello|Lab_failed

 

QUE.New|$$QUE|i

QUE.Push|$$QUE|123

QUE.Peek|$$QUE|$$LAC

JIV.$$LAC!123|Lab_failed

 

QUE.New|$$QUE|f

QUE.Push|$$QUE|3.14

QUE.Peek|$$QUE|$$LAC

JIV.$$LAC!3.14|Lab_failed

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

$$MSG=(17) Teste QUE.Pop with different data types

QUE.New|$$QUE|s

QUE.Push|$$QUE|Hello

QUE.Pop|$$QUE|$$LAC

JIS.$$LAC!Hello|Lab_failed

 

QUE.New|$$QUE|i

QUE.Push|$$QUE|123

QUE.Pop|$$QUE|$$LAC

JIV.$$LAC!123|Lab_failed

 

QUE.New|$$QUE|f

QUE.Push|$$QUE|3.14

QUE.Pop|$$QUE|$$LAC

JIV.$$LAC!3.14|Lab_failed

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

$$MSG=(18) Teste QUE.Clear with different data types

QUE.New|$$QUE|s

QUE.Push|$$QUE|Hello

QUE.Clear|$$QUE

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

 

QUE.New|$$QUE|i

QUE.Push|$$QUE|123

QUE.Clear|$$QUE

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

 

QUE.New|$$QUE|f

QUE.Push|$$QUE|3.14

QUE.Clear|$$QUE

QUE.Count|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(19) Teste QUE.Validate with invalid handle

QUE.New|$$QUE

QUE.End|$$QUE

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(20) Teste QUE.Push with invalid handle

QUE.New|$$QUE

QUE.End|$$QUE

QUE.Push|$$QUE|Hello

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(21) Teste QUE.Peek with invalid handle

QUE.New|$$QUE

QUE.End|$$QUE

QUE.Peek|$$QUE|$$LAC

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(22) Teste QUE.Pop with invalid handle

QUE.New|$$QUE

QUE.End|$$QUE

QUE.Pop|$$QUE|$$LAC

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(23) Teste QUE.Clear with invalid handle

QUE.New|$$QUE

QUE.End|$$QUE

QUE.Clear|$$QUE

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(24) Teste QUE.Delete with invalid handle

QUE.New|$$QUE

QUE.End|$$QUE

QUE.Delete|$$QUE

QUE.Validate|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

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

$$MSG=(25) Teste QUE.GetType with invalid handle

QUE.New|$$QUE

QUE.End|$$QUE

QUE.GetType|$$QUE|$$LAC

JIV.$$LAC!0|Lab_failed

 

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

$$MSG=(26) Teste QUE.GetType with String type

QUE.New|$$QUE|s

QUE.GetType|$$QUE|$$LAC

' 1 corresponds to String type

JIV.$$LAC!1|Lab_failed

QUE.End|$$QUE

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

$$MSG=(27) Teste QUE.GetType with Integer type

QUE.New|$$QUE|i

QUE.GetType|$$QUE|$$LAC

' 2 corresponds to Integer type

JIV.$$LAC!2|Lab_failed  

QUE.End|$$QUE

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

$$MSG=(28) Teste QUE.GetType with Floating-Point type

QUE.New|$$QUE|f

QUE.GetType|$$QUE|$$LAC

' 3 corresponds to Floating-Point type

JIV.$$LAC!3|Lab_failed  

QUE.End|$$QUE

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

$$MSG=(29) Teste QUE.GetType with default type (no type specified)

QUE.New|$$QUE

QUE.GetType|$$QUE|$$LAC

' Default type is String (1)

JIV.$$LAC!1|Lab_failed  

QUE.End|$$QUE

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

$$MSG=(30) Teste QUE.GetType after QUE.Clear

QUE.New|$$QUE|s

QUE.Clear|$$QUE

QUE.GetType|$$QUE|$$LAC

' Type should remain String 1 after clear

JIV.$$LAC!1|Lab_failed  

QUE.End|$$QUE

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

$$MSG=(31) Teste QUE.GetType after QUE.Push with mixed data types (should fail)

QUE.New|$$QUE|s

QUE.Push|$$QUE|Hello

' Valid push for String type

QUE.Push|$$QUE|123

QUE.GetType|$$QUE|$$LAC

' Type should still be String 1

JIV.$$LAC!1|Lab_failed 

QUE.End|$$QUE

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

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

:Lab_passed

SAV.Restore

$$RES=108

ENR.

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

 

:Lab_failed

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

$$RES=0

ENR.

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

 

'#INC:TX_Macros.mrt

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