From d930cbe9e03731aa7a326170db700666e56de4d1 Mon Sep 17 00:00:00 2001 From: Stefan Pinnow Date: Thu, 18 Jan 2024 19:32:41 +0100 Subject: [PATCH 1/5] docs: fix typos --- docs/api/methods/Fill.md | 4 ++-- docs/api/methods/Filter.md | 2 +- docs/api/methods/FilterType.md | 2 +- docs/api/methods/FromCSVFile.md | 7 +------ docs/api/methods/FromCSVString.md | 7 +------ docs/api/methods/Includes.md | 2 +- docs/api/methods/IncludesType.md | 2 +- docs/api/methods/IsSorted.md | 2 +- docs/api/methods/Max.md | 4 ++-- docs/api/methods/Min.md | 5 ++--- docs/api/methods/ParseFromString.md | 4 ++-- docs/api/methods/Shuffle.md | 8 ++++---- docs/api/methods/Splice.md | 2 +- docs/api/methods/ToCSVFile.md | 11 +++-------- docs/api/methods/ToCSVString.md | 11 +++-------- docs/api/methods/ToExcelRange.md | 7 +------ docs/api/methods/ToString.md | 6 +++--- docs/api/methods/Unique.md | 2 +- docs/api/properties/item/item_setter.md | 8 ++++---- docs/home/getting_started.md | 4 ++-- docs/index.md | 6 +++--- 21 files changed, 40 insertions(+), 66 deletions(-) diff --git a/docs/api/methods/Fill.md b/docs/api/methods/Fill.md index 3af16fb..9d03ca1 100644 --- a/docs/api/methods/Fill.md +++ b/docs/api/methods/Fill.md @@ -40,7 +40,7 @@ Necessity : Optional Description -: The first index of the outermost array to begin filling with the passed value. If ommited the array will be filled from the first index. +: The first index of the outermost array to begin filling with the passed value. If omitted the array will be filled from the first index. --- @@ -62,7 +62,7 @@ Type : BetterArray `Object` Description -: The current instance of the BetterArray object array filled with the passed value between the specified indices. If ommited the array will be filled to the last index. +: The current instance of the BetterArray object array filled with the passed value between the specified indices. If omitted the array will be filled to the last index. ## Example diff --git a/docs/api/methods/Filter.md b/docs/api/methods/Filter.md index 9ccbff1..413949e 100644 --- a/docs/api/methods/Filter.md +++ b/docs/api/methods/Filter.md @@ -57,7 +57,7 @@ Necessity : Optional Description -: Boolean value indicating whether the filter should be applied recrsively to a jagged or multidimensional array. By default, only the outermost array will be filtered. +: Boolean value indicating whether the filter should be applied recursively to a jagged or multidimensional array. By default, only the outermost array will be filtered. ### Returns diff --git a/docs/api/methods/FilterType.md b/docs/api/methods/FilterType.md index ae89ca4..099cbc1 100644 --- a/docs/api/methods/FilterType.md +++ b/docs/api/methods/FilterType.md @@ -57,7 +57,7 @@ Necessity : Optional Description -: Boolean value indicating whether the filter should be applied recrsively to a jagged or multidimensional array. By default, only the outermost array will be filtered. +: Boolean value indicating whether the filter should be applied recursively to a jagged or multidimensional array. By default, only the outermost array will be filtered. ### Returns diff --git a/docs/api/methods/FromCSVFile.md b/docs/api/methods/FromCSVFile.md index e29e4b1..2b50e8a 100644 --- a/docs/api/methods/FromCSVFile.md +++ b/docs/api/methods/FromCSVFile.md @@ -70,7 +70,7 @@ Necessity : Optional Description -: The character(s) used to escape characters within cells of the CSV file. If omitted, the character `"` (double quote) is used indicate the opening and closing of an escape sqeuence. +: The character(s) used to escape characters within cells of the CSV file. If omitted, the character `"` (double quote) is used indicate the opening and closing of an escape sequence. --- @@ -133,8 +133,3 @@ End Sub [Back to Docs](https://senipah.github.io/VBA-Better-Array/) - - - - - diff --git a/docs/api/methods/FromCSVString.md b/docs/api/methods/FromCSVString.md index 86fd691..82a6085 100644 --- a/docs/api/methods/FromCSVString.md +++ b/docs/api/methods/FromCSVString.md @@ -72,7 +72,7 @@ Necessity : Optional Description -: The character(s) used to escape characters within cells of the CSV file. If omitted, the character `"` (double quote) is used indicate the opening and closing of an escape sqeuence. +: The character(s) used to escape characters within cells of the CSV file. If omitted, the character `"` (double quote) is used indicate the opening and closing of an escape sequence. --- @@ -116,8 +116,3 @@ Description [Back to Docs](https://senipah.github.io/VBA-Better-Array/) - - - - - diff --git a/docs/api/methods/Includes.md b/docs/api/methods/Includes.md index 49970dc..aa5fd90 100644 --- a/docs/api/methods/Includes.md +++ b/docs/api/methods/Includes.md @@ -53,7 +53,7 @@ Necessity : Optional Description -: If the array is jagged (an array of arrays) or multidimensional (which are stored internally as jagged arays) and you wish for all nested arrays to be checked then `recurse` must be true - otherwise only the outermost array will be checked. This argument has no effect when operating on a one-dimension array. +: If the array is jagged (an array of arrays) or multidimensional (which are stored internally as jagged arrays) and you wish for all nested arrays to be checked then `recurse` must be true - otherwise only the outermost array will be checked. This argument has no effect when operating on a one-dimension array. ### Returns diff --git a/docs/api/methods/IncludesType.md b/docs/api/methods/IncludesType.md index 5b740ed..0eaaf13 100644 --- a/docs/api/methods/IncludesType.md +++ b/docs/api/methods/IncludesType.md @@ -57,7 +57,7 @@ Necessity : Optional Description -: If the array is jagged (an array of arrays) or multidimensional (which are stored internally as jagged arays) and you wish for all nested arrays to be checked then `recurse` must be true - otherwise only the outermost array will be checked. This argument has no effect when operating on a one-dimension array. +: If the array is jagged (an array of arrays) or multidimensional (which are stored internally as jagged arrays) and you wish for all nested arrays to be checked then `recurse` must be true - otherwise only the outermost array will be checked. This argument has no effect when operating on a one-dimension array. ### Returns diff --git a/docs/api/methods/IsSorted.md b/docs/api/methods/IsSorted.md index 7bf23e7..9b9c0b3 100644 --- a/docs/api/methods/IsSorted.md +++ b/docs/api/methods/IsSorted.md @@ -7,7 +7,7 @@ grand_parent: API # IsSorted ## Description -The `IsSorted()` method tests if the stored array is sorted in ascending order. If a `ColumnIndex` argument is provided and the array is jagged or multi-dimensional, it will test if the aray is sorted by the values in that column. +The `IsSorted()` method tests if the stored array is sorted in ascending order. If a `ColumnIndex` argument is provided and the array is jagged or multi-dimensional, it will test if the array is sorted by the values in that column. #### Note diff --git a/docs/api/methods/Max.md b/docs/api/methods/Max.md index 1acb1c1..082c429 100644 --- a/docs/api/methods/Max.md +++ b/docs/api/methods/Max.md @@ -7,7 +7,7 @@ grand_parent: API # Max ## Description -The `Max()` method returns the largest value in a list of values. If no argments are passed the `Max()` method will use the stored array. Returns `Empty` if array is uninitialized, or only contains non-scalar variables. If operating on a jagged or multi-dimensional array, the value returned will be the largest value in all of the arrays combined. +The `Max()` method returns the largest value in a list of values. If no arguments are passed the `Max()` method will use the stored array. Returns `Empty` if array is uninitialized, or only contains non-scalar variables. If operating on a jagged or multi-dimensional array, the value returned will be the largest value in all of the arrays combined. #### Note Multi-dimensional arrays assigned to the `.Items` property are converted to jagged arrays internally and will be treated as such by the `Max()` method. @@ -25,7 +25,7 @@ Type : ParamArray `Variant` Necessity -: Opional +: Optional Description : A list of values or an array to compare. If no arguments are provided the `Max()` method will return the largest value on the stored array. diff --git a/docs/api/methods/Min.md b/docs/api/methods/Min.md index 297bfce..6f7c3a8 100644 --- a/docs/api/methods/Min.md +++ b/docs/api/methods/Min.md @@ -8,7 +8,7 @@ grand_parent: API # Min ## Description -The `Min()` method returns the smallest value in a list of values. If no argments are passed the `Min()` method will use the stored array. Returns `Empty` if array is uninitialized, or only contains non-scalar variables. If operating on a jagged or multi-dimensional array, the value returned will be the smallest value in all of the arrays combined. +The `Min()` method returns the smallest value in a list of values. If no arguments are passed the `Min()` method will use the stored array. Returns `Empty` if array is uninitialized, or only contains non-scalar variables. If operating on a jagged or multi-dimensional array, the value returned will be the smallest value in all of the arrays combined. #### Note Multi-dimensional arrays assigned to the `.Items` property are converted to jagged arrays internally and will be treated as such by the `Min()` method. @@ -26,7 +26,7 @@ Type : ParamArray `Variant` Necessity -: Opional +: Optional Description : A list of values or an array to compare. If no arguments are provided the `Min()` method will return the smallest value on the stored array. @@ -61,4 +61,3 @@ End Sub [Back to Docs](https://senipah.github.io/VBA-Better-Array/) - diff --git a/docs/api/methods/ParseFromString.md b/docs/api/methods/ParseFromString.md index d0ac858..0117b8a 100644 --- a/docs/api/methods/ParseFromString.md +++ b/docs/api/methods/ParseFromString.md @@ -53,7 +53,7 @@ Necessity : Optional Description -: If provided, the string passed to `ArrayOpenDelimiter` will be used to mark the beginning of arrays. If ommitted, the default character of `{` will be used. +: If provided, the string passed to `ArrayOpenDelimiter` will be used to mark the beginning of arrays. If omitted, the default character of `{` will be used. --- @@ -67,7 +67,7 @@ Necessity : Optional Description -: If provided, the string passed to `ArrayClosingDelimiter` will be used to mark the beginning of arrays. If ommitted, the default character of `}` will be used. +: If provided, the string passed to `ArrayClosingDelimiter` will be used to mark the beginning of arrays. If omitted, the default character of `}` will be used. ### Returns diff --git a/docs/api/methods/Shuffle.md b/docs/api/methods/Shuffle.md index c679e5b..22e09a2 100644 --- a/docs/api/methods/Shuffle.md +++ b/docs/api/methods/Shuffle.md @@ -7,7 +7,7 @@ grand_parent: API # Shuffle ## Description -The `Shuffle()` method Shuffles the order of elements in the array using the [Fisher–Yates algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm) . +The `Shuffle()` method Shuffles the order of elements in the array using the [Fisher–Yates algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm). ## Syntax @@ -15,7 +15,7 @@ The `Shuffle()` method Shuffles the order of elements in the array using the [Fi ### Parameters -Name +Name : `recurse` Type @@ -43,7 +43,7 @@ Public Sub ShiftExample() Dim result() As Variant Dim MyArray As BetterArray Set MyArray = New BetterArray - + MyArray.Push "Banana", "Orange", "Apple", "Mango" MyArray.Shuffle result = MyArray.Items @@ -53,4 +53,4 @@ Public Sub ShiftExample() End Sub ``` -[Back to Docs](https://senipah.github.io/VBA-Better-Array/) \ No newline at end of file +[Back to Docs](https://senipah.github.io/VBA-Better-Array/) diff --git a/docs/api/methods/Splice.md b/docs/api/methods/Splice.md index 3bd08b1..eed6ab6 100644 --- a/docs/api/methods/Splice.md +++ b/docs/api/methods/Splice.md @@ -11,7 +11,7 @@ The `Splice()` method changes the contents of an array by removing or replacing ## Syntax -*expression*.**Splice**(*StartIndex*, [*DeleteCount*,[*Item1*[, *Item2*[, ...[, *ItemN*]]]]) +*expression*.**Splice**(*StartIndex*, [*DeleteCount*,[*Item1*[, *Item2*[, ...[, *ItemN*]]]]]) ### Parameters diff --git a/docs/api/methods/ToCSVFile.md b/docs/api/methods/ToCSVFile.md index 0de6f31..6217348 100644 --- a/docs/api/methods/ToCSVFile.md +++ b/docs/api/methods/ToCSVFile.md @@ -85,7 +85,7 @@ Necessity : Optional Description -: The character(s) used to escape characters within cells of the CSV file. If omitted, the character `"` (double quote) is used indicate the opening and closing of an escape sqeuence. +: The character(s) used to escape characters within cells of the CSV file. If omitted, the character `"` (double quote) is used indicate the opening and closing of an escape sequence. --- @@ -113,7 +113,7 @@ Necessity : Optional Description -: If provided, all date values will be formmatted using the value in this argument forwarded to the VBA [Format()](https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications) function. +: If provided, all date values will be formatted using the value in this argument forwarded to the VBA [Format()](https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications) function. --- @@ -127,7 +127,7 @@ Necessity : Optional Description -: If provided, all numeric values will be formmatted using the value in this argument forwarded to the VBA [Format()](https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications) function. +: If provided, all numeric values will be formatted using the value in this argument forwarded to the VBA [Format()](https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications) function. @@ -143,8 +143,3 @@ Description [Back to Docs](https://senipah.github.io/VBA-Better-Array/) - - - - - diff --git a/docs/api/methods/ToCSVString.md b/docs/api/methods/ToCSVString.md index 8a2129e..ae21ce9 100644 --- a/docs/api/methods/ToCSVString.md +++ b/docs/api/methods/ToCSVString.md @@ -68,7 +68,7 @@ Necessity : Optional Description -: The character(s) used to escape characters within cells of the CSV file. If omitted, the character `"` (double quote) is used indicate the opening and closing of an escape sqeuence. +: The character(s) used to escape characters within cells of the CSV file. If omitted, the character `"` (double quote) is used indicate the opening and closing of an escape sequence. --- @@ -96,7 +96,7 @@ Necessity : Optional Description -: If provided, all date values will be formmatted using the value in this argument forwarded to the VBA [Format()](https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications) function. +: If provided, all date values will be formatted using the value in this argument forwarded to the VBA [Format()](https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications) function. --- @@ -110,7 +110,7 @@ Necessity : Optional Description -: If provided, all numeric values will be formmatted using the value in this argument forwarded to the VBA [Format()](https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications) function. +: If provided, all numeric values will be formatted using the value in this argument forwarded to the VBA [Format()](https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications) function. @@ -126,8 +126,3 @@ Description [Back to Docs](https://senipah.github.io/VBA-Better-Array/) - - - - - diff --git a/docs/api/methods/ToExcelRange.md b/docs/api/methods/ToExcelRange.md index 0de2b58..318e933 100644 --- a/docs/api/methods/ToExcelRange.md +++ b/docs/api/methods/ToExcelRange.md @@ -27,7 +27,7 @@ Necessity : Required Description -: An Excel Range object representing the loction to begin writing the stored values. Will be expanded as necessar to accomodate the size of the array. +: An Excel Range object representing the location to begin writing the stored values. Will be expanded as necessary to accommodate the size of the array. --- @@ -68,8 +68,3 @@ End Sub ``` [Back to Docs](https://senipah.github.io/VBA-Better-Array/) - - - - - diff --git a/docs/api/methods/ToString.md b/docs/api/methods/ToString.md index 6d4638c..eca8f35 100644 --- a/docs/api/methods/ToString.md +++ b/docs/api/methods/ToString.md @@ -39,7 +39,7 @@ Necessity : Optional Description -: If provided, the string passed to `separator` will be used to separate individual elements within the array. If ommitted, the default character of `,` will be used. +: If provided, the string passed to `separator` will be used to separate individual elements within the array. If omitted, the default character of `,` will be used. --- @@ -53,7 +53,7 @@ Necessity : Optional Description -: If provided, the string passed to `OpeningDelimiter` will be used to mark the beginning of arrays. If ommitted, the default character of `{` will be used. +: If provided, the string passed to `OpeningDelimiter` will be used to mark the beginning of arrays. If omitted, the default character of `{` will be used. --- @@ -67,7 +67,7 @@ Necessity : Optional Description -: If provided, the string passed to `ClosingDelimiter` will be used to mark the beginning of arrays. If ommitted, the default character of `}` will be used. +: If provided, the string passed to `ClosingDelimiter` will be used to mark the beginning of arrays. If omitted, the default character of `}` will be used. --- diff --git a/docs/api/methods/Unique.md b/docs/api/methods/Unique.md index 8e5c042..27ac9ff 100644 --- a/docs/api/methods/Unique.md +++ b/docs/api/methods/Unique.md @@ -25,7 +25,7 @@ Necessity : Optional Description -: A base-1 index of the column in a jagged or multi-dimension array with 2 dimensions to filter by unique values. If no column index is provided and the array is jagged then Unique will compare all elements in nested arrays for equality when determining which nested arrays are Unique. If the `ColumnIndex` is greater than the max length of the arrays at the second dimenson the first column at that dimension will be used. +: A base-1 index of the column in a jagged or multi-dimension array with 2 dimensions to filter by unique values. If no column index is provided and the array is jagged then Unique will compare all elements in nested arrays for equality when determining which nested arrays are Unique. If the `ColumnIndex` is greater than the max length of the arrays at the second dimension the first column at that dimension will be used. ### Returns diff --git a/docs/api/properties/item/item_setter.md b/docs/api/properties/item/item_setter.md index e335b2e..f26cedc 100644 --- a/docs/api/properties/item/item_setter.md +++ b/docs/api/properties/item/item_setter.md @@ -8,7 +8,7 @@ nav_order: 2 # Item Let Accessor ## Description -Replaces the array item at the specified index with the passed element. If the `Index` argument exceeds the current upper bound of the stored array, the element will be pushed onto the end of the array at the next available index (this changes the length and upper bound of the stored array). If the index argument is less than the LowerBound (base index) of the stored array the element will be inserted at the beginning of the array and the existing elements shifted up to accomodate the new element (this changes the length and upper bound of the stored array). +Replaces the array item at the specified index with the passed element. If the `Index` argument exceeds the current upper bound of the stored array, the element will be pushed onto the end of the array at the next available index (this changes the length and upper bound of the stored array). If the index argument is less than the LowerBound (base index) of the stored array the element will be inserted at the beginning of the array and the existing elements shifted up to accommodate the new element (this changes the length and upper bound of the stored array). ## Syntax @@ -21,7 +21,7 @@ Or ### Parameters -Name +Name : `Index` Type @@ -35,7 +35,7 @@ Description --- -Name +Name : `Element` Type @@ -51,4 +51,4 @@ Description **None** -[Back to Item overview](https://senipah.github.io/VBA-Better-Array/api/properties/item/Item) \ No newline at end of file +[Back to Item overview](https://senipah.github.io/VBA-Better-Array/api/properties/item/Item) diff --git a/docs/home/getting_started.md b/docs/home/getting_started.md index f64d1ca..5417a1a 100644 --- a/docs/home/getting_started.md +++ b/docs/home/getting_started.md @@ -47,7 +47,7 @@ End Sub ## Accessing elements in the array -To access individual elements stored in the array, use the [Item](https://senipah.github.io/VBA-Better-Array/api/properties/item/Item.html) property. As Item is the default member of the better array class, it can be accessed explicilty or implicitly. +To access individual elements stored in the array, use the [Item](https://senipah.github.io/VBA-Better-Array/api/properties/item/Item.html) property. As Item is the default member of the better array class, it can be accessed explicitly or implicitly. ### Retrieving elements @@ -223,4 +223,4 @@ End Sub #### NOTE -Multi-dimension arrays are converted to jagged arrays on assignment and converted back to a multi-dimension (tabular) structur on retrieval. +Multi-dimension arrays are converted to jagged arrays on assignment and converted back to a multi-dimension (tabular) structure on retrieval. diff --git a/docs/index.md b/docs/index.md index 6c02f50..9eba218 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,14 +1,14 @@ --- title: Home -has_children: true +has_children: true nav_order: 1 --- # VBA Better Array Documentation -VBA Better Array provides a cross-platform array class with a focus on developer convenience. +VBA Better Array provides a cross-platform array class with a focus on developer convenience. -Working with arrays in VBA can be a pain. While accessing native arrays is fast in VBA, adding new entries to the end of an exising array essentially means copying the whole array into a new array and requires multiple statements to do so. In addition, VBA arrays don't come with many of the built-in methods found in more modern languages, such as the ability to easily sort, slice and join to other arrays. +Working with arrays in VBA can be a pain. While accessing native arrays is fast in VBA, adding new entries to the end of an existing array essentially means copying the whole array into a new array and requires multiple statements to do so. In addition, VBA arrays don't come with many of the built-in methods found in more modern languages, such as the ability to easily sort, slice and join to other arrays. This project aims to help bridge that gap, making working with arrays in VBA both simpler and more convenient. From 5698e595a49664c98d35751c6050705cb8b5a470 Mon Sep 17 00:00:00 2001 From: Stefan Pinnow Date: Thu, 18 Jan 2024 20:18:40 +0100 Subject: [PATCH 2/5] chore: fix typos --- src/BetterArray.cls | 38 +++++++++---------- src/TestModule_BetterArray.bas | 68 +++++++++++++++++----------------- src/TestUtils.bas | 4 +- 3 files changed, 54 insertions(+), 56 deletions(-) diff --git a/src/BetterArray.cls b/src/BetterArray.cls index 7704af5..0ea4e71 100644 --- a/src/BetterArray.cls +++ b/src/BetterArray.cls @@ -344,9 +344,9 @@ End Property ' Public Methods ' '''''''''''''''''' -'@Description("Adds the provided argments to the array at the next available index.") +'@Description("Adds the provided arguments to the array at the next available index.") Public Function Push(ParamArray Args() As Variant) As Variant -Attribute Push.VB_Description = "Adds the provided argments to the array at the next available index." +Attribute Push.VB_Description = "Adds the provided arguments to the array at the next available index." Dim Element As Variant If This.ArrayType = ArrayTypes.BA_UNALLOCATED Or _ @@ -1245,13 +1245,13 @@ End Function ' Chainable Public Methods ' '''''''''''''''''''''''''''' -'@Description("Recursvely fills (modifies) all the elements of an array from a start index (default zero) to an end index (default array length) with a passed value.") +'@Description("Recursively fills (modifies) all the elements of an array from a start index (default zero) to an end index (default array length) with a passed value.") Public Function Fill( _ ByVal Value As Variant, _ Optional ByVal StartIndex As Long = MISSING_LONG, _ Optional ByVal EndIndex As Long = MISSING_LONG _ ) As BetterArray -Attribute Fill.VB_Description = "Recursvely fills (modifies) all the elements of an array from a start index (default zero) to an end index (default array length) with a passed value." +Attribute Fill.VB_Description = "Recursively fills (modifies) all the elements of an array from a start index (default zero) to an end index (default array length) with a passed value." Dim LocalItems() As Variant Dim RelativeStart As Long Dim RelativeEnd As Long @@ -1351,7 +1351,7 @@ Attribute Transpose.VB_Description = "Swaps rows for columns & vice versa." Case ArrayTypes.BA_ONEDIMENSION Result = Transpose1DArray(LocalItems) Case ArrayTypes.BA_MULTIDIMENSION - ' Sould Never match as MD arrs stored as jagged internally + ' Should Never match as MD arrays stored as jagged internally Result = Transpose2DArray(LocalItems) Case ArrayTypes.BA_JAGGED Result = TransposeArrayOfArrays(LocalItems) @@ -1943,7 +1943,7 @@ Attribute ToCSVFile.VB_Description = "Writes stored array to CSV file" Dim Content As String ' test if path valid - if not handle err - ' get ouput string + ' get output string If IsMissing(Headers) Then Content = Me.ToCSVString( _ ColumnDelimiter:=ColumnDelimiter, _ @@ -2449,7 +2449,7 @@ Private Function CountCSVColumns(ByRef FirstRow As String, ByRef LiteralDelim As Attribute CountCSVColumns.VB_Description = "Counts the number of delimited columns in a provided string" ' Each line should contain the same number of fields ' https://www.loc.gov/preservation/digital/formats/fdd/fdd000323.shtml - ' so we can just count the columnd in the first row + ' so we can just count the columned in the first row Dim i As Long Dim InQuote As Boolean Dim CountColumns As Long @@ -2578,14 +2578,14 @@ Attribute ParseCSV.VB_Description = "Parses CSV string into a 2d or jagged array ParseCSV = Results End Function -'@Description("Recursvely fills the array (and nested arrays) with the passed value.") +'@Description("Recursively fills the array (and nested arrays) with the passed value.") Private Function RecursiveFill( _ ByRef SourceArray() As Variant, _ ByVal Value As Variant, _ Optional ByVal StartIndex As Long = MISSING_LONG, _ Optional ByVal EndIndex As Long = MISSING_LONG _ ) As Variant() -Attribute RecursiveFill.VB_Description = "Recursvely fills the array (and nested arrays) with the passed value." +Attribute RecursiveFill.VB_Description = "Recursively fills the array (and nested arrays) with the passed value." Dim RelativeStart As Long Dim RelativeEnd As Long Dim i As Long @@ -2902,7 +2902,7 @@ Private Function FilterOneDimension( _ FilterOneDimension = Result.Items End Function -'@Description("Filters a jaggged array by column.") +'@Description("Filters a jagged array by column.") Private Function FilterByColumn( _ ByRef SourceArray() As Variant, _ ByVal Match As Variant, _ @@ -2975,7 +2975,7 @@ Attribute RecursiveFilter.VB_Description = "Recursively filters a passed array." Result.Push LocalItems End If Else - ' push an empty array if current is an unalocated rray + ' push an empty array if current is an unallocated array If CompareTypeNames Then IsMatch = (InStr( _ UCase$(TypeName(SourceArray(i))), _ @@ -4211,7 +4211,7 @@ Attribute MapMultidimensionArray.VB_Description = "Returns an array representing MapMultidimensionArray = LocalMap End Function -'@Description("Recursively Converts typred multidimension arrays to variant md arrays arrays. For md arrays with more than 2d.") +'@Description("Recursively converts typed multidimension arrays to variant md arrays arrays. For md arrays with more than 2d.") Private Function RecursiveTypedMultiToVariantMulti( _ ByRef SourceArray As Variant, _ Optional ByVal Depth As Long, _ @@ -4220,7 +4220,7 @@ Private Function RecursiveTypedMultiToVariantMulti( _ Optional ByRef Result As Variant, _ Optional ByVal EnsureScalar As Boolean _ ) As Variant() -Attribute RecursiveTypedMultiToVariantMulti.VB_Description = "Recursively Converts typred multidimension arrays to variant md arrays arrays. For md arrays with more than 2d." +Attribute RecursiveTypedMultiToVariantMulti.VB_Description = "Recursively converts typed multidimension arrays to variant md arrays arrays. For md arrays with more than 2d." Dim i As Long Dim LocalLowerBound As Long Dim LocalUpperBound As Long @@ -4522,13 +4522,13 @@ Attribute GetJaggedArrayDepth.VB_Description = "Returns a number representing ho GetJaggedArrayDepth = Depth End Function -'@Description("Gets the maximium bound values for a specified dimension of a jagged array.") +'@Description("Gets the maximum bound values for a specified dimension of a jagged array.") Private Function GetMaxBoundsAtDimension( _ ByRef SourceArray() As Variant, _ Optional ByVal Dimension As Long = 1, _ Optional ByVal CurrentDimension As Long = 1 _ ) As Long() -Attribute GetMaxBoundsAtDimension.VB_Description = "Gets the maximium bound values for a specified dimension of a jagged array." +Attribute GetMaxBoundsAtDimension.VB_Description = "Gets the maximum bound values for a specified dimension of a jagged array." Dim MaxBounds() As Long If CurrentDimension < Dimension Then @@ -4588,9 +4588,9 @@ Attribute MapJaggedArray.VB_Description = "Returns an array representing the str End Function -'@Description("Returns a 0-based array with two slots. First slot is the lowerbound of the passed array. second slot (index 0) is the upper bound.") +'@Description("Returns a 0-based array with two slots. First slot is the LowerBound of the passed array. second slot (index 0) is the upper bound.") Private Function GetArrayBounds(ByVal SourceArray As Variant) As Long() -Attribute GetArrayBounds.VB_Description = "Returns a 0-based array with two slots. First slot is the lowerbound of the passed array. second slot (index 0) is the upper bound." +Attribute GetArrayBounds.VB_Description = "Returns a 0-based array with two slots. First slot is the LowerBound of the passed array. second slot (index 0) is the upper bound." Dim Result(0 To 1) As Long If IsArray(SourceArray) Then Result(0) = LBound(SourceArray) @@ -4683,13 +4683,13 @@ Attribute GetElementByBreadcrumb.VB_Description = "Returns the element stored in GetElementByBreadcrumb = Result End Function -'@Description("Assigns an element to a location in a multidimensonal array based on a crumb argument. A crumb is an array representing the location of the multidimension array slot.") +'@Description("Assigns an element to a location in a multidimensional array based on a crumb argument. A crumb is an array representing the location of the multidimension array slot.") Private Function LetElementByBreadcrumb( _ ByRef SourceArray() As Variant, _ ByRef Crumb() As Variant, _ ByVal Element As Variant _ ) As Variant -Attribute LetElementByBreadcrumb.VB_Description = "Assigns an element to a location in a multidimensonal array based on a crumb argument. A crumb is an array representing the location of the multidimension array slot." +Attribute LetElementByBreadcrumb.VB_Description = "Assigns an element to a location in a multidimensional array based on a crumb argument. A crumb is an array representing the location of the multidimension array slot." Select Case UBound(Crumb) Case 0 LetOrSetElement SourceArray(Crumb(0)), Element diff --git a/src/TestModule_BetterArray.bas b/src/TestModule_BetterArray.bas index 98e64de..014a978 100644 --- a/src/TestModule_BetterArray.bas +++ b/src/TestModule_BetterArray.bas @@ -171,7 +171,7 @@ End Sub '''''''''''''''' '@TestMethod("BetterArray_Items") -Private Sub Items_CanAssignOneDimemsionalArray_ReturnedArrayEqualsAssignedArray() +Private Sub Items_CanAssignOneDimensionalArray_ReturnedArrayEqualsAssignedArray() On Error GoTo TestFail 'Arrange: @@ -194,7 +194,7 @@ TestFail: End Sub '@TestMethod("BetterArray_Items") -Private Sub Items_CanAssignMultiDimemsionalArray_ReturnedArrayEqualsAssignedArray() +Private Sub Items_CanAssignMultiDimensionalArray_ReturnedArrayEqualsAssignedArray() On Error GoTo TestFail 'Arrange: @@ -346,7 +346,7 @@ End Sub '@TestMethod("BetterArray_Length") -Private Sub Upperbound_FromAssignedOneDimensionalArray_ReturnedUpperBoundEqualsOriginalArray() +Private Sub UpperBound_FromAssignedOneDimensionalArray_ReturnedUpperBoundEqualsOriginalArray() On Error GoTo TestFail 'Arrange: @@ -362,7 +362,7 @@ Private Sub Upperbound_FromAssignedOneDimensionalArray_ReturnedUpperBoundEqualsO Actual = SUT.UpperBound 'Assert: - Assert.AreEqual Expected, Actual, "Actual upperbound <> expected" + Assert.AreEqual Expected, Actual, "Actual UpperBound <> expected" TestExit: Exit Sub @@ -425,8 +425,8 @@ Private Sub LowerBound_ChangingLowerBoundOfAssignedArray_ReturnedArrayHasNewLowe 'Assert: Assert.AreEqual Expected, Actual, "Actual LowerBound <> expected" Assert.AreEqual SUT.LowerBound, Actual, "Actual LowerBound <> SUT.LowerBound prop" - Assert.AreEqual UBound(TestArray) + 1, UBound(ReturnedItems), "Actual upperbound <> expected" - Assert.AreEqual SUT.UpperBound, UBound(ReturnedItems), "Actual upperbound <> SUT.UpperBound prop" + Assert.AreEqual UBound(TestArray) + 1, UBound(ReturnedItems), "Actual UpperBound <> expected" + Assert.AreEqual SUT.UpperBound, UBound(ReturnedItems), "Actual UpperBound <> SUT.UpperBound prop" Assert.AreEqual SUT.Length, TEST_ARRAY_LENGTH, "Actual length does not equal expected" TestExit: @@ -1072,7 +1072,7 @@ Private Sub ArrayType_MultiDimensionToJagged_Success() Actual = SUT.Items 'Assert: - Assert.IsTrue SequenceEqualsMutiVsJagged(TestArray, Actual) + Assert.IsTrue SequenceEqualsMultiVsJagged(TestArray, Actual) Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" @@ -1209,7 +1209,7 @@ Private Sub ArrayType_JaggedToMultiDimension_Success() Actual = SUT.Items 'Assert: - Assert.IsTrue SequenceEqualsMutiVsJagged(Actual, TestArray) + Assert.IsTrue SequenceEqualsMultiVsJagged(Actual, TestArray) Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" @@ -1280,7 +1280,7 @@ Private Sub Push_AddToNewBetterArray_ItemAdded() 'Assert: Assert.AreEqual Expected, Actual, "actual <> expected" Assert.AreEqual ExpectedLength, ActualLength, "Length value incorrect" - Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "Upperbound value incorrect" + Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" TestExit: Exit Sub @@ -1397,7 +1397,7 @@ Private Sub Push_AddMultipleToNewBetterArray_ItemsAdded() 'Assert: Assert.AreEqual Expected, Actual, "Element value incorrect" Assert.AreEqual ExpectedLength, ActualLength, "Length value incorrect" - Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "Upperbound value incorrect" + Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" TestExit: Exit Sub @@ -1460,7 +1460,7 @@ Private Sub Pop_OneDimensionalArray_LastItemRemoved() 'Assert: Assert.AreEqual Expected, Actual, "Element value incorrect" Assert.AreEqual TEST_ARRAY_LENGTH - 1, SUT.Length, "Length value incorrect" - Assert.AreEqual UBound(TestArray) - 1, SUT.UpperBound, "Upperbound value incorrect" + Assert.AreEqual UBound(TestArray) - 1, SUT.UpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" TestExit: @@ -1499,7 +1499,7 @@ Private Sub Pop_ArrayLengthIsZero_ReturnsEmpty() Assert.AreEqual Expected, Actual, "Actual <> expected" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual ExpectedLength, ActualLength, "Length value incorrect" - Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "Upperbound value incorrect" + Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" TestExit: Exit Sub @@ -1561,7 +1561,7 @@ Private Sub Shift_OneDimensionalArray_FirstItemRemoved() 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" Assert.AreEqual TEST_ARRAY_LENGTH - 1, SUT.Length, "Length value incorrect" - Assert.AreEqual UBound(TestArray) - 1, SUT.UpperBound, "Upperbound value incorrect" + Assert.AreEqual UBound(TestArray) - 1, SUT.UpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" TestExit: @@ -1595,7 +1595,7 @@ Private Sub Shift_ArrayLengthIsZero_ReturnsEmpty() Assert.AreEqual Expected, Actual, "Element value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual ExpectedLength, ActualLength, "Length value incorrect" - Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "Upperbound value incorrect" + Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" TestExit: Exit Sub @@ -1631,7 +1631,7 @@ Private Sub Unshift_OneDimensionalArray_ItemAddedToBeginning() 'Assert: Assert.AreEqual Expected, Actual, "Return value incorrect" - Assert.AreEqual (UBound(TestArray) + 1), SUT.UpperBound, "Upperbound value incorrect" + Assert.AreEqual (UBound(TestArray) + 1), SUT.UpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual TestElement, SUT.Item(SUT.LowerBound), "Element not inserted at correct position" @@ -1665,7 +1665,7 @@ Private Sub Unshift_ArrayLengthIsZero_ItemIsPushedToEmptyArray() 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected length" - Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "Upperbound value incorrect" + Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual ExpectedElement, ActualElement, "Actual element <> expected" @@ -1705,7 +1705,7 @@ Private Sub Unshift_MultidimensionalArray_ItemAddedToBeginning() 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected length" - Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "Upperbound value incorrect" + Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual ExpectedElement, ActualElement, "Actual element <> expected" @@ -1806,17 +1806,17 @@ Private Sub Concat_AddMultipleOneDimArrayToEmptyInternal_SuccessAdded() Dim ActualLength As Long Dim ExpectedUpperBound As Long Dim ActualUpperBound As Long - Dim FirstAray() As Variant + Dim FirstArray() As Variant Dim SecondArray() As Variant - FirstAray = Array(1, 2, 3) + FirstArray = Array(1, 2, 3) SecondArray = Array(4, 5, 6) Expected = Array(1, 2, 3, 4, 5, 6) ExpectedLength = 6 ExpectedUpperBound = UBound(Expected) 'Act: - Actual = SUT.Concat(FirstAray, SecondArray).Items + Actual = SUT.Concat(FirstArray, SecondArray).Items ActualLength = SUT.Length ActualUpperBound = SUT.UpperBound @@ -4797,7 +4797,7 @@ TestFail: End Sub '@TestMethod("BetterArray_Max") -Private Sub Max_JaggedArray_Returnslargest() +Private Sub Max_JaggedArray_ReturnsLargest() On Error GoTo TestFail 'Arrange: @@ -5431,7 +5431,7 @@ Private Sub Shuffle_OneDimArray_ArrayIsShuffled() Actual = SUT.Shuffle.Items 'Assert: - Assert.NotSequenceEquals SortedArray, Actual, "Array is not shufled" + Assert.NotSequenceEquals SortedArray, Actual, "Array is not shuffled" TestExit: Exit Sub TestFail: @@ -5455,7 +5455,7 @@ Private Sub Shuffle_OneDimArrayBase1_ArrayIsShuffled() Actual = SUT.Shuffle.Items 'Assert: - Assert.NotSequenceEquals SortedArray, Actual, "Array is not shufled" + Assert.NotSequenceEquals SortedArray, Actual, "Array is not shuffled" TestExit: Exit Sub TestFail: @@ -5478,7 +5478,7 @@ Private Sub Shuffle_MultiDimArray_ArrayIsShuffled() Actual = SUT.Shuffle.Items 'Assert: - Assert.NotSequenceEquals SortedArray, Actual, "Array is not shufled" + Assert.NotSequenceEquals SortedArray, Actual, "Array is not shuffled" TestExit: Exit Sub TestFail: @@ -5502,7 +5502,7 @@ Private Sub Shuffle_JaggedArray_ArrayIsShuffled() Actual = SUT.Shuffle.Items TestResult = SequenceEquals_JaggedArray(SortedArray, Actual) 'Assert: - Assert.IsFalse TestResult, "Array is not shufled" + Assert.IsFalse TestResult, "Array is not shuffled" TestExit: Exit Sub TestFail: @@ -5973,7 +5973,7 @@ Private Sub ParseFromString_Jagged3DeepArrayFromToString_ReturnsCorrectValues() Actual = SUT.ParseFromString(SourceString).Items ' can't use Assert.SequenceEquals due to type comparison - Bytes Will be Long in actual - ' also, Assert.SeqenceEquals doesn't support jagged arrays: https://github.com/rubberduck-vba/Rubberduck/issues/5161 + ' also, Assert.SequenceEquals doesn't support jagged arrays: https://github.com/rubberduck-vba/Rubberduck/issues/5161 TestResult = SequenceEquals_JaggedArray(Expected, Actual) @@ -6037,7 +6037,7 @@ TestFail: End Sub '@TestMethod("BetterArray_Flatten") -Private Sub Flatten_MultiDimArray_ReturnsFlattenned() +Private Sub Flatten_MultiDimArray_ReturnsFlattened() On Error GoTo TestFail 'Arrange: @@ -6068,7 +6068,7 @@ TestFail: End Sub '@TestMethod("BetterArray_Flatten") -Private Sub Flatten_JaggedArray_ReturnsFlattenned() +Private Sub Flatten_JaggedArray_ReturnsFlattened() On Error GoTo TestFail 'Arrange: @@ -6961,7 +6961,7 @@ Private Sub Unique_JaggedArrayColumnIndexPositiveBase_ReturnsUniqueList() SUT.LowerBound = 10 - ' rebase expected itms + ' rebase expected items SUT.Items = Expected Expected = SUT.Items @@ -7323,7 +7323,7 @@ TestFail: End Sub '@TestMethod("BetterArray_Every") -Private Sub Every_MiltiDimArrayOfSameString_ReturnsTrue() +Private Sub Every_MultiDimArrayOfSameString_ReturnsTrue() On Error GoTo TestFail 'Arrange: @@ -7350,7 +7350,7 @@ TestFail: End Sub '@TestMethod("BetterArray_Every") -Private Sub Every_MiltiDimArrayOfDifferentString_ReturnsFalse() +Private Sub Every_MultiDimArrayOfDifferentString_ReturnsFalse() On Error GoTo TestFail 'Arrange: @@ -7484,7 +7484,7 @@ TestFail: End Sub '@TestMethod("BetterArray_EveryType") -Private Sub EveryType_MiltiDimArrayOfSameString_ReturnsTrue() +Private Sub EveryType_MultiDimArrayOfSameString_ReturnsTrue() On Error GoTo TestFail 'Arrange: @@ -7511,7 +7511,7 @@ TestFail: End Sub '@TestMethod("BetterArray_EveryType") -Private Sub EveryType_MiltiDimArrayOfDifferentString_ReturnsFalse() +Private Sub EveryType_MultiDimArrayOfDifferentString_ReturnsFalse() On Error GoTo TestFail 'Arrange: @@ -8499,5 +8499,3 @@ TestExit: TestFail: Assert.Fail "Test raised an error: #" & Err.Number & " - " & Err.Description End Sub - - diff --git a/src/TestUtils.bas b/src/TestUtils.bas index 88cf0d3..abe8817 100644 --- a/src/TestUtils.bas +++ b/src/TestUtils.bas @@ -119,7 +119,7 @@ End Sub ' Helper Functions ' '''''''''''''''''''' -Public Function SequenceEqualsMutiVsJagged( _ +Public Function SequenceEqualsMultiVsJagged( _ ByRef multi() As Variant, _ ByRef jagged() As Variant _ ) As Boolean @@ -134,7 +134,7 @@ Public Function SequenceEqualsMutiVsJagged( _ Next On Error GoTo 0 - SequenceEqualsMutiVsJagged = True + SequenceEqualsMultiVsJagged = True Exit Function ErrHandler: On Error GoTo 0 From 5b91ae630fd93a786be38a2924ba08353920d2d4 Mon Sep 17 00:00:00 2001 From: Stefan Pinnow Date: Thu, 18 Jan 2024 21:07:49 +0100 Subject: [PATCH 3/5] chore: improve/harmonize formatting --- src/ArrayGenerator.cls | 12 +- src/BetterArray.cls | 107 ++-- src/Profiling.bas | 2 - src/SortingTests.bas | 2 - src/TestModule_ArrayGenerator.bas | 283 ++++++----- src/TestModule_BetterArray.bas | 782 +++++++++++++++--------------- src/TestModule_ExcelProvider.bas | 13 +- src/ValuesList_Booleans.cls | 2 - src/ValuesList_Bytes.cls | 2 - src/ValuesList_Doubles.cls | 1 - src/ValuesList_Variants.cls | 1 - 11 files changed, 593 insertions(+), 614 deletions(-) diff --git a/src/ArrayGenerator.cls b/src/ArrayGenerator.cls index 1b0348d..aad4be1 100644 --- a/src/ArrayGenerator.cls +++ b/src/ArrayGenerator.cls @@ -64,7 +64,7 @@ Public Function GetArray( _ ) As Variant Dim LocalLength As Long Dim Vals As IValuesList - + LocalLength = IIf(Length <= 0, 1, Length) Select Case ValueType @@ -122,10 +122,10 @@ Public Function ConcatArraysOfSameStructure( _ Else ReDim Result(UpperBound) For Each Arg In Args - If IsArray(Arg) Then - CurrentArray = Arg - CurrentIndex = LocalConcat(CurrentIndex, Result, CurrentArray) - End If + If IsArray(Arg) Then + CurrentArray = Arg + CurrentIndex = LocalConcat(CurrentIndex, Result, CurrentArray) + End If Next End If End If @@ -263,5 +263,3 @@ End Function Private Function GetUpperBound(ByVal Length As Long) As Long GetUpperBound = Length + pLowerBound - 1 End Function - - diff --git a/src/BetterArray.cls b/src/BetterArray.cls index 0ea4e71..6ddcf63 100644 --- a/src/BetterArray.cls +++ b/src/BetterArray.cls @@ -348,12 +348,12 @@ End Property Public Function Push(ParamArray Args() As Variant) As Variant Attribute Push.VB_Description = "Adds the provided arguments to the array at the next available index." Dim Element As Variant - + If This.ArrayType = ArrayTypes.BA_UNALLOCATED Or _ - This.ArrayType = ArrayTypes.BA_UNDEFINED Then + This.ArrayType = ArrayTypes.BA_UNDEFINED Then This.ArrayType = ArrayTypes.BA_ONEDIMENSION End If - + For Each Element In Args If This.Length = This.Capacity Then EnsureCapacity This.Length + 1 @@ -698,7 +698,7 @@ Public Function FromExcelRange( _ Optional ByVal DetectLastColumn As Boolean _ ) As BetterArray Attribute FromExcelRange.VB_Description = "Stores the values contained in an Excel range in the internal array" - + If TypeName(FromRange) = "Range" Then Dim StartColumn As Long Dim EndColumn As Long @@ -752,7 +752,7 @@ Attribute ExtractSegment.VB_Description = "Extracts the segment of the array loc Dim Result() As Variant LocalItems = InternalItems - + If RowIndex = MISSING_LONG Then If ColumnIndex = MISSING_LONG Then ' if no coords provided return full array @@ -849,7 +849,7 @@ Attribute ToExcelRange.VB_Description = "Writes the values stored in the array t Dim AvailableColumns As Long Dim DestType As String Dim DestApplication As String - + On Error Resume Next DestType = TypeName(Destination) DestApplication = Destination.Application.Name @@ -982,9 +982,9 @@ Attribute IndexOf.VB_Description = "returns the first index at which a given ele IndexOf = MISSING_LONG Exit Function End If - + LocalItems = InternalItems - + If FromIndex = MISSING_LONG Then RelativeStart = LBound(LocalItems) Else @@ -1043,7 +1043,7 @@ Attribute LastIndexOf.VB_Description = "returns the first index at which a given LastIndexOf = MISSING_LONG Exit Function End If - + LocalItems = InternalItems If FromIndex = MISSING_LONG Then @@ -1175,7 +1175,7 @@ Attribute Splice.VB_Description = "changes the contents of the array by removing RaiseError EC_EXCEEDS_MAX_ARRAY_LENGTH, "Splice" Exit Function End If - + ' get items to be deleted for return val If ActualDeleteCount > 0 Then ReDim Result(0 To ActualDeleteCount - 1) @@ -1625,7 +1625,6 @@ Public Function Filter( _ Include, _ Recurse _ ) - End If End Select Me.Items = Result @@ -1678,10 +1677,9 @@ Attribute FilterType.VB_Description = "Filters the stored array to include only Recurse, _ True _ ) - End If End Select - + Me.Items = Result If LocalType = BA_MULTIDIMENSION Then This.ArrayType = LocalType Set FilterType = Me @@ -1712,7 +1710,7 @@ Public Function Flatten() As BetterArray Attribute Flatten.VB_Description = "Flattens a Multi-Dimensional or Jagged array into One Dimension arrays." Dim LocalItems() As Variant Dim Result As BetterArray - + ' noop on 1d or unalloc ' md & jagged both stored as jagged Select Case This.ArrayType @@ -1725,7 +1723,7 @@ Attribute Flatten.VB_Description = "Flattens a Multi-Dimensional or Jagged array RecursiveFlatten LocalItems, Result Me.Items = Result.Items End Select - + Set Flatten = Me End Function @@ -1799,7 +1797,6 @@ Attribute Unique.VB_Description = "filters the array to contain only unique elem Result.Push LocalItems(i) End If Next - End If Else ' no columnIndex arg or array is one-dimension @@ -1811,7 +1808,6 @@ Attribute Unique.VB_Description = "filters the array to contain only unique elem Next End If - Me.Items = Result.Items This.ArrayType = LocalType Set Unique = Me @@ -1872,7 +1868,7 @@ Attribute FromCSVString.VB_Description = "Accepts a string argument representing Else LocalType = BA_JAGGED End If - + Parsed = ParseCSV( _ Expression:=CSVString, _ ColumnDelimiter:=ColumnDelimiter, _ @@ -1883,12 +1879,12 @@ Attribute FromCSVString.VB_Description = "Accepts a string argument representing Base:=This.LowerBound, _ DuckType:=DuckType _ ) - + This.Length = GetArrayLength(Parsed) This.Capacity = UBound(Parsed) This.ArrayType = LocalType This.Items = Parsed - + Set FromCSVString = Me End Function @@ -2388,10 +2384,10 @@ Attribute GetCSVRows.VB_Description = "Splits the provided string into rows base Dim i As Long Dim Cursor As Long Dim CSVRows() As String - + ' find first row delimiter RowDelimIndex = NextDelimBytePos(Expr, RowDelim) - + ' find last row delimiter LastRowDelim = InStrRev(Expr.Text, RowDelim.Text) RowIndex = Expr.Length + 1 @@ -2401,11 +2397,11 @@ Attribute GetCSVRows.VB_Description = "Splits the provided string into rows base inc BlankTrailingRows Loop RowIndex = Empty - + ' estimate max number of rows - does not account for line breaks within strings MaxRows = (Expr.Length - Len(Replace(Expr.Text, RowDelim.Text, vbNullString))) / RowDelim.Length + 1 ReDim LineEndIndices(0 To MaxRows) - + ' find first quote delimiter LiteralDelimIndex = NextDelimBytePos(Expr, LiteralDelim) @@ -2420,7 +2416,7 @@ Attribute GetCSVRows.VB_Description = "Splits the provided string into rows base ' quote delimiter before row delimiter ' find next quote delim LiteralDelimIndex = NextDelimBytePos(Expr, LiteralDelim, LiteralDelimIndex + 2) - ' see if closing quote delim found + ' see if closing quote delim found If LiteralDelimIndex Then ' find next row delim RowDelimIndex = NextDelimBytePos(Expr, RowDelim, LiteralDelimIndex + 2) @@ -2492,7 +2488,7 @@ Attribute ParseCSV.VB_Description = "Parses CSV string into a 2d or jagged array ' This header will contain names corresponding to the fields in the file and should contain the same number of fields as the records in the rest of the file. ' CSV commonly employs US-ASCII as character set, but other character sets are permitted. ' https://www.loc.gov/preservation/digital/formats/fdd/fdd000323.shtml - + Dim i As Long Dim j As Long Dim Cursor As Long @@ -2523,7 +2519,7 @@ Attribute ParseCSV.VB_Description = "Parses CSV string into a 2d or jagged array ParseCSV = Array() Exit Function End If - + CSVRows = GetCSVRows(Expr, RowDelim, LiteralDelim) CountColumns = CountCSVColumns(CSVRows(0), LiteralDelim, ColumnDelimiter) CountRows = UBound(CSVRows) - LBound(CSVRows) + 1 @@ -2626,7 +2622,7 @@ Attribute RecursiveEvery.VB_Description = "Recursively checks if the passed arra LocalLowerBound = LBound(SearchArray) If FromIndex > LocalLowerBound Then LocalLowerBound = FromIndex LocalUpperBound = UBound(SearchArray) - + For i = LocalLowerBound To LocalUpperBound If IsArray(SearchArray(i)) Then Dim PassThru() As Variant @@ -2921,7 +2917,7 @@ Private Function FilterByColumn( _ LocalUpperBound = UBound(SourceArray) Set Result = New BetterArray Result.LowerBound = This.LowerBound - + For i = LocalLowerBound To LocalUpperBound LetOrSetElement ComparisonElement, SourceArray(i)(ColumnIndex) If CompareTypeNames Then @@ -3511,7 +3507,6 @@ Attribute InsertionSort.VB_Description = "Sorts the passed array in place using ' Loop from the element indicated by ' `left` until the element indicated by `right` - For i = LeftIndex + 1 To RightIndex ' This is the element we want to position in its ' correct place @@ -3538,7 +3533,7 @@ Attribute InsertionSort.VB_Description = "Sorts the passed array in place using Exit Do End If Loop - + ' When you finish shifting the elements, position ' the `key_item` in its correct location '@Ignore UnassignedVariableUsage @@ -3572,7 +3567,7 @@ Attribute MergeSort.VB_Description = "Sorts the passed array in place using Merg LowLength = MidIndex - StartIndex + 1 HighLength = EndIndex - MidIndex - + ReDim LowPartition(0 To Max(LowLength - 1, 0)) ReDim HighPartition(0 To Max(HighLength - 1, 0)) @@ -3730,7 +3725,7 @@ Attribute QuickSortIterative.VB_Description = "Sorts in place a passed array usi Stack(inc(Top)) = LocalLow Stack(inc(Top)) = PartitionIndex - 1 End If - + ' If there are elements on right side of pivot, ' then push right side to stack If PartitionIndex + 1 < LocalHigh Then @@ -3807,7 +3802,7 @@ Attribute StringBuilder.VB_Description = "Efficiently concatenates string fragme Dim FragLength As Long Dim LastIndex As Long Dim i As Long - + FragLength = LenB(Fragment) If Cursor < 1 Or NewString Then Buffer = Fragment @@ -4006,7 +4001,7 @@ Private Function Rebase(Optional ByRef SourceArray As Variant, Optional ByVal Cu Attribute Rebase.VB_Description = "re-indexes array to conform to new bounds. Does not change length." Dim LocalItems() As Variant Dim LocalType As ArrayTypes - + If IsMissing(SourceArray) Or Not IsArray(SourceArray) Then LocalItems = InternalItems LocalType = This.ArrayType @@ -4177,7 +4172,7 @@ Attribute TypedMultiToVariantMulti.VB_Description = "Converts a typed md array t End If TypedMultiToVariantMulti = Result - + End Function '@Description("Returns an array representing the structure of a Multidimension array") @@ -4190,24 +4185,24 @@ Attribute MapMultidimensionArray.VB_Description = "Returns an array representing Dim LocalMap() As Variant Dim LocalDepth As Long Dim CurrentBounds(0 To 1) As Long - + If Not IsArray(SourceArray) Then Exit Function - + If KnownDepth > 0 Then LocalDepth = KnownDepth Else LocalDepth = GetMultidimensionalArrayDepth(SourceArray) End If - + ' crumbs are base 0 ReDim LocalMap(0 To LocalDepth - 1) - + For i = LBound(LocalMap) To UBound(LocalMap) CurrentBounds(0) = LBound(SourceArray, i + 1) CurrentBounds(1) = UBound(SourceArray, i + 1) LocalMap(i) = CurrentBounds Next - + MapMultidimensionArray = LocalMap End Function @@ -4232,19 +4227,19 @@ Attribute RecursiveTypedMultiToVariantMulti.VB_Description = "Recursively conver LocalDepth = Depth LocalCurrentDepth = CurrentDepth - + If IsMissing(Crumbs) Then ReDim LocalCrumbs(LocalDepth - 1) Else LocalCrumbs = Crumbs End If - + If IsMissing(Result) Then LocalResult = CreateMultidimensionalArray(MapMultidimensionArray(SourceArray, LocalDepth)) Else LocalResult = Result End If - + inc LocalCurrentDepth LocalLowerBound = LBound(SourceArray, LocalCurrentDepth) LocalUpperBound = UBound(SourceArray, LocalCurrentDepth) @@ -4268,7 +4263,7 @@ Attribute RecursiveTypedMultiToVariantMulti.VB_Description = "Recursively conver ) End If Next - + RecursiveTypedMultiToVariantMulti = LocalResult End Function @@ -4447,23 +4442,23 @@ Attribute RecursiveJaggedToMulti.VB_Description = "Recursively Converts jagged a Dim LocalCurrentDepth As Long Dim LocalCrumbs() As Variant Dim LocalResult() As Variant - - + + LocalDepth = Depth LocalCurrentDepth = CurrentDepth - + If IsMissing(Crumbs) Then ReDim LocalCrumbs(LocalDepth - 1) Else LocalCrumbs = Crumbs End If - + If IsMissing(Result) Then LocalResult = CreateMultidimensionalArray(MapJaggedArray(SourceArray, KnownDepth:=LocalDepth)) Else LocalResult = Result End If - + inc LocalCurrentDepth LocalLowerBound = LBound(SourceArray) LocalUpperBound = UBound(SourceArray) @@ -4568,22 +4563,22 @@ Attribute MapJaggedArray.VB_Description = "Returns an array representing the str Dim i As Long Dim LocalMap() As Variant Dim LocalDepth As Long - + If Not IsArray(SourceArray) Then Exit Function - + If KnownDepth > 0 Then LocalDepth = KnownDepth Else LocalDepth = GetJaggedArrayDepth(SourceArray) End If - + ' crumbs are base 0 ReDim LocalMap(0 To LocalDepth - 1) - + For i = LBound(LocalMap) To UBound(LocalMap) LocalMap(i) = GetMaxBoundsAtDimension(SourceArray, i + 1) Next - + MapJaggedArray = LocalMap End Function @@ -4747,7 +4742,7 @@ Attribute LetElementByBreadcrumb.VB_Description = "Assigns an element to a locat Crumb(10), Crumb(11), Crumb(12), Crumb(13), Crumb(14), Crumb(15), Crumb(16), Crumb(17), Crumb(18), Crumb(19), Crumb(20)), _ Element End Select - + LetElementByBreadcrumb = SourceArray End Function diff --git a/src/Profiling.bas b/src/Profiling.bas index 2649009..7378db9 100644 --- a/src/Profiling.bas +++ b/src/Profiling.bas @@ -119,7 +119,6 @@ Public Sub TransposingJaggedToExcel() i = i * 10 DoEvents Loop - End Sub Private Function TransposingByTranspose(ByVal Count As Long) As Double @@ -183,4 +182,3 @@ Public Sub CSV_Profiling() ReadCSV SUT, JoinPath(basepath, DATA_DIR), fileName Next End Sub - diff --git a/src/SortingTests.bas b/src/SortingTests.bas index 818923c..b62eaaf 100644 --- a/src/SortingTests.bas +++ b/src/SortingTests.bas @@ -231,5 +231,3 @@ Private Sub QSIterativeCSVSort(ByVal Size As DataSizes) Set SUT = GetCSVTestData(Size) TestSortMethod SUT, SM_QUICKSORT_ITERATIVE, 2 End Sub - - diff --git a/src/TestModule_ArrayGenerator.bas b/src/TestModule_ArrayGenerator.bas index 1daa668..4d73297 100644 --- a/src/TestModule_ArrayGenerator.bas +++ b/src/TestModule_ArrayGenerator.bas @@ -60,7 +60,7 @@ Private Sub Constructor_CanInstantiate_SUTNotNothing() 'Act: 'Assert: Assert.IsNotNothing SUT - + TestExit: Exit Sub TestFail: @@ -70,7 +70,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleansOneDimension_ValuesAreBoolean() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -85,7 +85,7 @@ Private Sub GetArray_BooleansOneDimension_ValuesAreBoolean() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -95,7 +95,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleansMultiDimension_ValuesAreBoolean() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -113,7 +113,7 @@ Private Sub GetArray_BooleansMultiDimension_ValuesAreBoolean() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -123,7 +123,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleansJagged_ValuesAreBoolean() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -141,7 +141,7 @@ Private Sub GetArray_BooleansJagged_ValuesAreBoolean() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -151,7 +151,7 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_BytesOneDimension_ValuesAreBytes() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -166,7 +166,7 @@ Private Sub GetArray_BytesOneDimension_ValuesAreBytes() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -176,11 +176,11 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_BytesMultiDimension_ValuesAreBytes() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long - + Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -195,7 +195,7 @@ Private Sub GetArray_BytesMultiDimension_ValuesAreBytes() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -205,7 +205,7 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_BytesJagged_ValuesAreBytes() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -223,7 +223,7 @@ Private Sub GetArray_BytesJagged_ValuesAreBytes() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -234,7 +234,7 @@ End Sub '@TestMethod("DoublesArrays") Private Sub GetArray_DoublesOneDimension_ValuesAreDoubles() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -249,7 +249,7 @@ Private Sub GetArray_DoublesOneDimension_ValuesAreDoubles() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -259,7 +259,7 @@ End Sub '@TestMethod("DoublesArrays") Private Sub GetArray_DoublesMultiDimension_ValuesAreDoubles() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -277,7 +277,7 @@ Private Sub GetArray_DoublesMultiDimension_ValuesAreDoubles() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -287,7 +287,7 @@ End Sub '@TestMethod("DoublesArrays") Private Sub GetArray_DoublesJagged_ValuesAreDoubles() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -305,7 +305,7 @@ Private Sub GetArray_DoublesJagged_ValuesAreDoubles() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -315,7 +315,7 @@ End Sub '@TestMethod("LongsArrays") Private Sub GetArray_LongsOneDimension_ValuesAreLongs() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -330,7 +330,7 @@ Private Sub GetArray_LongsOneDimension_ValuesAreLongs() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -340,11 +340,11 @@ End Sub '@TestMethod("LongsArrays") Private Sub GetArray_LongsMultiDimension_ValuesAreLongs() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long - + Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -359,7 +359,7 @@ Private Sub GetArray_LongsMultiDimension_ValuesAreLongs() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -369,7 +369,7 @@ End Sub '@TestMethod("LongsArrays") Private Sub GetArray_LongsJagged_ValuesAreLongs() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -387,7 +387,7 @@ Private Sub GetArray_LongsJagged_ValuesAreLongs() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -400,7 +400,7 @@ End Sub '@TestMethod("ObjectsArrays") Private Sub GetArray_ObjectsOneDimension_ValuesAreObjects() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -415,7 +415,7 @@ Private Sub GetArray_ObjectsOneDimension_ValuesAreObjects() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -425,7 +425,7 @@ End Sub '@TestMethod("ObjectsArrays") Private Sub GetArray_ObjectsMultiDimension_ValuesAreObjects() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -443,7 +443,7 @@ Private Sub GetArray_ObjectsMultiDimension_ValuesAreObjects() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -453,7 +453,7 @@ End Sub '@TestMethod("ObjectsArrays") Private Sub GetArray_ObjectsJagged_ValuesAreObjects() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -471,7 +471,7 @@ Private Sub GetArray_ObjectsJagged_ValuesAreObjects() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -484,7 +484,7 @@ End Sub '@TestMethod("StringsArrays") Private Sub GetArray_StringsOneDimension_ValuesAreStrings() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -499,7 +499,7 @@ Private Sub GetArray_StringsOneDimension_ValuesAreStrings() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -509,7 +509,7 @@ End Sub '@TestMethod("StringsArrays") Private Sub GetArray_StringsMultiDimension_ValuesAreStrings() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -527,7 +527,7 @@ Private Sub GetArray_StringsMultiDimension_ValuesAreStrings() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -537,7 +537,7 @@ End Sub '@TestMethod("StringsArrays") Private Sub GetArray_StringsJagged_ValuesAreStrings() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -555,7 +555,7 @@ Private Sub GetArray_StringsJagged_ValuesAreStrings() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -567,7 +567,7 @@ End Sub '@TestMethod("VariantsArrays") Private Sub GetArray_VariantsOneDimension_ValueTypesVary() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -586,7 +586,7 @@ Private Sub GetArray_VariantsOneDimension_ValueTypesVary() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -596,7 +596,7 @@ End Sub '@TestMethod("VariantsArrays") Private Sub GetArray_VariantsMultiDimension_ValueTypesVary() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -618,7 +618,7 @@ Private Sub GetArray_VariantsMultiDimension_ValueTypesVary() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -628,7 +628,7 @@ End Sub '@TestMethod("VariantsArrays") Private Sub GetArray_VariantsJagged_ValueTypesVary() On Error GoTo TestFail - + 'Arrange: Dim i As Long Dim j As Long @@ -650,7 +650,7 @@ Private Sub GetArray_VariantsJagged_ValueTypesVary() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -661,7 +661,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleanOneDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -672,7 +672,7 @@ Private Sub GetArray_BooleanOneDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -682,7 +682,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleanMultiDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -693,7 +693,7 @@ Private Sub GetArray_BooleanMultiDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -703,7 +703,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleanJagged_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -714,7 +714,7 @@ Private Sub GetArray_BooleanJagged_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -724,7 +724,7 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_ByteOneDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -735,7 +735,7 @@ Private Sub GetArray_ByteOneDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -745,7 +745,7 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_ByteMultiDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -756,7 +756,7 @@ Private Sub GetArray_ByteMultiDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -766,7 +766,7 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_ByteJagged_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -777,7 +777,7 @@ Private Sub GetArray_ByteJagged_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -788,7 +788,7 @@ End Sub '@TestMethod("DoubleArrays") Private Sub GetArray_DoubleOneDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -799,7 +799,7 @@ Private Sub GetArray_DoubleOneDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -809,7 +809,7 @@ End Sub '@TestMethod("DoubleArrays") Private Sub GetArray_DoubleMultiDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -820,7 +820,7 @@ Private Sub GetArray_DoubleMultiDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -830,7 +830,7 @@ End Sub '@TestMethod("DoubleArrays") Private Sub GetArray_DoubleJagged_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -841,7 +841,7 @@ Private Sub GetArray_DoubleJagged_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -851,7 +851,7 @@ End Sub '@TestMethod("LongArrays") Private Sub GetArray_LongOneDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -862,7 +862,7 @@ Private Sub GetArray_LongOneDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -872,7 +872,7 @@ End Sub '@TestMethod("LongArrays") Private Sub GetArray_LongMultiDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -883,7 +883,7 @@ Private Sub GetArray_LongMultiDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -893,7 +893,7 @@ End Sub '@TestMethod("LongArrays") Private Sub GetArray_LongJagged_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -904,7 +904,7 @@ Private Sub GetArray_LongJagged_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -914,7 +914,7 @@ End Sub '@TestMethod("ObjectArrays") Private Sub GetArray_ObjectOneDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -925,7 +925,7 @@ Private Sub GetArray_ObjectOneDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -935,7 +935,7 @@ End Sub '@TestMethod("ObjectArrays") Private Sub GetArray_ObjectMultiDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -946,7 +946,7 @@ Private Sub GetArray_ObjectMultiDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -956,7 +956,7 @@ End Sub '@TestMethod("ObjectArrays") Private Sub GetArray_ObjectJagged_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -967,7 +967,7 @@ Private Sub GetArray_ObjectJagged_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -977,7 +977,7 @@ End Sub '@TestMethod("StringArrays") Private Sub GetArray_StringOneDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -988,7 +988,7 @@ Private Sub GetArray_StringOneDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -998,7 +998,7 @@ End Sub '@TestMethod("StringArrays") Private Sub GetArray_StringMultiDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1009,7 +1009,7 @@ Private Sub GetArray_StringMultiDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1019,7 +1019,7 @@ End Sub '@TestMethod("StringArrays") Private Sub GetArray_StringJagged_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1030,7 +1030,7 @@ Private Sub GetArray_StringJagged_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1040,7 +1040,7 @@ End Sub '@TestMethod("VariantArrays") Private Sub GetArray_VariantOneDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1051,7 +1051,7 @@ Private Sub GetArray_VariantOneDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1061,7 +1061,7 @@ End Sub '@TestMethod("VariantArrays") Private Sub GetArray_VariantMultiDimension_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1072,7 +1072,7 @@ Private Sub GetArray_VariantMultiDimension_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1082,7 +1082,7 @@ End Sub '@TestMethod("VariantArrays") Private Sub GetArray_VariantJagged_ReturnsArray() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1093,7 +1093,7 @@ Private Sub GetArray_VariantJagged_ReturnsArray() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1103,7 +1103,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleanOneDimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1114,7 +1114,7 @@ Private Sub GetArray_BooleanOneDimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1124,7 +1124,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleanMultidimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1135,7 +1135,7 @@ Private Sub GetArray_BooleanMultidimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1145,7 +1145,7 @@ End Sub '@TestMethod("BooleanArrays") Private Sub GetArray_BooleanJagged_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1156,7 +1156,7 @@ Private Sub GetArray_BooleanJagged_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1166,7 +1166,7 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_ByteOneDimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1177,7 +1177,7 @@ Private Sub GetArray_ByteOneDimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1187,7 +1187,7 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_ByteMultidimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1198,7 +1198,7 @@ Private Sub GetArray_ByteMultidimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1208,7 +1208,7 @@ End Sub '@TestMethod("ByteArrays") Private Sub GetArray_ByteJagged_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1219,7 +1219,7 @@ Private Sub GetArray_ByteJagged_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1230,7 +1230,7 @@ End Sub '@TestMethod("DoubleArrays") Private Sub GetArray_DoubleOneDimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1241,7 +1241,7 @@ Private Sub GetArray_DoubleOneDimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1251,7 +1251,7 @@ End Sub '@TestMethod("DoubleArrays") Private Sub GetArray_DoubleMultidimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1262,7 +1262,7 @@ Private Sub GetArray_DoubleMultidimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1272,7 +1272,7 @@ End Sub '@TestMethod("DoubleArrays") Private Sub GetArray_DoubleJagged_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1283,7 +1283,7 @@ Private Sub GetArray_DoubleJagged_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1293,7 +1293,7 @@ End Sub '@TestMethod("LongArrays") Private Sub GetArray_LongOneDimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1304,7 +1304,7 @@ Private Sub GetArray_LongOneDimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1314,7 +1314,7 @@ End Sub '@TestMethod("LongArrays") Private Sub GetArray_LongMultidimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1325,7 +1325,7 @@ Private Sub GetArray_LongMultidimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1335,7 +1335,7 @@ End Sub '@TestMethod("LongArrays") Private Sub GetArray_LongJagged_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1346,7 +1346,7 @@ Private Sub GetArray_LongJagged_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1356,7 +1356,7 @@ End Sub '@TestMethod("ObjectArrays") Private Sub GetArray_ObjectOneDimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1367,7 +1367,7 @@ Private Sub GetArray_ObjectOneDimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1377,7 +1377,7 @@ End Sub '@TestMethod("ObjectArrays") Private Sub GetArray_ObjectMultidimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1388,7 +1388,7 @@ Private Sub GetArray_ObjectMultidimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1398,7 +1398,7 @@ End Sub '@TestMethod("ObjectArrays") Private Sub GetArray_ObjectJagged_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1409,7 +1409,7 @@ Private Sub GetArray_ObjectJagged_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1420,7 +1420,7 @@ End Sub '@TestMethod("StringArrays") Private Sub GetArray_StringOneDimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1431,7 +1431,7 @@ Private Sub GetArray_StringOneDimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1441,7 +1441,7 @@ End Sub '@TestMethod("StringArrays") Private Sub GetArray_StringMultidimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1452,7 +1452,7 @@ Private Sub GetArray_StringMultidimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1462,7 +1462,7 @@ End Sub '@TestMethod("StringArrays") Private Sub GetArray_StringJagged_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1473,7 +1473,7 @@ Private Sub GetArray_StringJagged_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1484,7 +1484,7 @@ End Sub '@TestMethod("VariantArrays") Private Sub GetArray_VariantOneDimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1495,7 +1495,7 @@ Private Sub GetArray_VariantOneDimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1505,7 +1505,7 @@ End Sub '@TestMethod("VariantArrays") Private Sub GetArray_VariantMultidimension_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1516,7 +1516,7 @@ Private Sub GetArray_VariantMultidimension_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1526,7 +1526,7 @@ End Sub '@TestMethod("VariantArrays") Private Sub GetArray_VariantJagged_IsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim ReturnedArray() As Variant Dim TestResult As Boolean @@ -1537,7 +1537,7 @@ Private Sub GetArray_VariantJagged_IsCorrectLength() 'Assert: Assert.IsTrue TestResult - + TestExit: Exit Sub TestFail: @@ -1549,7 +1549,7 @@ End Sub '@TestMethod("ArrayGenerator_ConcatArraysOfSameStructure") Private Sub ConcatArraysOfSameStructure_TwoMultiDimArrays_ConcatSuccess() On Error GoTo TestFail - + 'Arrange: Dim FirstArray(1, 1) As Variant Dim SecondArray(1, 1) As Variant @@ -1579,7 +1579,7 @@ Private Sub ConcatArraysOfSameStructure_TwoMultiDimArrays_ConcatSuccess() 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> Expected" - + TestExit: Exit Sub TestFail: @@ -1590,7 +1590,7 @@ End Sub '@TestMethod("ArrayGenerator_ConcatTwoDimensionArrays") Private Sub ConcatArraysOfSameStructures_ThreeMultiDimArrays_ConcatSuccess() On Error GoTo TestFail - + 'Arrange: Dim FirstArray(1, 1) As Variant Dim SecondArray(1, 1) As Variant @@ -1629,7 +1629,7 @@ Private Sub ConcatArraysOfSameStructures_ThreeMultiDimArrays_ConcatSuccess() 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> Expected" - + TestExit: Exit Sub TestFail: @@ -1639,7 +1639,7 @@ End Sub '@TestMethod("ArrayGenerator_ConcatArraysOfSameStructure") Private Sub ConcatArraysOfSameStructure_TwoOneDimArrays_ConcatSuccess() On Error GoTo TestFail - + 'Arrange: Dim FirstArray(1) As Variant Dim SecondArray(1) As Variant @@ -1661,7 +1661,7 @@ Private Sub ConcatArraysOfSameStructure_TwoOneDimArrays_ConcatSuccess() 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> Expected" - + TestExit: Exit Sub TestFail: @@ -1672,7 +1672,7 @@ End Sub '@TestMethod("ArrayGenerator_ConcatTwoDimensionArrays") Private Sub ConcatArraysOfSameStructures_ThreeOneDimArrays_ConcatSuccess() On Error GoTo TestFail - + 'Arrange: Dim FirstArray(1) As Variant Dim SecondArray(1) As Variant @@ -1699,7 +1699,7 @@ Private Sub ConcatArraysOfSameStructures_ThreeOneDimArrays_ConcatSuccess() 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> Expected" - + TestExit: Exit Sub TestFail: @@ -1710,7 +1710,7 @@ End Sub '@TestMethod("ArrayGenerator_ConcatArraysOfSameStructure") Private Sub ConcatArraysOfSameStructure_TwoJaggedArrays_ConcatSuccess() On Error GoTo TestFail - + 'Arrange: Dim FirstArray() As Variant Dim SecondArray() As Variant @@ -1729,7 +1729,7 @@ Private Sub ConcatArraysOfSameStructure_TwoJaggedArrays_ConcatSuccess() For i = LBound(Expected) To UBound(Expected) Assert.SequenceEquals Expected(i), Actual(i), "Actual <> Expected" Next - + TestExit: Exit Sub TestFail: @@ -1740,7 +1740,7 @@ End Sub '@TestMethod("ArrayGenerator_ConcatTwoDimensionArrays") Private Sub ConcatArraysOfSameStructures_ThreeJaggedArrays_ConcatSuccess() On Error GoTo TestFail - + 'Arrange: Dim FirstArray() As Variant Dim SecondArray() As Variant @@ -1773,7 +1773,7 @@ End Sub '@TestMethod("ArrayGenerator_GetArrayLength") Private Sub GetArrayLength_OneDimArray_ReturnsCorrectLength() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected As Long @@ -1793,4 +1793,3 @@ TestExit: TestFail: Assert.Fail "Test raised an error: #" & Err.Number & " - " & Err.Description End Sub - diff --git a/src/TestModule_BetterArray.bas b/src/TestModule_BetterArray.bas index 014a978..06d4f35 100644 --- a/src/TestModule_BetterArray.bas +++ b/src/TestModule_BetterArray.bas @@ -78,7 +78,7 @@ Private Sub Constructor_CanInstantiate_SUTNotNothing() 'Act: 'Assert: Assert.IsNotNothing SUT - + TestExit: Exit Sub TestFail: @@ -89,17 +89,17 @@ End Sub '@TestMethod("BetterArray_Constructor") Private Sub Constructor_CreatesWithDefaultCapacity_CapacityIsFour() On Error GoTo TestFail - + 'Arrange: Const Expected As Long = 4 Dim Actual As Long - + 'Act: Actual = SUT.Capacity - + 'Assert: Assert.AreEqual Expected, Actual, "Default capacity incorrect" - + TestExit: Exit Sub TestFail: @@ -114,12 +114,12 @@ End Sub '@TestMethod("BetterArray_Items") Private Sub Items_DefaultMember_DefaultMemberAccessReturnsItems() On Error GoTo TestFail - + 'Arrange: Dim Expected() As Variant Dim Actual() As Variant Dim i As Long - + Expected = Gen.GetArray() 'Act: @@ -128,10 +128,10 @@ Private Sub Items_DefaultMember_DefaultMemberAccessReturnsItems() SUT(i) = Expected(i) Next Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual array does not match expected" - + TestExit: Exit Sub TestFail: @@ -151,14 +151,14 @@ Private Sub Capacity_CanSetCapacity_ReturnedCapacityMatchesSetCapacity() 'Arrange: Const Expected As Long = 20 Dim Actual As Long - + 'Act: SUT.Capacity = Expected Actual = SUT.Capacity - + 'Assert: Assert.AreEqual Expected, Actual, "Returned capacity does not equal set capacity" - + TestExit: Exit Sub TestFail: @@ -177,16 +177,16 @@ Private Sub Items_CanAssignOneDimensionalArray_ReturnedArrayEqualsAssignedArray( 'Arrange: Dim Expected() As Variant Dim Actual() As Variant - + Expected = Gen.GetArray(AG_VARIANT, AG_ONEDIMENSION) - + 'Act: SUT.Items = Expected Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual array does not match expected" - + TestExit: Exit Sub TestFail: @@ -202,14 +202,14 @@ Private Sub Items_CanAssignMultiDimensionalArray_ReturnedArrayEqualsAssignedArra Dim Actual() As Variant Expected = Gen.GetArray(AG_VARIANT, AG_MULTIDIMENSION) - + 'Act: SUT.Items = Expected Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual array does not match expected" - + TestExit: Exit Sub TestFail: @@ -225,7 +225,7 @@ Private Sub Items_CanAssignJaggedArray_ReturnedArrayEqualsAssignedArray() Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + Expected = Gen.GetArray(AG_VARIANT, AG_JAGGED) 'Act: @@ -233,10 +233,10 @@ Private Sub Items_CanAssignJaggedArray_ReturnedArrayEqualsAssignedArray() Actual = SUT.Items TestResult = SequenceEquals_JaggedArray(Expected, Actual) - + 'Assert: Assert.IsTrue TestResult, "Contents of expected and actual do not match" - + TestExit: Exit Sub TestFail: @@ -256,13 +256,13 @@ Private Sub Length_NewUninitArray_EmptyArrayHasLengthZero() Dim Actual As Long Expected = 0 - + 'Act: Actual = SUT.Length - + 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected" - + TestExit: Exit Sub TestFail: @@ -284,10 +284,10 @@ Private Sub Length_FromAssignedOneDimensionalArray_ReturnedLengthEqualsOriginalA 'Act: SUT.Items = TestArray Actual = SUT.Length - + 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected" - + TestExit: Exit Sub TestFail: @@ -302,17 +302,17 @@ Private Sub Length_FromAssignedMultiDimensionalArray_ReturnedLengthEqualsOrigina Dim TestArray() As Variant Dim Expected As Long Dim Actual As Long - + Expected = TEST_ARRAY_LENGTH TestArray = Gen.GetArray(AG_VARIANT, AG_MULTIDIMENSION) - + 'Act: SUT.Items = TestArray Actual = SUT.Length 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected" - + TestExit: Exit Sub TestFail: @@ -327,17 +327,17 @@ Private Sub Length_FromAssignedJaggedArray_ReturnedLengthEqualsOriginalArray() Dim TestArray() As Variant Dim Expected As Long Dim Actual As Long - + Expected = TEST_ARRAY_LENGTH TestArray = Gen.GetArray(AG_VARIANT, AG_JAGGED) - + 'Act: SUT.Items = TestArray Actual = SUT.Length - + 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected" - + TestExit: Exit Sub TestFail: @@ -353,17 +353,17 @@ Private Sub UpperBound_FromAssignedOneDimensionalArray_ReturnedUpperBoundEqualsO Dim TestArray() As Variant Dim Expected As Long Dim Actual As Long - + TestArray = Gen.GetArray(AG_VARIANT, AG_ONEDIMENSION) Expected = UBound(TestArray) - + 'Act: SUT.Items = TestArray Actual = SUT.UpperBound - + 'Assert: Assert.AreEqual Expected, Actual, "Actual UpperBound <> expected" - + TestExit: Exit Sub TestFail: @@ -383,17 +383,17 @@ Private Sub LowerBound_FromAssignedOneDimensionalArray_ReturnedLowerBoundEqualsO Dim TestArray() As Variant Dim Expected As Long Dim Actual As Long - + TestArray = Gen.GetArray(AG_VARIANT, AG_ONEDIMENSION) Expected = LBound(TestArray) 'Act: SUT.Items = TestArray Actual = SUT.LowerBound - + 'Assert: Assert.AreEqual Expected, Actual, "Actual LowerBound <> expected" - + TestExit: Exit Sub TestFail: @@ -421,14 +421,14 @@ Private Sub LowerBound_ChangingLowerBoundOfAssignedArray_ReturnedArrayHasNewLowe SUT.LowerBound = Expected ReturnedItems = SUT.Items Actual = LBound(ReturnedItems) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual LowerBound <> expected" Assert.AreEqual SUT.LowerBound, Actual, "Actual LowerBound <> SUT.LowerBound prop" Assert.AreEqual UBound(TestArray) + 1, UBound(ReturnedItems), "Actual UpperBound <> expected" Assert.AreEqual SUT.UpperBound, UBound(ReturnedItems), "Actual UpperBound <> SUT.UpperBound prop" Assert.AreEqual SUT.Length, TEST_ARRAY_LENGTH, "Actual length does not equal expected" - + TestExit: Exit Sub TestFail: @@ -449,7 +449,7 @@ Private Sub Item_ChangingExistingIndex_ItemIsChanged() Dim Actual As Variant Dim ActualLowerBound As Long Dim ExpectedLowerBound As Long - + TestArray = Gen.GetArray(AG_VARIANT, AG_ONEDIMENSION) ExpectedLowerBound = LBound(TestArray) @@ -458,11 +458,11 @@ Private Sub Item_ChangingExistingIndex_ItemIsChanged() SUT.Item(1) = Expected Actual = SUT.Item(1) ActualLowerBound = SUT.LowerBound - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "Actual LowerBound does not equal expected LowerBound" - + TestExit: Exit Sub TestFail: @@ -493,7 +493,7 @@ Private Sub Item_ChangingIndexOverUpperBound_ItemIsPushed() Assert.AreEqual Expected, Actual, "Actual <> expected" Assert.AreEqual TEST_ARRAY_LENGTH + 1, SUT.Length, "Actual length does not match expected length" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "Actual LowerBound does not match expected LowerBound" - + TestExit: Exit Sub TestFail: @@ -510,7 +510,7 @@ Private Sub Item_ChangingIndexBelowLowerBound_ItemIsUnshifted() Dim Actual As Variant Dim ExpectedLowerBound As Long Dim ActualLowerBound As Long - + TestArray = Gen.GetArray(AG_VARIANT, AG_ONEDIMENSION) ExpectedLowerBound = LBound(TestArray) @@ -519,12 +519,12 @@ Private Sub Item_ChangingIndexBelowLowerBound_ItemIsUnshifted() SUT.Item(SUT.LowerBound - 10) = Expected Actual = SUT.Item(SUT.LowerBound) ActualLowerBound = SUT.LowerBound - + 'Assert: Assert.AreEqual Expected, Actual, "Actual result does not match expected result" Assert.AreEqual TEST_ARRAY_LENGTH + 1, SUT.Length, "Actual length does not match expected length" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "Actual LowerBound does not match expected LowerBound" - + TestExit: Exit Sub TestFail: @@ -540,17 +540,17 @@ Private Sub Item_GetScalarValue_ValueReturned() Dim TestArray() As Variant Dim Expected As Variant Dim Actual As Variant - + TestArray = Gen.GetArray(AG_VARIANT, AG_ONEDIMENSION) Expected = TestArray(1) 'Act: SUT.Items = TestArray Actual = SUT.Item(1) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -566,17 +566,17 @@ Private Sub Item_GetObject_SameObjectReturned() Dim TestArray() As Variant Dim Expected As Object Dim Actual As Object - + TestArray = Gen.GetArray(AG_OBJECT, AG_ONEDIMENSION) Set Expected = TestArray(1) 'Act: SUT.Items = TestArray Set Actual = SUT.Item(1) - + 'Assert: Assert.AreSame Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -600,10 +600,10 @@ Private Sub ArrayType_UnallocToUndefined_ThrowsError() NewType = ArrayTypes.BA_UNDEFINED 'Act: SUT.ArrayType = NewType - + Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -618,7 +618,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_UnallocToUnalloc_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -638,7 +638,7 @@ Private Sub ArrayType_UnallocToUnalloc_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual 0&, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -649,7 +649,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_UnallocToOneDimension_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -669,7 +669,7 @@ Private Sub ArrayType_UnallocToOneDimension_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual 0&, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -681,7 +681,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_UnallocToMultiDimension_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -701,7 +701,7 @@ Private Sub ArrayType_UnallocToMultiDimension_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual 0&, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -712,7 +712,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_UnallocToJagged_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -732,7 +732,7 @@ Private Sub ArrayType_UnallocToJagged_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual 0&, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -762,7 +762,7 @@ Private Sub ArrayType_OneDimensionToUndefined_ThrowsError() Assert.AreEqual NewType, SUT.ArrayType Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -777,7 +777,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_OneDimensionToUnalloc_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -800,7 +800,7 @@ Private Sub ArrayType_OneDimensionToUnalloc_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual 0&, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -811,7 +811,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_OneDimensionToOneDimension_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -834,7 +834,7 @@ Private Sub ArrayType_OneDimensionToOneDimension_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -846,7 +846,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_OneDimensionToMultiDimension_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -869,7 +869,7 @@ Private Sub ArrayType_OneDimensionToMultiDimension_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -881,7 +881,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_OneDimensionToJagged_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -904,7 +904,7 @@ Private Sub ArrayType_OneDimensionToJagged_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -932,10 +932,10 @@ Private Sub ArrayType_MultiDimensionToUndefined_ThrowsError() Assert.AreEqual StartingType, SUT.ArrayType SUT.ArrayType = NewType Assert.AreEqual NewType, SUT.ArrayType - + Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -950,7 +950,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_MultiDimensionToUnalloc_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -973,7 +973,7 @@ Private Sub ArrayType_MultiDimensionToUnalloc_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual 0&, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -1001,10 +1001,10 @@ Private Sub ArrayType_MultiDimensionToOneDimension_ThrowsError() Assert.AreEqual StartingType, SUT.ArrayType SUT.ArrayType = NewType Assert.AreEqual NewType, SUT.ArrayType - + Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -1019,7 +1019,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_MultiDimensionToMultiDimension_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -1042,7 +1042,7 @@ Private Sub ArrayType_MultiDimensionToMultiDimension_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -1054,7 +1054,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_MultiDimensionToJagged_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -1075,7 +1075,7 @@ Private Sub ArrayType_MultiDimensionToJagged_Success() Assert.IsTrue SequenceEqualsMultiVsJagged(TestArray, Actual) Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -1104,10 +1104,10 @@ Private Sub ArrayType_JaggedToUndefined_ThrowsError() Assert.AreEqual StartingType, SUT.ArrayType SUT.ArrayType = NewType Assert.AreEqual NewType, SUT.ArrayType - + Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -1123,7 +1123,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_JaggedToUnalloc_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -1146,7 +1146,7 @@ Private Sub ArrayType_JaggedToUnalloc_Success() Assert.SequenceEquals Expected, Actual, "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual 0&, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -1176,7 +1176,7 @@ Private Sub ArrayType_JaggedToOneDimension_ThrowsError() Assert.AreEqual NewType, SUT.ArrayType Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -1191,7 +1191,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_JaggedToMultiDimension_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -1212,7 +1212,7 @@ Private Sub ArrayType_JaggedToMultiDimension_Success() Assert.IsTrue SequenceEqualsMultiVsJagged(Actual, TestArray) Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -1223,7 +1223,7 @@ End Sub '@TestMethod("BetterArray_ArrayType") Private Sub ArrayType_JaggedToJagged_Success() On Error GoTo TestFail - + 'Arrange: Dim StartingType As ArrayTypes Dim NewType As ArrayTypes @@ -1246,7 +1246,7 @@ Private Sub ArrayType_JaggedToJagged_Success() Assert.IsTrue SequenceEquals_JaggedArray(Expected, Actual), "Expected undefined to return empty array" Assert.AreEqual NewType, SUT.ArrayType, "Actual type <> Expected" Assert.AreEqual TEST_ARRAY_LENGTH, SUT.Length, "Actual length <> Expected" - + TestExit: Exit Sub TestFail: @@ -1266,7 +1266,7 @@ Private Sub Push_AddToNewBetterArray_ItemAdded() Const Expected As String = "Hello World" Const ExpectedLength As Long = 1 Const ExpectedUpperBound As Long = 0 - + Dim Actual As String Dim ActualLength As Long Dim ActualUpperBound As Long @@ -1276,12 +1276,12 @@ Private Sub Push_AddToNewBetterArray_ItemAdded() Actual = SUT.Item(SUT.LowerBound) ActualLength = SUT.Length ActualUpperBound = SUT.UpperBound - + 'Assert: Assert.AreEqual Expected, Actual, "actual <> expected" Assert.AreEqual ExpectedLength, ActualLength, "Length value incorrect" Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" - + TestExit: Exit Sub TestFail: @@ -1294,7 +1294,7 @@ Private Sub Push_AddToExistingOneDimensionalArray_ItemAdded() 'Arrange: Const Expected As String = "Hello World" - + Dim TestArray() As Variant Dim Actual As String @@ -1304,11 +1304,11 @@ Private Sub Push_AddToExistingOneDimensionalArray_ItemAdded() SUT.Items = TestArray SUT.Push Expected Actual = SUT.Item(SUT.UpperBound) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" Assert.AreEqual TEST_ARRAY_LENGTH + 1, SUT.Length, "Length value incorrect" - + TestExit: Exit Sub TestFail: @@ -1324,7 +1324,7 @@ Private Sub Push_AddToExistingMultidimensionalArray_ItemAdded() Dim Actual As Variant Dim TestArray() As Variant Dim ReturnedArray() As Variant - + Expected = "Hello World" TestArray = Gen.GetArray(AG_VARIANT, AG_MULTIDIMENSION) @@ -1333,11 +1333,11 @@ Private Sub Push_AddToExistingMultidimensionalArray_ItemAdded() SUT.Push Expected ReturnedArray = SUT.Items Actual = ReturnedArray(UBound(ReturnedArray), LBound(ReturnedArray, 2)) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" Assert.AreEqual TEST_ARRAY_LENGTH + 1, SUT.Length, "Length value incorrect" - + TestExit: Exit Sub TestFail: @@ -1354,7 +1354,7 @@ Private Sub Push_AddToExistingJaggedArray_ItemAdded() Dim Actual As Variant Dim TestArray() As Variant Dim ReturnedArray() As Variant - + Expected = Gen.GetArray(AG_VARIANT, AG_ONEDIMENSION) TestArray = Gen.GetArray(AG_VARIANT, AG_JAGGED) @@ -1367,7 +1367,7 @@ Private Sub Push_AddToExistingJaggedArray_ItemAdded() 'Assert: Assert.SequenceEquals Expected, Actual, "Element value incorrect" Assert.AreEqual TEST_ARRAY_LENGTH + 1, SUT.Length, "Length value incorrect" - + TestExit: Exit Sub TestFail: @@ -1383,7 +1383,7 @@ Private Sub Push_AddMultipleToNewBetterArray_ItemsAdded() Const Expected As Long = 1 Const ExpectedLength As Long = 3 Const ExpectedUpperBound As Long = 2 - + Dim Actual As Long Dim ActualLength As Long Dim ActualUpperBound As Long @@ -1393,12 +1393,12 @@ Private Sub Push_AddMultipleToNewBetterArray_ItemsAdded() Actual = SUT.Item(SUT.LowerBound) ActualLength = SUT.Length ActualUpperBound = SUT.UpperBound - + 'Assert: Assert.AreEqual Expected, Actual, "Element value incorrect" Assert.AreEqual ExpectedLength, ActualLength, "Length value incorrect" Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" - + TestExit: Exit Sub TestFail: @@ -1426,10 +1426,10 @@ Private Sub Pop_ItemsRemovedByPopUntilEmpty_EmptyArrayHasLengthZero() SUT.Pop SUT.Pop Actual = SUT.Length - + 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected" - + TestExit: Exit Sub TestFail: @@ -1456,13 +1456,13 @@ Private Sub Pop_OneDimensionalArray_LastItemRemoved() 'Act: Actual = SUT.Pop ActualLowerBound = SUT.LowerBound - + 'Assert: Assert.AreEqual Expected, Actual, "Element value incorrect" Assert.AreEqual TEST_ARRAY_LENGTH - 1, SUT.Length, "Length value incorrect" Assert.AreEqual UBound(TestArray) - 1, SUT.UpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" - + TestExit: Exit Sub TestFail: @@ -1494,13 +1494,13 @@ Private Sub Pop_ArrayLengthIsZero_ReturnsEmpty() ActualLowerBound = SUT.LowerBound ActualLength = SUT.Length ActualUpperBound = SUT.UpperBound - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual ExpectedLength, ActualLength, "Length value incorrect" Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" - + TestExit: Exit Sub TestFail: @@ -1528,10 +1528,10 @@ Private Sub Shift_ItemsRemovedByShiftUntilEmpty_EmptyArrayHasLengthZero() SUT.Shift SUT.Shift Actual = SUT.Length - + 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected" - + TestExit: Exit Sub TestFail: @@ -1548,7 +1548,7 @@ Private Sub Shift_OneDimensionalArray_FirstItemRemoved() Dim ExpectedLowerBound As Long Dim Expected As String Dim Actual As String - + TestArray = Gen.GetArray(AG_STRING, AG_ONEDIMENSION) Expected = TestArray(LBound(TestArray)) ExpectedLowerBound = SUT.LowerBound @@ -1557,13 +1557,13 @@ Private Sub Shift_OneDimensionalArray_FirstItemRemoved() 'Act: Actual = SUT.Shift ActualLowerBound = SUT.LowerBound - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" Assert.AreEqual TEST_ARRAY_LENGTH - 1, SUT.Length, "Length value incorrect" Assert.AreEqual UBound(TestArray) - 1, SUT.UpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" - + TestExit: Exit Sub TestFail: @@ -1579,7 +1579,7 @@ Private Sub Shift_ArrayLengthIsZero_ReturnsEmpty() Const ExpectedLowerBound As Long = 0 Const ExpectedLength As Long = 0 Const ExpectedUpperBound As Long = -1 - + Dim Actual As Variant Dim ActualLowerBound As Long Dim ActualLength As Long @@ -1590,13 +1590,13 @@ Private Sub Shift_ArrayLengthIsZero_ReturnsEmpty() ActualLowerBound = SUT.LowerBound ActualLength = SUT.Length ActualUpperBound = SUT.UpperBound - + 'Assert: Assert.AreEqual Expected, Actual, "Element value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual ExpectedLength, ActualLength, "Length value incorrect" Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" - + TestExit: Exit Sub TestFail: @@ -1628,13 +1628,13 @@ Private Sub Unshift_OneDimensionalArray_ItemAddedToBeginning() 'Act: Actual = SUT.Unshift(TestElement) ActualLowerBound = SUT.LowerBound - + 'Assert: Assert.AreEqual Expected, Actual, "Return value incorrect" Assert.AreEqual (UBound(TestArray) + 1), SUT.UpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual TestElement, SUT.Item(SUT.LowerBound), "Element not inserted at correct position" - + TestExit: Exit Sub TestFail: @@ -1651,7 +1651,7 @@ Private Sub Unshift_ArrayLengthIsZero_ItemIsPushedToEmptyArray() Const ExpectedLowerBound As Long = 0 Const ExpectedUpperBound As Long = 0 Const ExpectedElement As String = "Hello World" - + Dim Actual As Long Dim ActualLowerBound As Long Dim ActualUpperBound As Long @@ -1662,13 +1662,13 @@ Private Sub Unshift_ArrayLengthIsZero_ItemIsPushedToEmptyArray() ActualLowerBound = SUT.LowerBound ActualUpperBound = SUT.UpperBound ActualElement = SUT.Item(SUT.LowerBound) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected length" Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual ExpectedElement, ActualElement, "Actual element <> expected" - + TestExit: Exit Sub TestFail: @@ -1685,14 +1685,14 @@ Private Sub Unshift_MultidimensionalArray_ItemAddedToBeginning() Const ExpectedLowerBound As Long = 0 Const ExpectedUpperBound As Long = TEST_ARRAY_LENGTH Const ExpectedElement As String = "Hello World" - + Dim Actual As Long Dim ActualLowerBound As Long Dim ActualUpperBound As Long Dim ActualElement As String Dim TestArray() As Variant Dim ReturnedItems() As Variant - + TestArray = Gen.GetArray(AG_VARIANT, AG_MULTIDIMENSION) SUT.Items = TestArray @@ -1702,13 +1702,13 @@ Private Sub Unshift_MultidimensionalArray_ItemAddedToBeginning() ActualLowerBound = SUT.LowerBound ActualUpperBound = SUT.UpperBound ActualElement = ReturnedItems(LBound(ReturnedItems), LBound(ReturnedItems, 2)) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual length <> expected length" Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "UpperBound value incorrect" Assert.AreEqual ExpectedLowerBound, ActualLowerBound, "LowerBound value incorrect" Assert.AreEqual ExpectedElement, ActualElement, "Actual element <> expected" - + TestExit: Exit Sub TestFail: @@ -1860,7 +1860,7 @@ Private Sub Concat_AddOneDimArrayToExistingOneDimArray_SuccessAdded() Assert.SequenceEquals Expected, Actual, "Actual <> Expected" Assert.AreEqual ExpectedLength, ActualLength, "Actual length <> expected" Assert.AreEqual ExpectedUpperBound, ActualUpperBound, "Actual UpperBound <> Expected" - + TestExit: Exit Sub TestFail: @@ -2349,7 +2349,7 @@ Private Sub ToString_FromOneDimArray_CorrectStringRepresentationReturned() 'Act: SUT.Items = TestArray Actual = SUT.ToString() - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2369,7 +2369,7 @@ Private Sub ToString_FromOneDimArrayPrettyPrint_CorrectStringRepresentationRetur 'Act: SUT.Items = TestArray Actual = SUT.ToString(PrettyPrint:=True) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2411,7 +2411,7 @@ Private Sub ToString_FromJaggedArray_CorrectStringRepresentationReturned() 'Act: SUT.Items = TestArray Actual = SUT.ToString() - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2436,7 +2436,7 @@ Private Sub ToString_FromJaggedArrayPrettyPrint_CorrectStringRepresentationRetur 'Act: SUT.Items = TestArray Actual = SUT.ToString(True) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2458,7 +2458,7 @@ Private Sub ToString_FromEmptyArray_CorrectStringRepresentationReturned() 'Act: SUT.Items = TestArray Actual = SUT.ToString() - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2479,7 +2479,7 @@ Private Sub ToString_FromEmptyArrayPrettyPrint_CorrectStringRepresentationReturn 'Act: SUT.Items = TestArray Actual = SUT.ToString() - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2506,7 +2506,7 @@ Private Sub IsSorted_SortedOneDimArray_ReturnsTrue() SUT.Items = TestArray 'Act: Actual = SUT.IsSorted - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2529,7 +2529,7 @@ Private Sub IsSorted_UnsortedOneDimArray_ReturnsFalse() SUT.Items = TestArray 'Act: Actual = SUT.IsSorted - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2555,7 +2555,7 @@ Private Sub IsSorted_SortedMultiDimArray_ReturnsTrue() SUT.Items = TestArray 'Act: Actual = SUT.IsSorted - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2581,7 +2581,7 @@ Private Sub IsSorted_UnsortedMultiDimArray_ReturnsFalse() SUT.Items = TestArray 'Act: Actual = SUT.IsSorted - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2605,7 +2605,7 @@ Private Sub IsSorted_SortedJaggedArray_ReturnsTrue() SUT.Items = TestArray 'Act: Actual = SUT.IsSorted(1) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2628,7 +2628,7 @@ Private Sub IsSorted_UnsortedJaggedArray_ReturnsFalse() SUT.Items = TestArray 'Act: Actual = SUT.IsSorted(1) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2648,7 +2648,7 @@ Private Sub IsSorted_EmptyArray_ReturnsTrue() Expected = True 'Act: Actual = SUT.IsSorted - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> Expected" TestExit: @@ -2661,7 +2661,7 @@ End Sub Private Sub IsSorted_JaggedArrayWithMoreThan2Dimensions_RaisesError() Const ExpectedError As Long = ErrorCodes.EC_EXCEEDS_MAX_SORT_DEPTH On Error GoTo TestFail - + 'Arrange Dim TestArray() As Variant '@Ignore VariableNotUsed @@ -2670,10 +2670,10 @@ Private Sub IsSorted_JaggedArrayWithMoreThan2Dimensions_RaisesError() SUT.Items = TestArray 'Act Actual = SUT.IsSorted - + Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -2704,7 +2704,7 @@ Private Sub Sort_OneDimArrayObjects_Throws() Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -3619,7 +3619,7 @@ Private Sub CopyWithin_EmptyInternal_RaisesError() Actual = SUT.CopyWithin(0, 3, 4).Items Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -3648,7 +3648,7 @@ Private Sub Filter_OneDimExclude_ReturnsFilteredArray() SUT.Items = TestArray 'Act: Actual = SUT.Filter("Bar").Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -3671,7 +3671,7 @@ Private Sub Filter_OneDimInclude_ReturnsFilteredArray() SUT.Items = TestArray 'Act: Actual = SUT.Filter("Bar", True).Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -3683,13 +3683,13 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_JaggedArrayExclude_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array("Foo", "Bar"), Array("Fizz", "Buzz")) Expected = Array(Array("Foo"), Array("Fizz", "Buzz")) SUT.Items = TestArray @@ -3707,16 +3707,16 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_JaggedArrayInclude_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array("Foo", "Bar"), Array("Fizz", "Buzz")) Expected = Array(Array("Bar")) - + SUT.Items = TestArray 'Act: Actual = SUT.Filter("Bar", True, True).Items @@ -3732,28 +3732,28 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_MultiDimArrayExclude_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = "Foo" TestArray(1, 2) = "Bar" TestArray(2, 1) = "Fizz" TestArray(2, 2) = "Buzz" - + ReDim Expected(1 To 2, 1 To 2) Expected(1, 1) = "Foo" Expected(2, 1) = "Fizz" Expected(2, 2) = "Buzz" - + SUT.Items = TestArray 'Act: SUT.Filter "Bar", False, True Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -3765,21 +3765,21 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_MultiDimArrayInclude_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = "Foo" TestArray(1, 2) = "Bar" TestArray(2, 1) = "Fizz" TestArray(2, 2) = "Buzz" - + ReDim Expected(1 To 1, 1 To 1) Expected(1, 1) = "Bar" - + SUT.Items = TestArray 'Act: Actual = SUT.Filter("Bar", True, True).Items @@ -3794,27 +3794,27 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_MultiDimArrayExcludeByColumn_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = "Foo" TestArray(1, 2) = "Bar" TestArray(2, 1) = "Fizz" TestArray(2, 2) = "Buzz" - + ReDim Expected(1 To 1, 1 To 2) Expected(1, 1) = "Fizz" Expected(1, 2) = "Buzz" - + SUT.Items = TestArray 'Act: SUT.Filter "Bar", False, True, 2 Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -3826,22 +3826,22 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_MultiDimArrayIncludeByColumn_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = "Foo" TestArray(1, 2) = "Bar" TestArray(2, 1) = "Fizz" TestArray(2, 2) = "Buzz" - + ReDim Expected(1 To 1, 1 To 2) Expected(1, 1) = "Foo" Expected(1, 2) = "Bar" - + SUT.Items = TestArray 'Act: Actual = SUT.Filter("Bar", True, True, 2).Items @@ -3857,13 +3857,13 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_JaggedArrayExcludeColumnIndex_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array("Foo", "Bar"), Array("Fizz", "Buzz")) Expected = Array(Array("Fizz", "Buzz")) SUT.Items = TestArray @@ -3881,16 +3881,16 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_JaggedArrayIncludeColumnIndex_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array("Foo", "Bar"), Array("Fizz", "Buzz")) Expected = Array(Array("Foo", "Bar")) - + SUT.Items = TestArray 'Act: Actual = SUT.Filter("Bar", True, True, 1).Items @@ -3906,25 +3906,25 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_MultiDimArrayExcludeByIncorrectColumn_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = "Foo" TestArray(1, 2) = "Bar" TestArray(2, 1) = "Fizz" TestArray(2, 2) = "Buzz" - + Expected = TestArray - + SUT.Items = TestArray 'Act: SUT.Filter "Bar", False, True, 1 Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -3936,20 +3936,20 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_MultiDimArrayIncludeByIncorrectColumn_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = "Foo" TestArray(1, 2) = "Bar" TestArray(2, 1) = "Fizz" TestArray(2, 2) = "Buzz" - + ReDim Expected(1 To 1) - + SUT.Items = TestArray 'Act: Actual = SUT.Filter("Bar", True, True, 1).Items @@ -3965,13 +3965,13 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_JaggedArrayExcludeIncorrectColumnIndex_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array("Foo", "Bar"), Array("Fizz", "Buzz")) Expected = TestArray SUT.Items = TestArray @@ -3989,16 +3989,16 @@ End Sub '@TestMethod("BetterArray_Filter") Private Sub Filter_JaggedArrayIncludeIncorrectColumnIndex_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array("Foo", "Bar"), Array("Fizz", "Buzz")) Expected = Array() - + SUT.Items = TestArray 'Act: Actual = SUT.Filter("Bar", True, True, 0).Items @@ -4029,7 +4029,7 @@ Private Sub FilterType_OneDimExclude_ReturnsFilteredArray() SUT.Items = TestArray 'Act: Actual = SUT.FilterType("double").Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -4052,7 +4052,7 @@ Private Sub FilterType_OneDimInclude_ReturnsFilteredArray() SUT.Items = TestArray 'Act: Actual = SUT.FilterType("string", True).Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -4064,13 +4064,13 @@ End Sub '@TestMethod("BetterArray_FilterType") Private Sub FilterType_JaggedArrayExclude_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array("Foo", 1.5), Array("Fizz", "Buzz")) Expected = Array(Array("Foo"), Array("Fizz", "Buzz")) SUT.Items = TestArray @@ -4088,16 +4088,16 @@ End Sub '@TestMethod("BetterArray_FilterType") Private Sub FilterType_JaggedArrayInclude_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array(1, "Bar"), Array(1.2, -4)) Expected = Array(Array("Bar")) - + SUT.Items = TestArray 'Act: Actual = SUT.FilterType("string", True, True).Items @@ -4113,28 +4113,28 @@ End Sub '@TestMethod("BetterArray_FilterType") Private Sub FilterType_MultiDimArrayExclude_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = "Foo" TestArray(1, 2) = 1.23 TestArray(2, 1) = "Fizz" TestArray(2, 2) = "Buzz" - + ReDim Expected(1 To 2, 1 To 2) Expected(1, 1) = "Foo" Expected(2, 1) = "Fizz" Expected(2, 2) = "Buzz" - + SUT.Items = TestArray 'Act: SUT.FilterType "double", False, True Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -4146,21 +4146,21 @@ End Sub '@TestMethod("BetterArray_FilterType") Private Sub FilterType_MultiDimArrayInclude_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = 1.23 TestArray(1, 2) = "Bar" TestArray(2, 1) = 123 TestArray(2, 2) = 5000 - + ReDim Expected(1 To 1, 1 To 1) Expected(1, 1) = "Bar" - + SUT.Items = TestArray 'Act: Actual = SUT.FilterType("string", True, True).Items @@ -4175,27 +4175,27 @@ End Sub '@TestMethod("BetterArray_FilterType") Private Sub FilterType_MultiDimArrayExcludeByColumn_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = 1.23 TestArray(1, 2) = "Bar" TestArray(2, 1) = 123 TestArray(2, 2) = 5000 - + ReDim Expected(1 To 1, 1 To 2) Expected(1, 1) = 123 Expected(1, 2) = 5000 - + SUT.Items = TestArray 'Act: SUT.FilterType "string", False, True, 2 Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -4207,22 +4207,22 @@ End Sub '@TestMethod("BetterArray_FilterType") Private Sub FilterType_MultiDimArrayIncludeByColumn_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant - + ReDim TestArray(1 To 2, 1 To 2) TestArray(1, 1) = "Foo" TestArray(1, 2) = 1.23 TestArray(2, 1) = "Fizz" TestArray(2, 2) = "Buzz" - + ReDim Expected(1 To 1, 1 To 2) Expected(1, 1) = "Foo" Expected(1, 2) = 1.23 - + SUT.Items = TestArray 'Act: Actual = SUT.FilterType("double", True, True, 2).Items @@ -4238,13 +4238,13 @@ End Sub '@TestMethod("BetterArray_FilterType") Private Sub FilterType_JaggedArrayExcludeColumnIndex_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array(1, "Bar"), Array(1.2, -4)) Expected = Array(Array(1.2, -4)) SUT.Items = TestArray @@ -4262,16 +4262,16 @@ End Sub '@TestMethod("BetterArray_FilterType") Private Sub FilterType_JaggedArrayIncludeColumnIndex_ReturnsFilteredArray() On Error GoTo TestFail - + 'Arrange: Dim TestArray() As Variant Dim Expected() As Variant Dim Actual() As Variant Dim TestResult As Boolean - + TestArray = Array(Array(1, "Bar"), Array(1.2, -4)) Expected = Array(Array(1, "Bar")) - + SUT.Items = TestArray 'Act: Actual = SUT.FilterType("string", True, True, 1).Items @@ -4639,7 +4639,7 @@ Private Sub Keys_EmptyInternal_RaisesUnallocError() Actual = SUT.Keys Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -4670,7 +4670,7 @@ Private Sub Max_OneDimArrayNumericInternal_ReturnsLargest() SUT.Items = TestArray 'Act: Actual = SUT.Max - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -4693,7 +4693,7 @@ Private Sub Max_OneDimArrayStringsInternal_ReturnsLargest() SUT.Items = TestArray 'Act: Actual = CStr(SUT.Max) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -4740,7 +4740,7 @@ Private Sub Max_OneDimArrayObjects_ReturnsEmpty() SUT.Items = TestArray 'Act: Actual = SUT.Max - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -4808,7 +4808,7 @@ Private Sub Max_JaggedArray_ReturnsLargest() Expected = 20 'Act: Actual = SUT.Max(TestArray) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -4828,7 +4828,7 @@ Private Sub Max_EmptyInternal_ReturnsEmpty() 'Act: Actual = SUT.Max - + 'Assert: Assert.AreSame Expected, Actual, "Actual <> expected" TestExit: @@ -4856,7 +4856,7 @@ Private Sub Min_OneDimArrayNumericInternal_ReturnsSmallest() SUT.Items = TestArray 'Act: Actual = SUT.Min - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -4879,7 +4879,7 @@ Private Sub Min_OneDimArrayStringsInternal_ReturnsSmallest() SUT.Items = TestArray 'Act: Actual = CStr(SUT.Min) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -4926,7 +4926,7 @@ Private Sub Min_OneDimArrayObjects_ReturnsEmpty() SUT.Items = TestArray 'Act: Actual = SUT.Min - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -4994,7 +4994,7 @@ Private Sub Min_JaggedArray_ReturnsSmallest() Expected = 1 'Act: Actual = SUT.Min(TestArray) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -5014,7 +5014,7 @@ Private Sub Min_EmptyInternal_ReturnsEmpty() 'Act: Actual = SUT.Min - + 'Assert: Assert.AreSame Expected, Actual, "Actual <> expected" TestExit: @@ -5170,7 +5170,7 @@ Private Sub Slice_JaggedNoEndArg_ReturnsCopy() Dim Actual() As Variant Dim TestResult As Boolean Expected = Gen.GetArray(ArrayType:=AG_JAGGED) - + SUT.Items = Expected 'Act: Actual = SUT.Slice(LBound(Expected)) @@ -5195,7 +5195,7 @@ Private Sub Slice_JaggedWithEndArg_ReturnsCopy() TestArray = Array(Array("Foo", "Bar"), Array("Fizz", "Buzz"), _ Array("Xyzzy", "flob"), Array("quux", "quuz")) - + Expected = Array(Array("Foo", "Bar"), Array("Fizz", "Buzz")) SUT.Items = TestArray @@ -5218,7 +5218,7 @@ Private Sub Slice_EmptyInternal_GracefulDegradation() 'Arrange: Dim Expected() As Variant Dim Actual() As Variant - + 'Act: Actual = SUT.Slice(1) 'Assert: @@ -5288,7 +5288,7 @@ Private Sub Reverse_MultiDimArray_ArrayIsReversed() Dim Actual() As Variant Dim TestResult As Boolean Dim i As Long - + Expected = Gen.GetArray(ArrayType:=AG_MULTIDIMENSION) SUT.Items = Expected 'Act: @@ -5400,7 +5400,7 @@ Private Sub Reverse_EmptyInternal_ReturnsEmpty() Expected(0) = Empty 'Act: Actual = SUT.Reverse.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -5429,7 +5429,7 @@ Private Sub Shuffle_OneDimArray_ArrayIsShuffled() SortedArray = SUT.Sort.Items 'Act: Actual = SUT.Shuffle.Items - + 'Assert: Assert.NotSequenceEquals SortedArray, Actual, "Array is not shuffled" TestExit: @@ -5453,7 +5453,7 @@ Private Sub Shuffle_OneDimArrayBase1_ArrayIsShuffled() SortedArray = SUT.Sort.Items 'Act: Actual = SUT.Shuffle.Items - + 'Assert: Assert.NotSequenceEquals SortedArray, Actual, "Array is not shuffled" TestExit: @@ -5476,7 +5476,7 @@ Private Sub Shuffle_MultiDimArray_ArrayIsShuffled() SortedArray = SUT.Sort.Items 'Act: Actual = SUT.Shuffle.Items - + 'Assert: Assert.NotSequenceEquals SortedArray, Actual, "Array is not shuffled" TestExit: @@ -5745,7 +5745,7 @@ Private Sub ToExcelRange_OneDimensionTransposed_WritesValuesCorrectly() Dim ExcelApp As ExcelProvider Dim Expected() As Variant Dim Actual(TEST_ARRAY_LENGTH - 1) As Variant - + Set ExcelApp = New ExcelProvider Set Destination = ExcelApp.CurrentWorksheet.Range("A1") @@ -5760,7 +5760,6 @@ Private Sub ToExcelRange_OneDimensionTransposed_WritesValuesCorrectly() Actual(i - 1) = ReturnedRange.Cells.Item(1, i).Value Next - 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -5782,7 +5781,7 @@ Private Sub ToExcelRange_TwoDimensionNotTransposed_WritesValuesCorrectly() Dim Actual As Object Dim TestResult As Boolean Dim Transposed As Boolean - + Set ExcelApp = New ExcelProvider Set Destination = ExcelApp.CurrentWorksheet.Range("A1") @@ -5814,7 +5813,7 @@ Private Sub ToExcelRange_TwoDimensionTransposed_WritesValuesCorrectly() Dim Actual As Object Dim TestResult As Boolean Dim Transposed As Boolean - + Set ExcelApp = New ExcelProvider Set Destination = ExcelApp.CurrentWorksheet.Range("A1") @@ -5877,7 +5876,7 @@ Private Sub ToExcelRange_JaggedDepthOfThree_WritesScalarRepresentationOfThirdDim Actual(i - 1, j - 1) = ReturnedRange.Cells.Item(i, j).Value Next Next - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -5901,7 +5900,7 @@ Private Sub ParseFromString_OneDimensionArrayFromToString_ReturnsCorrectValues() Dim Actual() As Variant Dim SourceString As String Dim TestResult As Boolean - + Set TempBetterArray = New BetterArray Expected = Gen.GetArray() TempBetterArray.Items = Expected @@ -6000,7 +5999,7 @@ Private Sub ParseFromString_Jagged5DeepArrayFromToString_ReturnsCorrectValues() 'Act: Actual = SUT.ParseFromString(Expected).ToString - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -6021,13 +6020,13 @@ Private Sub Flatten_OneDimArray_ReturnsSame() 'Arrange: Dim Expected() As Variant Dim Actual() As Variant - + Expected = Gen.GetArray SUT.Items = Expected 'Act: Actual = SUT.Flatten.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -6058,7 +6057,7 @@ Private Sub Flatten_MultiDimArray_ReturnsFlattened() 'Act: Actual = SUT.Flatten.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -6086,7 +6085,7 @@ Private Sub Flatten_JaggedArray_ReturnsFlattened() 'Act: Actual = SUT.Flatten.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -6107,7 +6106,7 @@ Private Sub Flatten_EmptyInternal_ReturnsArraySizeOne() 'Act: Actual = SUT.Flatten.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" TestExit: @@ -6193,7 +6192,7 @@ Private Sub Clone_OneDimArray_CloneIsNotOriginalItemsAreSame() Dim Expected() As Variant Dim Actual() As Variant Dim ClonedSUT As BetterArray - + Expected = Gen.GetArray SUT.Items = Expected @@ -6222,7 +6221,7 @@ Private Sub ExtractSegment_OneDimArrayNoArgs_FullArrayReturned() 'Arrange: Dim Expected() As Variant Dim Actual() As Variant - + Expected = Gen.GetArray SUT.Items = Expected @@ -6247,7 +6246,7 @@ Private Sub ExtractSegment_OneDimArrayJustRowArg_ArrayReturned() Dim Actual() As Variant Dim TestArray() As Variant Dim RowIndex As Long - + TestArray = Gen.GetArray SUT.Items = TestArray RowIndex = 2 @@ -6273,7 +6272,7 @@ Private Sub ExtractSegment_OneDimArrayJustColArg_ArrayReturned() Dim Actual() As Variant Dim TestArray() As Variant Dim ColumnIndex As Long - + TestArray = Gen.GetArray SUT.Items = TestArray ColumnIndex = 3 @@ -6300,7 +6299,7 @@ Private Sub ExtractSegment_OneDimArrayRowAndColArgs_ArrayReturned() Dim TestArray() As Variant Dim RowIndex As Long Dim ColumnIndex As Long - + TestArray = Gen.GetArray SUT.Items = TestArray RowIndex = 2 @@ -6325,7 +6324,7 @@ Private Sub ExtractSegment_JaggedArrayNoArgs_FullArrayReturned() 'Arrange: Dim Expected() As Variant Dim Actual() As Variant - + Expected = Gen.GetArray(ArrayType:=AG_JAGGED) SUT.Items = Expected @@ -6350,7 +6349,7 @@ Private Sub ExtractSegment_JaggedArrayJustRowArg_ArrayReturned() Dim Actual() As Variant Dim TestArray() As Variant Dim RowIndex As Long - + TestArray = Gen.GetArray(ArrayType:=AG_JAGGED) SUT.Items = TestArray RowIndex = 2 @@ -6377,7 +6376,7 @@ Private Sub ExtractSegment_JaggedArrayJustColArg_ArrayReturned() Dim TestArray() As Variant Dim ColumnIndex As Long Dim i As Long - + TestArray = Gen.GetArray(ArrayType:=AG_JAGGED) SUT.Items = TestArray ColumnIndex = 3 @@ -6407,7 +6406,7 @@ Private Sub ExtractSegment_JaggedDimArrayRowAndColArgs_ArrayReturned() Dim TestArray() As Variant Dim RowIndex As Long Dim ColumnIndex As Long - + TestArray = Gen.GetArray(ArrayType:=AG_JAGGED) SUT.Items = TestArray RowIndex = 2 @@ -6432,7 +6431,7 @@ Private Sub ExtractSegment_MultiDimArrayNoArgs_FullArrayReturned() 'Arrange: Dim Expected() As Variant Dim Actual() As Variant - + Expected = Gen.GetArray(ArrayType:=AG_MULTIDIMENSION) SUT.Items = Expected @@ -6458,7 +6457,7 @@ Private Sub ExtractSegment_MultiDimArrayJustRowArg_ArrayReturned() Dim TestArray() As Variant Dim RowIndex As Long Dim i As Long - + TestArray = Gen.GetArray(ArrayType:=AG_MULTIDIMENSION) SUT.Items = TestArray RowIndex = 2 @@ -6488,7 +6487,7 @@ Private Sub ExtractSegment_MultiDimArrayJustColArg_ArrayReturned() Dim TestArray() As Variant Dim ColumnIndex As Long Dim i As Long - + TestArray = Gen.GetArray(ArrayType:=AG_MULTIDIMENSION) SUT.Items = TestArray ColumnIndex = 3 @@ -6518,7 +6517,7 @@ Private Sub ExtractSegment_MultiDimDimArrayRowAndColArgs_ArrayReturned() Dim TestArray() As Variant Dim RowIndex As Long Dim ColumnIndex As Long - + TestArray = Gen.GetArray(ArrayType:=AG_MULTIDIMENSION) SUT.Items = TestArray RowIndex = 2 @@ -6548,11 +6547,10 @@ Private Sub Transpose_OneDimArray_ArrayTransposed() Dim Actual() As Variant Dim TestArray() As Variant Dim i As Long - + TestArray = Gen.GetArray() SUT.Items = TestArray - ReDim Expected(LBound(TestArray) To UBound(TestArray), _ LBound(TestArray) To LBound(TestArray)) For i = LBound(TestArray) To UBound(TestArray) @@ -6581,12 +6579,12 @@ Private Sub Transpose_JaggedArray_ArrayTransposed() Dim Nested() As Variant Dim i As Long Dim j As Long - + TestArray = Gen.GetArray(ArrayType:=AG_JAGGED) SUT.Items = TestArray ReDim Expected(0 To TEST_ARRAY_LENGTH - 1) - + For i = LBound(TestArray) To UBound(TestArray) ReDim Nested(0 To TEST_ARRAY_LENGTH - 1) For j = LBound(TestArray(i)) To UBound(TestArray(i)) @@ -6594,7 +6592,7 @@ Private Sub Transpose_JaggedArray_ArrayTransposed() Next Expected(i) = Nested Next -' + 'Act: Actual = SUT.Transpose.Items @@ -6616,7 +6614,7 @@ Private Sub Transpose_MultiDimArray_ArrayTransposed() Dim TestArray() As Variant Dim i As Long Dim j As Long - + TestArray = Gen.GetArray(ArrayType:=AG_MULTIDIMENSION) SUT.Items = TestArray @@ -6654,7 +6652,7 @@ Private Sub IndexOf_OneDimArrayValueExists_ReturnsCorrectIndex() Dim TestArray() As Variant Expected = 3 - + TestArray = Gen.GetArray() SUT.Items = TestArray @@ -6717,7 +6715,7 @@ Private Sub IndexOf_OneDimArrayLikeComparisonPatternNotString_ThrowsError() Actual = SUT.IndexOf(Pattern, , CT_LIKENESS) Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -6738,7 +6736,7 @@ Private Sub IndexOf_OneDimArrayValueMissing_ReturnsMISSING_LONG() Dim TestArray() As Variant Expected = MISSING_LONG - + TestArray = Gen.GetArray() SUT.Items = TestArray @@ -6763,7 +6761,7 @@ Private Sub IndexOf_JaggedArray_ReturnsCorrectIndex() Dim TestArray() As Variant Expected = 3 - + TestArray = Gen.GetArray(ArrayType:=AG_JAGGED) SUT.Items = TestArray @@ -6793,7 +6791,7 @@ Private Sub Unique_OneDimArray_ReturnsUniqueList() TestArray = Array(1, 2, 2, 1, 3, 4, 5, 5, 6, 3) Expected = Array(1, 2, 3, 4, 5, 6) - + SUT.Items = TestArray 'Act: @@ -6829,7 +6827,7 @@ Private Sub Unique_JaggedArray_ReturnsUniqueList() Array("Foo", "Bar"), _ Array("Foo", "Fizz") _ ) - + SUT.Items = TestArray 'Act: @@ -6868,7 +6866,7 @@ Private Sub Unique_JaggedArrayColumnIndexBase0_ReturnsUniqueList() Array(1, "Fizz", 3), _ Array(1, "Buzz", 3) _ ) - + SUT.Items = TestArray 'Act: @@ -6918,7 +6916,7 @@ Private Sub Unique_JaggedArrayColumnIndexBaseNegativeBase_ReturnsUniqueList() ' rebase nested items SUT.Items = Expected Expected = SUT.Items - + SUT.Items = TestArray 'Act: @@ -7111,7 +7109,7 @@ Private Sub Remove_MultiDimArray_RemovesElementAtIndex() Expected(1, 2) = "Bar" Expected(2, 1) = "Whizz" Expected(2, 2) = "Bang" - + ExpectedLength = Gen.GetArrayLength(Expected) SUT.Items = TestArray @@ -7243,7 +7241,7 @@ Private Sub Every_OneDimArrayOfSameString_ReturnsTrue() 'Assert: Assert.IsTrue Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7267,7 +7265,7 @@ Private Sub Every_OneDimArrayOfDifferentString_ReturnsFalse() 'Assert: Assert.IsFalse Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7291,7 +7289,7 @@ Private Sub Every_JaggedDimArrayOfSameString_ReturnsTrue() 'Assert: Assert.IsTrue Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7315,7 +7313,7 @@ Private Sub Every_JaggedDimArrayOfSameString_ReturnsFalse() 'Assert: Assert.IsFalse Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7342,7 +7340,7 @@ Private Sub Every_MultiDimArrayOfSameString_ReturnsTrue() 'Assert: Assert.IsTrue Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7369,7 +7367,7 @@ Private Sub Every_MultiDimArrayOfDifferentString_ReturnsFalse() 'Assert: Assert.IsFalse Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7398,7 +7396,7 @@ Private Sub EveryType_OneDimArrayOfSameString_ReturnsTrue() 'Assert: Assert.IsTrue Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7422,7 +7420,7 @@ Private Sub EveryType_OneDimArrayOfDifferentTypes_ReturnsFalse() 'Assert: Assert.IsFalse Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7449,7 +7447,7 @@ Private Sub EveryType_JaggedDimArrayOfSameString_ReturnsTrue() 'Assert: Assert.IsTrue Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7476,7 +7474,7 @@ Private Sub EveryType_JaggedDimArrayOfSameString_ReturnsFalse() 'Assert: Assert.IsFalse Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7503,7 +7501,7 @@ Private Sub EveryType_MultiDimArrayOfSameString_ReturnsTrue() 'Assert: Assert.IsTrue Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7530,7 +7528,7 @@ Private Sub EveryType_MultiDimArrayOfDifferentString_ReturnsFalse() 'Assert: Assert.IsFalse Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7555,7 +7553,7 @@ Private Sub Fill_OneDimArray2To4_SpecifiedIndicesFilled() TestArray = Gen.GetArray Const FillVal As Long = 0 - + Expected = TestArray Dim i As Long For i = 2 To 4 @@ -7569,7 +7567,7 @@ Private Sub Fill_OneDimArray2To4_SpecifiedIndicesFilled() 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7590,7 +7588,7 @@ Private Sub Fill_OneDimArray1ToEnd_SpecifiedIndicesFilled() TestArray = Gen.GetArray Const FillVal As Long = 5 - + Expected = TestArray Dim i As Long For i = 1 To UBound(Expected) @@ -7604,7 +7602,7 @@ Private Sub Fill_OneDimArray1ToEnd_SpecifiedIndicesFilled() 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7625,7 +7623,7 @@ Private Sub Fill_OneDimArrayAll_SpecifiedIndicesFilled() TestArray = Gen.GetArray Const FillVal As Long = 6 - + Expected = TestArray Dim i As Long For i = LBound(Expected) To UBound(Expected) @@ -7639,7 +7637,7 @@ Private Sub Fill_OneDimArrayAll_SpecifiedIndicesFilled() 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -7660,7 +7658,7 @@ Private Sub LastIndexOf_OneDimArrayValueExists_ReturnsCorrectIndex() Dim TestArray() As Variant Expected = 3 - + TestArray = Array("Dodo", "Tiger", "Penguin", "Dodo") SUT.Items = TestArray @@ -7723,7 +7721,7 @@ Private Sub LastIndexOf_OneDimArrayLikeComparisonPatternNotString_ThrowsError() Actual = SUT.IndexOf(Pattern, , CT_LIKENESS) Assert: Assert.Fail "Expected error was not raised" - + TestExit: Exit Sub TestFail: @@ -7737,20 +7735,20 @@ End Sub '@TestMethod("BetterArray_LastIndexOf") Private Sub LastIndexOf_OneDimArrayValueMissing_ReturnsMISSING_LONG() On Error GoTo TestFail - + 'Arrange: Dim Expected As Long Dim Actual As Long Dim TestArray() As Variant - + Expected = MISSING_LONG - + TestArray = Gen.GetArray() SUT.Items = TestArray - + 'Act: Actual = SUT.LastIndexOf("Foo") - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -7762,20 +7760,20 @@ End Sub '@TestMethod("BetterArray_LastIndexOf") Private Sub LastIndexOf_JaggedArray_ReturnsCorrectIndex() On Error GoTo TestFail - + 'Arrange: Dim Expected As Long Dim Actual As Long Dim TestArray() As Variant - + Expected = 3 - + TestArray = Gen.GetArray(ArrayType:=AG_JAGGED) SUT.Items = TestArray - + 'Act: Actual = SUT.LastIndexOf(TestArray(Expected)) - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" TestExit: @@ -7804,11 +7802,11 @@ Private Sub Splice_OneDimArrayInsertAtIndex1_Success() TestArray = Array("Jan", "March", "April", "June") SUT.Items = TestArray ReDim ExpectedResult(0) - + 'Act: ActualResult = SUT.Splice(1, 0, "Feb") Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" @@ -7829,7 +7827,7 @@ Private Sub Splice_OneDimArrayInsertAtIndex1Delete1_Success() Dim ActualResult() As Variant Dim ExpectedResult() As Variant - + Expected = Array("Jan", "Feb", "March", "April", "May") TestArray = Array("Jan", "Feb", "March", "April", "June") SUT.Items = TestArray @@ -7838,11 +7836,11 @@ Private Sub Splice_OneDimArrayInsertAtIndex1Delete1_Success() 'Act: ActualResult = SUT.Splice(4, 1, "May") Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -7861,7 +7859,7 @@ Private Sub Splice_OneDimArrayInsertAtIndex2Delete0Insert2_Success() Dim ActualResult() As Variant Dim ExpectedResult() As Variant - + Expected = Array("Banana", "Orange", "Lemon", "Kiwi", "Apple", "Mango") TestArray = Array("Banana", "Orange", "Apple", "Mango") SUT.Items = TestArray @@ -7870,11 +7868,11 @@ Private Sub Splice_OneDimArrayInsertAtIndex2Delete0Insert2_Success() 'Act: ActualResult = SUT.Splice(2, 0, "Lemon", "Kiwi") Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -7885,7 +7883,7 @@ End Sub '@TestMethod("BetterArray_Splice") Private Sub Splice_OneDimArrayInsertAtIndex2Delete1Insert2_Success() On Error GoTo TestFail - + 'Arrange: Dim Expected() As Variant Dim Actual() As Variant @@ -7893,7 +7891,7 @@ Private Sub Splice_OneDimArrayInsertAtIndex2Delete1Insert2_Success() Dim ActualResult() As Variant Dim ExpectedResult() As Variant - + Expected = Array("Banana", "Orange", "Lemon", "Kiwi", "Mango") TestArray = Array("Banana", "Orange", "Apple", "Mango") SUT.Items = TestArray @@ -7902,11 +7900,11 @@ Private Sub Splice_OneDimArrayInsertAtIndex2Delete1Insert2_Success() 'Act: ActualResult = SUT.Splice(2, 1, "Lemon", "Kiwi") Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -7917,7 +7915,7 @@ End Sub '@TestMethod("BetterArray_Splice") Private Sub Splice_OneDimArrayInsertAtIndex2Delete2Insert0_Success() On Error GoTo TestFail - + 'Arrange: Dim Expected() As Variant Dim Actual() As Variant @@ -7925,7 +7923,7 @@ Private Sub Splice_OneDimArrayInsertAtIndex2Delete2Insert0_Success() Dim ActualResult() As Variant Dim ExpectedResult() As Variant - + Expected = Array("Banana", "Orange", "Kiwi") TestArray = Array("Banana", "Orange", "Apple", "Mango", "Kiwi") SUT.Items = TestArray @@ -7934,11 +7932,11 @@ Private Sub Splice_OneDimArrayInsertAtIndex2Delete2Insert0_Success() 'Act: ActualResult = SUT.Splice(2, 2) Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -7955,7 +7953,7 @@ Private Sub Splice_OneDimArrayBase1InsertAtIndex2Delete0Insert2_Success() Dim TestArray() As Variant Dim ActualResult() As Variant Dim ExpectedResult() As Variant - + SUT.LowerBound = 1 ReDim Expected(1 To 6) @@ -7973,11 +7971,11 @@ Private Sub Splice_OneDimArrayBase1InsertAtIndex2Delete0Insert2_Success() 'Act: ActualResult = SUT.Splice(3, 0, "Lemon", "Kiwi") Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -7988,7 +7986,7 @@ End Sub '@TestMethod("BetterArray_Splice") Private Sub Splice_OneDimArrayBase1InsertAtIndex2Delete1Insert2_Success() On Error GoTo TestFail - + 'Arrange: Dim Expected() As Variant Dim Actual() As Variant @@ -8011,11 +8009,11 @@ Private Sub Splice_OneDimArrayBase1InsertAtIndex2Delete1Insert2_Success() 'Act: ActualResult = SUT.Splice(3, 1, "Lemon", "Kiwi") Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -8026,7 +8024,7 @@ End Sub '@TestMethod("BetterArray_Splice") Private Sub Splice_OneDimArrayBase1InsertAtIndex2Delete2Insert0_Success() On Error GoTo TestFail - + 'Arrange: Dim Expected() As Variant Dim Actual() As Variant @@ -8048,11 +8046,11 @@ Private Sub Splice_OneDimArrayBase1InsertAtIndex2Delete2Insert0_Success() 'Act: ActualResult = SUT.Splice(3, 2) Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -8080,7 +8078,7 @@ Private Sub Splice_OneDimArrayBaseNegative1InsertAtIndex2Delete0Insert2_Success( Expected(2) = "Kiwi" Expected(3) = "Apple" Expected(4) = "Mango" - + TestArray = Array("Banana", "Orange", "Apple", "Mango") SUT.Items = TestArray ReDim ExpectedResult(0) @@ -8088,11 +8086,11 @@ Private Sub Splice_OneDimArrayBaseNegative1InsertAtIndex2Delete0Insert2_Success( 'Act: ActualResult = SUT.Splice(1, 0, "Lemon", "Kiwi") Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -8103,7 +8101,7 @@ End Sub '@TestMethod("BetterArray_Splice") Private Sub Splice_OneDimArrayBaseNegative1InsertAtIndex2Delete1Insert2_Success() On Error GoTo TestFail - + 'Arrange: Dim Expected() As Variant Dim Actual() As Variant @@ -8126,11 +8124,11 @@ Private Sub Splice_OneDimArrayBaseNegative1InsertAtIndex2Delete1Insert2_Success( 'Act: ActualResult = SUT.Splice(1, 1, "Lemon", "Kiwi") Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -8141,7 +8139,7 @@ End Sub '@TestMethod("BetterArray_Splice") Private Sub Splice_OneDimArrayBaseNegative1InsertAtIndex2Delete2Insert0_Success() On Error GoTo TestFail - + 'Arrange: Dim Expected() As Variant Dim Actual() As Variant @@ -8162,11 +8160,11 @@ Private Sub Splice_OneDimArrayBaseNegative1InsertAtIndex2Delete2Insert0_Success( 'Act: ActualResult = SUT.Splice(1, 2) Actual = SUT.Items - + 'Assert: Assert.SequenceEquals Expected, Actual, "Actual <> expected" Assert.SequenceEquals ExpectedResult, ActualResult, "ActualResult <> expected" - + TestExit: Exit Sub TestFail: @@ -8181,7 +8179,7 @@ End Sub '@TestMethod("BetterArray_FromCSVString") Private Sub FromCSVString_Simple10RowWithHeaders_ReturnsJagged() On Error GoTo TestFail - + 'Arrange: Const TEST_DATA As String = _ "Region,Country A,Item Type,Sales Channel,Order Priority,Order Date,Order ID,Ship Date,Units Sold,Unit Price,Unit Cost,Total Revenue,Total Cost,Total Profit" & vbCrLf & _ @@ -8194,11 +8192,11 @@ Private Sub FromCSVString_Simple10RowWithHeaders_ReturnsJagged() "Asia , Laos, Vegetables, Online, L, 2 / 20 / 2011, 844532620, 3 / 20 / 2011, 4825, 154.06, 90.93, 743339.50, 438737.25, 304602.25" & vbCrLf & _ "Asia,China,Baby Food,Online,C,4/10/2017,564251220,5/12/2017,3330,255.28,159.42,850082.40,530868.60,319213.80" & vbCrLf & _ "Sub-Saharan Africa,Eritrea,Meat,Online,L,11/21/2014,411809480,1/10/2015,2431,421.89,364.69,1025614.59,886561.39,139053.20" - + Dim Expected() As Variant Dim Actual() As Variant ReDim Expected(0 To 9) - + Expected(0) = Array("Region", "Country A", "Item Type", "Sales Channel", "Order Priority", "Order Date", "Order ID", "Ship Date", "Units Sold", "Unit Price", "Unit Cost", "Total Revenue", "Total Cost", "Total Profit") Expected(1) = Array("Sub-Saharan Africa", "Chad", "Office Supplies", "Online", "L", "1/27/2011", "292494523", "2/12/2011", "4484", "651.21", "524.96", "2920025.64", "2353920.64", "566105.00") Expected(2) = Array("Europe", "Latvia", "Beverages", "Online", "C", "12 / 28 / 2015", "361825549", "1 / 23 / 2016", "1075", "47.45", "31.79", "51008.75", "34174.25", "16834.5") @@ -8209,13 +8207,13 @@ Private Sub FromCSVString_Simple10RowWithHeaders_ReturnsJagged() Expected(7) = Array("Asia", "Laos", "Vegetables", "Online", "L", "2 / 20 / 2011", "844532620", "3 / 20 / 2011", "4825", "154.06", "90.93", "743339.50", "438737.25", "304602.25") Expected(8) = Array("Asia", "China", "Baby Food", "Online", "C", "4/10/2017", "564251220", "5/12/2017", "3330", "255.28", "159.42", "850082.40", "530868.60", "319213.80") Expected(9) = Array("Sub-Saharan Africa", "Eritrea", "Meat", "Online", "L", "11/21/2014", "411809480", "1/10/2015", "2431", "421.89", "364.69", "1025614.59", "886561.39", "139053.20") - + 'Act: Actual = SUT.FromCSVString(TEST_DATA).Items - + 'Assert: Assert.IsTrue SequenceEquals_JaggedArray(Expected, Actual), "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -8225,7 +8223,7 @@ End Sub '@TestMethod("BetterArray_FromCSVString") Private Sub FromCSVString_RFC4180_ReturnsJagged() On Error GoTo TestFail - + 'Arrange: '@Ignore UseMeaningfulName Dim Line1 As String @@ -8242,11 +8240,11 @@ Private Sub FromCSVString_RFC4180_ReturnsJagged() Line2 = "1, 2, 3 ,4 " & vbCrLf Line3 = "Field 1, Field 2 , Field 3 , Field 4" CSVData = Line1 & Line2 & Line3 - + Dim Expected() As Variant Dim Actual() As Variant ReDim Expected(0 To 2) - + Expected(0) = Array( _ "Field with " & vbCrLf & "multiple lines", _ "Another field " & vbCrLf & "with some " & vbCrLf & "line breaks inside", _ @@ -8255,13 +8253,13 @@ Private Sub FromCSVString_RFC4180_ReturnsJagged() ) Expected(1) = Array("1", "2", "3", "4") Expected(2) = Array("Field 1", "Field 2", "Field 3", "Field 4") - + 'Act: Actual = SUT.FromCSVString(CSVData).Items - + 'Assert: Assert.IsTrue SequenceEquals_JaggedArray(Expected, Actual), "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -8271,28 +8269,28 @@ End Sub '@TestMethod("BetterArray_FromCSVString") Private Sub FromCSVString_NullString_ReturnsJagged() On Error GoTo TestFail - + 'Arrange: Dim CSVData As String CSVData = _ WrapQuoteUtil() & "," & vbCrLf & _ "," & WrapQuoteUtil() & " " & vbCrLf & _ "Field1,Field2" & vbCrLf - + Dim Expected() As Variant Dim Actual() As Variant ReDim Expected(0 To 2) - + Expected(0) = Array(vbNullString, vbNullString) Expected(1) = Array(vbNullString, vbNullString) Expected(2) = Array("Field1", "Field2") - + 'Act: Actual = SUT.FromCSVString(CSVData).Items - + 'Assert: Assert.IsTrue SequenceEquals_JaggedArray(Expected, Actual), "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -8306,7 +8304,7 @@ End Sub '@TestMethod("BetterArray_ToCSVString") Private Sub ToCSVString_Simple10RowWithHeaders_ValidStringReturned() On Error GoTo TestFail - + 'Arrange: Const Expected As String = _ "Region,Country,Item Type,Sales Channel,Order Priority,Order Date,Order ID,Ship Date,Units Sold,Unit Price,Unit Cost,Total Revenue,Total Cost,Total Profit" & vbCrLf & _ @@ -8319,12 +8317,12 @@ Private Sub ToCSVString_Simple10RowWithHeaders_ValidStringReturned() "Asia,Laos,Vegetables,Online,L,2/20/2011,844532620,3/20/2011,4825,154.06,90.93,743339.50,438737.25,304602.25" & vbCrLf & _ "Asia,China,Baby Food,Online,C,4/10/2017,564251220,5/12/2017,3330,255.28,159.42,850082.40,530868.60,319213.80" & vbCrLf & _ "Sub-Saharan Africa,Eritrea,Meat,Online,L,11/21/2014,411809480,1/10/2015,2431,421.89,364.69,1025614.59,886561.39,139053.20" - + Dim Headers() As Variant Dim TestDatum() As Variant Dim Actual As String ReDim TestDatum(0 To 8) - + Headers = Array("Region", "Country", "Item Type", "Sales Channel", "Order Priority", "Order Date", "Order ID", "Ship Date", "Units Sold", "Unit Price", "Unit Cost", "Total Revenue", "Total Cost", "Total Profit") TestDatum(0) = Array("Sub-Saharan Africa", "Chad", "Office Supplies", "Online", "L", "1/27/2011", "292494523", "2/12/2011", "4484", "651.21", "524.96", "2920025.64", "2353920.64", "566105.00") TestDatum(1) = Array("Europe", "Latvia", "Beverages", "Online", "C", "12/28/2015", "361825549", "1/23/2016", "1075", "47.45", "31.79", "51008.75", "34174.25", "16834.50") @@ -8335,14 +8333,14 @@ Private Sub ToCSVString_Simple10RowWithHeaders_ValidStringReturned() TestDatum(6) = Array("Asia", "Laos", "Vegetables", "Online", "L", "2/20/2011", "844532620", "3/20/2011", "4825", "154.06", "90.93", "743339.50", "438737.25", "304602.25") TestDatum(7) = Array("Asia", "China", "Baby Food", "Online", "C", "4/10/2017", "564251220", "5/12/2017", "3330", "255.28", "159.42", "850082.40", "530868.60", "319213.80") TestDatum(8) = Array("Sub-Saharan Africa", "Eritrea", "Meat", "Online", "L", "11/21/2014", "411809480", "1/10/2015", "2431", "421.89", "364.69", "1025614.59", "886561.39", "139053.20") - + 'Act: SUT.Items = TestDatum Actual = SUT.ToCSVString(Headers:=Headers) 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -8353,7 +8351,7 @@ End Sub '@TestMethod("BetterArray_ToCSVString") Private Sub ToCSVString_Simple10RowNoHeaders_ValidStringReturned() On Error GoTo TestFail - + 'Arrange: Const Expected As String = _ "Region,Country,Item Type,Sales Channel,Order Priority,Order Date,Order ID,Ship Date,Units Sold,Unit Price,Unit Cost,Total Revenue,Total Cost,Total Profit" & vbCrLf & _ @@ -8371,7 +8369,7 @@ Private Sub ToCSVString_Simple10RowNoHeaders_ValidStringReturned() Dim TestDatum() As Variant Dim Actual As String ReDim TestDatum(0 To 9) - + TestDatum(0) = Array("Region", "Country", "Item Type", "Sales Channel", "Order Priority", "Order Date", "Order ID", "Ship Date", "Units Sold", "Unit Price", "Unit Cost", "Total Revenue", "Total Cost", "Total Profit") TestDatum(1) = Array("Sub-Saharan Africa", "Chad", "Office Supplies", "Online", "L", "1/27/2011", "292494523", "2/12/2011", "4484", "651.21", "524.96", "2920025.64", "2353920.64", "566105.00") TestDatum(2) = Array("Europe", "Latvia", "Beverages", "Online", "C", "12/28/2015", "361825549", "1/23/2016", "1075", "47.45", "31.79", 51008.75, "34174.25", "16834.50") @@ -8382,14 +8380,14 @@ Private Sub ToCSVString_Simple10RowNoHeaders_ValidStringReturned() TestDatum(7) = Array("Asia", "Laos", "Vegetables", "Online", "L", "2/20/2011", "844532620", "3/20/2011", "4825", "154.06", "90.93", "743339.50", "438737.25", "304602.25") TestDatum(8) = Array("Asia", "China", "Baby Food", "Online", "C", "4/10/2017", "564251220", "5/12/2017", "3330", "255.28", "159.42", "850082.40", "530868.60", "319213.80") TestDatum(9) = Array("Sub-Saharan Africa", "Eritrea", "Meat", "Online", "L", "11/21/2014", "411809480", "1/10/2015", "2431", "421.89", "364.69", "1025614.59", "886561.39", "139053.20") - + 'Act: SUT.Items = TestDatum Actual = SUT.ToCSVString() 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -8400,7 +8398,7 @@ End Sub '@TestMethod("BetterArray_ToCSVString") Private Sub ToCSVString_1DArray_ValidStringReturned() On Error GoTo TestFail - + 'Arrange: Const Expected As String = _ "Region" & vbCrLf & _ @@ -8417,19 +8415,19 @@ Private Sub ToCSVString_1DArray_ValidStringReturned() "Total Revenue" & vbCrLf & _ "Total Cost" & vbCrLf & _ "Total Profit" - + Dim TestDatum() As Variant Dim Actual As String - + TestDatum = Array("Region", "Country A", "Item Type", "Sales Channel", "Order Priority", "Order Date", "Order ID", "Ship Date", "Units Sold", "Unit Price", "Unit Cost", "Total Revenue", "Total Cost", "Total Profit") - + 'Act: SUT.Items = TestDatum Actual = SUT.ToCSVString() - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -8440,29 +8438,29 @@ End Sub '@TestMethod("BetterArray_ToCSVString") Private Sub ToCSVString_Simple2RowNoHeadersDatesAndDoubles_ValidStringReturned() On Error GoTo TestFail - + 'Arrange: Const Expected As String = _ "Sub-Saharan Africa,Chad,Office Supplies,Online,L,1/27/2011,""292,494,523.00"",12/02/2011,""4,484.00"",651.21,524.96,""2,920,025.64"",""2,353,920.64"",""566,105.00""" & vbCrLf & _ "Europe,Latvia,Beverages,Online,C,12/28/2015,""361,825,549.00"",1/23/2016,""1,075.00"",47.45,31.79,""51,008.75"",""34,174.25"",""16,834.50""" - - + + Dim TestDatum() As Variant Dim Actual As String ReDim TestDatum(0 To 1) - + TestDatum(0) = Array("Sub-Saharan Africa", "Chad", "Office Supplies", "Online", "L", CDate("1/27/2011"), "292494523", CDate("2/12/2011"), 4484, 651.21, 524.96, 2920025.64, 2353920.64, 566105#) TestDatum(1) = Array("Europe", "Latvia", "Beverages", "Online", "C", CDate("12/28/2015"), "361825549", CDate("1/23/2016"), 1075, 47.45, 31.79, 51008.75, 34174.25, 16834.5) 'Act: SUT.Items = TestDatum Actual = SUT.ToCSVString(DateFormat:="m/dd/yyyy", NumberFormat:="#,##0.00") - + ' TestUtils.PrintExpectedActualStringsToConsole expected, actual - + 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -8473,27 +8471,27 @@ End Sub '@TestMethod("BetterArray_ToCSVString") Private Sub ToCSVString_Simple2RowNoHeadersEscapeCommasQuotesAndCRLF_ValidStringReturned() On Error GoTo TestFail - + 'Arrange: Const Expected As String = _ """Sub-Saharan, Africa"",Chad,""Office" & vbCrLf & "Supplies"",Online,L,1/27/2011,292494523,2/12/2011,4484,651.21,524.96,2920025.64,2353920.64,566105.00" & vbCrLf & _ "Europe,Latvia,Bever""""ages,Online,C,12/28/2015,361825549,1/23/2016,1075,47.45,31.79,51008.75,34174.25,16834.50" - - + + Dim TestDatum() As Variant Dim Actual As String ReDim TestDatum(0 To 1) TestDatum(0) = Array("Sub-Saharan, Africa", "Chad", "Office" & vbCrLf & "Supplies", "Online", "L", "1/27/2011", "292494523", "2/12/2011", "4484", "651.21", "524.96", "2920025.64", "2353920.64", "566105.00") TestDatum(1) = Array("Europe", "Latvia", "Bever""ages", "Online", "C", "12/28/2015", "361825549", "1/23/2016", "1075", "47.45", "31.79", 51008.75, "34174.25", "16834.50") - + 'Act: SUT.Items = TestDatum Actual = SUT.ToCSVString() 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: diff --git a/src/TestModule_ExcelProvider.bas b/src/TestModule_ExcelProvider.bas index 682a05d..bbc6cc5 100644 --- a/src/TestModule_ExcelProvider.bas +++ b/src/TestModule_ExcelProvider.bas @@ -57,12 +57,12 @@ Private Sub Constructor_CanInstantiate_SUTNotNothing() On Error GoTo TestFail 'Arrange: - + 'Act: - + 'Assert: Assert.IsNotNothing SUT - + TestExit: Exit Sub TestFail: @@ -83,7 +83,7 @@ Private Sub ExcelApplication_ReturnsExcelInstance_InstanceIsCorrectType() 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -108,7 +108,7 @@ Private Sub CurrentWorkbook_ReturnsWorkbook_CurrentWorkbookNotNothing() 'Assert: Assert.AreEqual Expected, Actual, "Actual <> expected" - + TestExit: Exit Sub TestFail: @@ -149,7 +149,7 @@ Private Sub CurrentWorksheet_ReturnsWorksheet_WorksheetIsChildOfCurrentWorkbook( 'Act: Set Expected = SUT.CurrentWorkbook Set Actual = SUT.CurrentWorksheet - + 'Assert: Assert.AreSame Expected, Actual.Parent, "actual <> expected" TestExit: @@ -181,4 +181,3 @@ TestExit: TestFail: Assert.Fail "Test raised an error: #" & Err.Number & " - " & Err.Description End Sub - diff --git a/src/ValuesList_Booleans.cls b/src/ValuesList_Booleans.cls index 14f670b..850c3f9 100644 --- a/src/ValuesList_Booleans.cls +++ b/src/ValuesList_Booleans.cls @@ -35,5 +35,3 @@ End Function Private Function Rand(ByVal Max As Long, Optional ByVal Min As Long = 0) As Long Randomize: Rand = Int(Rnd * (Max - Min) + 1) + Min End Function - - diff --git a/src/ValuesList_Bytes.cls b/src/ValuesList_Bytes.cls index 37e4ae5..b2e6cdc 100644 --- a/src/ValuesList_Bytes.cls +++ b/src/ValuesList_Bytes.cls @@ -36,5 +36,3 @@ End Function Private Function Rand(ByVal Max As Long, Optional ByVal Min As Long = 0) As Long Randomize: Rand = Int(Rnd * (Max - Min) + 1) + Min End Function - - diff --git a/src/ValuesList_Doubles.cls b/src/ValuesList_Doubles.cls index 81643d6..1605a4b 100644 --- a/src/ValuesList_Doubles.cls +++ b/src/ValuesList_Doubles.cls @@ -31,4 +31,3 @@ End Function Private Function Rand(ByVal Max As Long, Optional ByVal Min As Long = 0) As Long Randomize: Rand = Int(Rnd * (Max - Min) + 1) + Min End Function - diff --git a/src/ValuesList_Variants.cls b/src/ValuesList_Variants.cls index 2865060..ed7e8e4 100644 --- a/src/ValuesList_Variants.cls +++ b/src/ValuesList_Variants.cls @@ -44,4 +44,3 @@ End Function Private Function Rand(ByVal Max As Long, Optional ByVal Min As Long = 0) As Long Randomize: Rand = Int(Rnd * (Max - Min) + 1) + Min End Function - From 40ebd486de57ce6cfe34c186a1c90402620fd093 Mon Sep 17 00:00:00 2001 From: Stefan Pinnow Date: Sat, 20 Jan 2024 11:38:54 +0100 Subject: [PATCH 4/5] chore: SPACE --> Space --- src/BetterArray.cls | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BetterArray.cls b/src/BetterArray.cls index 6ddcf63..8bfc7c0 100644 --- a/src/BetterArray.cls +++ b/src/BetterArray.cls @@ -441,7 +441,7 @@ Attribute ToString.VB_Description = "Returns a string representing the array str Dim LocalItems() As Variant Dim Sep As String - Sep = IIf(PrettyPrint, Separator & SPACE(1), Separator) + Sep = IIf(PrettyPrint, Separator & Space(1), Separator) LocalItems = InternalItems LocalArrayType = GetArrayType(LocalItems) @@ -3856,12 +3856,12 @@ Attribute RecursiveToString.VB_Description = "Recursively parses an array to a s Dim Nested() As Variant Nested = SourceArray(i) If PrettyPrint Then - StringBuilder vbCrLf & SPACE(TabWidth * Tabs) + StringBuilder vbCrLf & Space(TabWidth * Tabs) End If RecursiveToString Nested, PrettyPrint, Separator, OpeningDelimiter, ClosingDelimiter, QuoteStrings, Tabs + 1 If i = UBound(SourceArray) And PrettyPrint Then StringBuilder vbCrLf - StringBuilder SPACE(TabWidth * (Tabs - 1)) + StringBuilder Space(TabWidth * (Tabs - 1)) End If StringBuilder Sep Else From f2c6e1caa53dbd1b2f041622f329b7a3b37d88b9 Mon Sep 17 00:00:00 2001 From: Stefan Pinnow Date: Sat, 20 Jan 2024 11:39:06 +0100 Subject: [PATCH 5/5] test: add missing quotes around 51008.75 --- src/TestModule_BetterArray.bas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TestModule_BetterArray.bas b/src/TestModule_BetterArray.bas index 06d4f35..8c5959e 100644 --- a/src/TestModule_BetterArray.bas +++ b/src/TestModule_BetterArray.bas @@ -8372,7 +8372,7 @@ Private Sub ToCSVString_Simple10RowNoHeaders_ValidStringReturned() TestDatum(0) = Array("Region", "Country", "Item Type", "Sales Channel", "Order Priority", "Order Date", "Order ID", "Ship Date", "Units Sold", "Unit Price", "Unit Cost", "Total Revenue", "Total Cost", "Total Profit") TestDatum(1) = Array("Sub-Saharan Africa", "Chad", "Office Supplies", "Online", "L", "1/27/2011", "292494523", "2/12/2011", "4484", "651.21", "524.96", "2920025.64", "2353920.64", "566105.00") - TestDatum(2) = Array("Europe", "Latvia", "Beverages", "Online", "C", "12/28/2015", "361825549", "1/23/2016", "1075", "47.45", "31.79", 51008.75, "34174.25", "16834.50") + TestDatum(2) = Array("Europe", "Latvia", "Beverages", "Online", "C", "12/28/2015", "361825549", "1/23/2016", "1075", "47.45", "31.79", "51008.75", "34174.25", "16834.50") TestDatum(3) = Array("Middle East and North Africa", "Pakistan", "Vegetables", "Offline", "C", "1/13/2011", "141515767", "2/1/2011", "6515", "154.06", "90.93", "1003700.90", "592408.95", "411291.95") TestDatum(4) = Array("Sub-Saharan Africa", "Democratic Republic of the Congo", "Household", "Online", "C", "9/11/2012", "500364005", "10/6/2012", "7683", "668.27", "502.54", "5134318.41", "3861014.82", "1273303.59") TestDatum(5) = Array("Europe", "Czech Republic", "Beverages", "Online", "C", "10/27/2015", "127481591", "12/5/2015", "3491", "47.45", "31.79", "165647.95", "110978.89", "54669.06") @@ -8483,7 +8483,7 @@ Private Sub ToCSVString_Simple2RowNoHeadersEscapeCommasQuotesAndCRLF_ValidString ReDim TestDatum(0 To 1) TestDatum(0) = Array("Sub-Saharan, Africa", "Chad", "Office" & vbCrLf & "Supplies", "Online", "L", "1/27/2011", "292494523", "2/12/2011", "4484", "651.21", "524.96", "2920025.64", "2353920.64", "566105.00") - TestDatum(1) = Array("Europe", "Latvia", "Bever""ages", "Online", "C", "12/28/2015", "361825549", "1/23/2016", "1075", "47.45", "31.79", 51008.75, "34174.25", "16834.50") + TestDatum(1) = Array("Europe", "Latvia", "Bever""ages", "Online", "C", "12/28/2015", "361825549", "1/23/2016", "1075", "47.45", "31.79", "51008.75", "34174.25", "16834.50") 'Act: SUT.Items = TestDatum