|
| 1 | +Use VdfBase.pkg |
| 2 | +Use Winkern.pkg |
| 3 | + |
| 4 | +Use DFUnit\Globals.pkg |
| 5 | +Use DFUnit\Utils\Debugger.pkg |
| 6 | +Use DFUnit\Utils\Objects.pkg |
| 7 | +Use DFUnit\CallRecording.pkg |
| 8 | + |
| 9 | +Register_Function IntArrToStrArr Integer[] In Returns String[] |
| 10 | + |
| 11 | +Class cDFUnitAssertArray_Mixin is a Mixin |
| 12 | + Procedure AssertStrArrAreEqual String[] Expected String[] Actual String sOptAssertMessage |
| 13 | + Integer i iEqualCount |
| 14 | + |
| 15 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 16 | + If (IsSameArray(Expected, Actual)) Begin |
| 17 | + Send Succeed_Assert of ghoTestApplication |
| 18 | + Procedure_Return |
| 19 | + End |
| 20 | + End |
| 21 | + |
| 22 | + Send AssertEqFailed Expected Actual (If(num_arguments > 2, sOptAssertMessage, "")) |
| 23 | + End_Procedure |
| 24 | + |
| 25 | + Procedure AssertStrArrAreNotEqual String[] Expected String[] Actual String sOptAssertMessage |
| 26 | + Integer i iEqualCount |
| 27 | + |
| 28 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 29 | + Send Succeed_Assert of ghoTestApplication |
| 30 | + Procedure_Return |
| 31 | + End |
| 32 | + |
| 33 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 34 | + Send Succeed_Assert of ghoTestApplication |
| 35 | + Procedure_Return |
| 36 | + End |
| 37 | + |
| 38 | + Send AssertNotEqFailed Expected Actual (If(num_arguments > 2, sOptAssertMessage, "")) |
| 39 | + End_Procedure |
| 40 | + |
| 41 | + Procedure AssertIntArrAreEqual Integer[] Expected Integer[] Actual String sOptAssertMessage |
| 42 | + Integer i iEqualCount |
| 43 | + |
| 44 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 45 | + If (IsSameArray(Expected, Actual)) Begin |
| 46 | + Send Succeed_Assert of ghoTestApplication |
| 47 | + Procedure_Return |
| 48 | + End |
| 49 | + End |
| 50 | + |
| 51 | + Send AssertEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 52 | + End_Procedure |
| 53 | + |
| 54 | + Procedure AssertIntArrAreNotEqual Integer[] Expected Integer[] Actual String sOptAssertMessage |
| 55 | + Integer i iEqualCount |
| 56 | + |
| 57 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 58 | + Send Succeed_Assert of ghoTestApplication |
| 59 | + Procedure_Return |
| 60 | + End |
| 61 | + |
| 62 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 63 | + Send Succeed_Assert of ghoTestApplication |
| 64 | + Procedure_Return |
| 65 | + End |
| 66 | + |
| 67 | + Send AssertNotEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 68 | + End_Procedure |
| 69 | + |
| 70 | + Procedure AssertBIArrAreEqual BigInt[] Expected BigInt[] Actual String sOptAssertMessage |
| 71 | + Integer i iEqualCount |
| 72 | + |
| 73 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 74 | + If (IsSameArray(Expected, Actual)) Begin |
| 75 | + Send Succeed_Assert of ghoTestApplication |
| 76 | + Procedure_Return |
| 77 | + End |
| 78 | + End |
| 79 | + |
| 80 | + Send AssertEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 81 | + End_Procedure |
| 82 | + |
| 83 | + Procedure AssertBIArrAreNotEqual BigInt[] Expected BigInt[] Actual String sOptAssertMessage |
| 84 | + Integer i iEqualCount |
| 85 | + |
| 86 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 87 | + Send Succeed_Assert of ghoTestApplication |
| 88 | + Procedure_Return |
| 89 | + End |
| 90 | + |
| 91 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 92 | + Send Succeed_Assert of ghoTestApplication |
| 93 | + Procedure_Return |
| 94 | + End |
| 95 | + |
| 96 | + Send AssertNotEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 97 | + End_Procedure |
| 98 | + |
| 99 | + Procedure AssertBoolArrAreEqual Boolean[] Expected Boolean[] Actual String sOptAssertMessage |
| 100 | + Integer i iEqualCount |
| 101 | + |
| 102 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 103 | + If (IsSameArray(Expected, Actual)) Begin |
| 104 | + Send Succeed_Assert of ghoTestApplication |
| 105 | + Procedure_Return |
| 106 | + End |
| 107 | + End |
| 108 | + |
| 109 | + Send AssertEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 110 | + End_Procedure |
| 111 | + |
| 112 | + Procedure AssertBoolArrAreNotEqual Boolean[] Expected Boolean[] Actual String sOptAssertMessage |
| 113 | + Integer i iEqualCount |
| 114 | + |
| 115 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 116 | + Send Succeed_Assert of ghoTestApplication |
| 117 | + Procedure_Return |
| 118 | + End |
| 119 | + |
| 120 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 121 | + Send Succeed_Assert of ghoTestApplication |
| 122 | + Procedure_Return |
| 123 | + End |
| 124 | + |
| 125 | + Send AssertNotEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 126 | + End_Procedure |
| 127 | + |
| 128 | + Procedure AssertNumArrAreEqual Number[] Expected Number[] Actual String sOptAssertMessage |
| 129 | + Integer i iEqualCount |
| 130 | + |
| 131 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 132 | + If (IsSameArray(Expected, Actual)) Begin |
| 133 | + Send Succeed_Assert of ghoTestApplication |
| 134 | + Procedure_Return |
| 135 | + End |
| 136 | + End |
| 137 | + |
| 138 | + Send AssertEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 139 | + End_Procedure |
| 140 | + |
| 141 | + Procedure AssertNumArrAreNotEqual Number[] Expected Number[] Actual String sOptAssertMessage |
| 142 | + Integer i iEqualCount |
| 143 | + |
| 144 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 145 | + Send Succeed_Assert of ghoTestApplication |
| 146 | + Procedure_Return |
| 147 | + End |
| 148 | + |
| 149 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 150 | + Send Succeed_Assert of ghoTestApplication |
| 151 | + Procedure_Return |
| 152 | + End |
| 153 | + |
| 154 | + Send AssertNotEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 155 | + End_Procedure |
| 156 | + |
| 157 | + Procedure AssertRealArrAreEqual Real[] Expected Real[] Actual String sOptAssertMessage |
| 158 | + Integer i iEqualCount |
| 159 | + |
| 160 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 161 | + If (IsSameArray(Expected, Actual)) Begin |
| 162 | + Send Succeed_Assert of ghoTestApplication |
| 163 | + Procedure_Return |
| 164 | + End |
| 165 | + End |
| 166 | + |
| 167 | + Send AssertEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 168 | + End_Procedure |
| 169 | + |
| 170 | + Procedure AssertRealArrAreNotEqual Real[] Expected Real[] Actual String sOptAssertMessage |
| 171 | + Integer i iEqualCount |
| 172 | + |
| 173 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 174 | + Send Succeed_Assert of ghoTestApplication |
| 175 | + Procedure_Return |
| 176 | + End |
| 177 | + |
| 178 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 179 | + Send Succeed_Assert of ghoTestApplication |
| 180 | + Procedure_Return |
| 181 | + End |
| 182 | + |
| 183 | + Send AssertNotEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 184 | + End_Procedure |
| 185 | + |
| 186 | + Procedure AssertDateArrAreEqual Date[] Expected Date[] Actual String sOptAssertMessage |
| 187 | + Integer i iEqualCount |
| 188 | + |
| 189 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 190 | + If (IsSameArray(Expected, Actual)) Begin |
| 191 | + Send Succeed_Assert of ghoTestApplication |
| 192 | + Procedure_Return |
| 193 | + End |
| 194 | + End |
| 195 | + |
| 196 | + Send AssertEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 197 | + End_Procedure |
| 198 | + |
| 199 | + Procedure AssertDateArrAreNotEqual Date[] Expected Date[] Actual String sOptAssertMessage |
| 200 | + Integer i iEqualCount |
| 201 | + |
| 202 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 203 | + Send Succeed_Assert of ghoTestApplication |
| 204 | + Procedure_Return |
| 205 | + End |
| 206 | + |
| 207 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 208 | + Send Succeed_Assert of ghoTestApplication |
| 209 | + Procedure_Return |
| 210 | + End |
| 211 | + |
| 212 | + Send AssertNotEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 213 | + End_Procedure |
| 214 | + |
| 215 | + Procedure AssertDTArrAreEqual DateTime[] Expected DateTime[] Actual String sOptAssertMessage |
| 216 | + Integer i iEqualCount |
| 217 | + |
| 218 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 219 | + If (IsSameArray(Expected, Actual)) Begin |
| 220 | + Send Succeed_Assert of ghoTestApplication |
| 221 | + Procedure_Return |
| 222 | + End |
| 223 | + End |
| 224 | + |
| 225 | + Send AssertEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 226 | + End_Procedure |
| 227 | + |
| 228 | + Procedure AssertDTArrAreNotEqual DateTime[] Expected DateTime[] Actual String sOptAssertMessage |
| 229 | + Integer i iEqualCount |
| 230 | + |
| 231 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 232 | + Send Succeed_Assert of ghoTestApplication |
| 233 | + Procedure_Return |
| 234 | + End |
| 235 | + |
| 236 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 237 | + Send Succeed_Assert of ghoTestApplication |
| 238 | + Procedure_Return |
| 239 | + End |
| 240 | + |
| 241 | + Send AssertNotEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 242 | + End_Procedure |
| 243 | + |
| 244 | + Procedure AssertTSArrAreEqual TimeSpan[] Expected TimeSpan[] Actual String sOptAssertMessage |
| 245 | + Integer i iEqualCount |
| 246 | + |
| 247 | + If (SizeOfArray(Expected) = SizeOfArray(Actual)) Begin |
| 248 | + If (IsSameArray(Expected, Actual)) Begin |
| 249 | + Send Succeed_Assert of ghoTestApplication |
| 250 | + Procedure_Return |
| 251 | + End |
| 252 | + End |
| 253 | + |
| 254 | + Send AssertEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 255 | + End_Procedure |
| 256 | + |
| 257 | + Procedure AssertTSArrAreNotEqual TimeSpan[] Expected TimeSpan[] Actual String sOptAssertMessage |
| 258 | + Integer i iEqualCount |
| 259 | + |
| 260 | + If (SizeOfArray(Expected) <> SizeOfArray(Actual)) Begin |
| 261 | + Send Succeed_Assert of ghoTestApplication |
| 262 | + Procedure_Return |
| 263 | + End |
| 264 | + |
| 265 | + If (not(IsSameArray(Expected, Actual))) Begin |
| 266 | + Send Succeed_Assert of ghoTestApplication |
| 267 | + Procedure_Return |
| 268 | + End |
| 269 | + |
| 270 | + Send AssertNotEqFailed (IntArrToStrArr(Self, Expected)) (IntArrToStrArr(Self, Actual)) (If(num_arguments > 2, sOptAssertMessage, "")) |
| 271 | + End_Procedure |
| 272 | + |
| 273 | + Procedure AssertEqFailed String[] Expected String[] Actual String sOptAssertMessage |
| 274 | + String[1] asMessages |
| 275 | + Move (SFormat("Should have been [%1] but was [%2]", StrJoinFromArray(Expected, ','), StrJoinFromArray(Actual, ','))) to asMessages[0] |
| 276 | + If (num_arguments > 2) ; |
| 277 | + Send Fail_Assert of ghoTestApplication asMessages sOptAssertMessage |
| 278 | + Else ; |
| 279 | + Send Fail_Assert of ghoTestApplication asMessages |
| 280 | + End_Procedure |
| 281 | + |
| 282 | + Procedure AssertNotEqFailed String[] Expected String[] Actual String sOptAssertMessage |
| 283 | + String[1] asMessages |
| 284 | + Move (SFormat("Should not have been [%1] but was [%2]", StrJoinFromArray(Expected, ','), StrJoinFromArray(Actual, ','))) to asMessages[0] |
| 285 | + If (num_arguments > 2) ; |
| 286 | + Send Fail_Assert of ghoTestApplication asMessages sOptAssertMessage |
| 287 | + Else ; |
| 288 | + Send Fail_Assert of ghoTestApplication asMessages |
| 289 | + End_Procedure |
| 290 | + |
| 291 | + Function IntArrToStrArr Integer[] In Returns String[] |
| 292 | + Integer i |
| 293 | + String[] saOut |
| 294 | + |
| 295 | + For i from 0 to (SizeOfArray(In) - 1) |
| 296 | + Move (String(In[i])) to saOut[SizeOfArray(saOut)] |
| 297 | + Loop |
| 298 | + |
| 299 | + Function_Return saOut |
| 300 | + End_Function |
| 301 | + |
| 302 | + Function BigIntArrToStrArr BigInt[] In Returns String[] |
| 303 | + Integer i |
| 304 | + String[] saOut |
| 305 | + |
| 306 | + For i from 0 to (SizeOfArray(In) - 1) |
| 307 | + Move (String(In[i])) to saOut[SizeOfArray(saOut)] |
| 308 | + Loop |
| 309 | + |
| 310 | + Function_Return saOut |
| 311 | + End_Function |
| 312 | + |
| 313 | + Function BoolArrToStrArr Boolean[] In Returns String[] |
| 314 | + Integer i |
| 315 | + String[] saOut |
| 316 | + |
| 317 | + For i from 0 to (SizeOfArray(In) - 1) |
| 318 | + Move (String(In[i])) to saOut[SizeOfArray(saOut)] |
| 319 | + Loop |
| 320 | + |
| 321 | + Function_Return saOut |
| 322 | + End_Function |
| 323 | + |
| 324 | + Function NumArrToStrArr Number[] In Returns String[] |
| 325 | + Integer i |
| 326 | + String[] saOut |
| 327 | + |
| 328 | + For i from 0 to (SizeOfArray(In) - 1) |
| 329 | + Move (String(In[i])) to saOut[SizeOfArray(saOut)] |
| 330 | + Loop |
| 331 | + |
| 332 | + Function_Return saOut |
| 333 | + End_Function |
| 334 | + |
| 335 | + Function RealArrToStrArr Real[] In Returns String[] |
| 336 | + Integer i |
| 337 | + String[] saOut |
| 338 | + |
| 339 | + For i from 0 to (SizeOfArray(In) - 1) |
| 340 | + Move (String(In[i])) to saOut[SizeOfArray(saOut)] |
| 341 | + Loop |
| 342 | + |
| 343 | + Function_Return saOut |
| 344 | + End_Function |
| 345 | + |
| 346 | + Function DateArrToStrArr Date[] In Returns String[] |
| 347 | + Integer i |
| 348 | + String[] saOut |
| 349 | + |
| 350 | + For i from 0 to (SizeOfArray(In) - 1) |
| 351 | + Move (String(In[i])) to saOut[SizeOfArray(saOut)] |
| 352 | + Loop |
| 353 | + |
| 354 | + Function_Return saOut |
| 355 | + End_Function |
| 356 | + |
| 357 | + Function DTArrToStrArr DateTime[] In Returns String[] |
| 358 | + Integer i |
| 359 | + String[] saOut |
| 360 | + |
| 361 | + For i from 0 to (SizeOfArray(In) - 1) |
| 362 | + Move (String(In[i])) to saOut[SizeOfArray(saOut)] |
| 363 | + Loop |
| 364 | + |
| 365 | + Function_Return saOut |
| 366 | + End_Function |
| 367 | + |
| 368 | + Function TSArrToStrArr TimeSpan[] In Returns String[] |
| 369 | + Integer i |
| 370 | + String[] saOut |
| 371 | + |
| 372 | + For i from 0 to (SizeOfArray(In) - 1) |
| 373 | + Move (String(In[i])) to saOut[SizeOfArray(saOut)] |
| 374 | + Loop |
| 375 | + |
| 376 | + Function_Return saOut |
| 377 | + End_Function |
| 378 | +End_Class |
0 commit comments