1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-08-05 01:50:24 +00:00
QB64-PE/tests/compile_tests/qb64pe/element_getnextelement.bas
Matthew Kilgore 90941fffa7 Replace CONSTs while we have the individual elements
This moves the CONST replacement up before we turn the elements into a
single string. The advantage is that we don't have to worry about
splitting the string properly to find the CONST names as the elements
are already split for us.t
2024-01-18 13:00:13 -05:00

51 lines
1 KiB
QBasic

Option _Explicit
DEFLNG A-Z
$Console:Only
Dim Debug As Long
Debug = -1
'$include:'../../../source/global/constants.bas'
'$include:'../../../source/utilities/type.bi'
sp = "@" ' Makes the output readable
DIM test$, strIndex AS LONG, Index AS LONG, ele$, i AS LONG
test$ = ""
strIndex = 0
Index = 0
ele$ = getnextelement$(test$, Index, strIndex)
Print "Empty element: "; ele$
Print "strIndex = 1: "; strIndex
Print "Index = -1: "; Index
Print
test$ = "foo"
strIndex = 0
Index = 0
' Should return one element for 'foo' and then Index = -1
For i = 1 To 2
ele$ = getnextelement$(test$, Index, strIndex)
Print "element: "; ele$
Print "strIndex: "; strIndex
Print "Index: "; Index
Next
Print
test$ = "foo@bar@baz@20202020@&HADDD"
strIndex = 0
Index = 0
' Should return the 5 individual elements, and then Index = -1
For i = 1 To 6
ele$ = getnextelement$(test$, Index, strIndex)
Print "element: "; ele$
Print "strIndex: "; strIndex
Print "Index: "; Index
Next
System
'$include:'../../../source/utilities/elements.bas'