Senipah / VBA-Better-Array

An array class for VBA providing features found in more modern languages
MIT License
112 stars 18 forks source link

Unexpected result on the "Splice" method #21

Open yves-amevoin opened 1 year ago

yves-amevoin commented 1 year ago

Describe the bug It seems if the length of the table is less or equal than 3, the Splice method erases the last value even when asking not to.

To Reproduce Steps to reproduce the behavior:

Sub TestSplice()
    Dim colData As BetterArray

    Set colData = New BetterArray
    colData.LowerBound = 1

    colData.Push "1", "2", "3"
    'Items are "1", "2", "3"
    Debug.Print colData.Length
    'Length is 3

    colData.Splice 2, 0, ""
    'Items are "1", "", "2"
    'Expected Items are "1", "", "2", "3"

    Debug.Print colData.Length
    'Value is 3 instead of 4.

End Sub

Operating System:

Host Application: