Closed anamarijapapic closed 1 year ago
Sorting tests are currently being executed. It is now evident that tests for some sorting algorithms are failing (see Note for test failures I fixed in this PR).
Note Tests Quick sort, Quick sort cipher (test methods
testQuickSort
,testQuickSortCipher
) are failing because of #125, I fixed it in #126. Test failures of Selection sort, Selection sort performance (test methodstestSelectionSort
,testSelectionSortPerformance
) are fixed in commit 0bfc5b2. Test failures of Count sort, Count sort performance (test methodstestCountSort
,testCountSortPerformance
) are fixed in commit b3774d7. See Warning for the reason why the remaining failing tests are failing.Warning On my machine, some performance tests are reaching the PHP memory_limit and causing the process to be killed. Also, some tests are failing because their execution duration exceeds the expected time, leading to assertion failures. That should probably be addressed (@darwinz). (Perhaps consider shortening the given range.)
(executed command is vendor/bin/phpunit tests --testdox -d memory_limit=-1
)
0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170,1836311903,2971215073,4807526976,7778742049,12586269025,20365011074,32951280099,53316291173,86267571272,139583862445,225851433717,365435296162,591286729879,956722026041,1548008755920,2504730781961,4052739537881,6557470319842,10610209857723,17167680177565,27777890035288,44945570212853,72723460248141,117669030460994,190392490709135,308061521170129,498454011879264,806515533049393,1304969544928657,2111485077978050,3416454622906707,5527939700884757,8944394323791464,14472334024676221,23416728348467685,37889062373143906,61305790721611591,99194853094755497,160500643816367088,259695496911122585,420196140727489673,679891637638612258,1100087778366101931,1779979416004714189,2880067194370816120,4660046610375530309,7540113804746346429,1.2200160415122E+19,1.9740274219868E+19,3.194043463499E+19,5.1680708854858E+19,8.3621143489848E+19,1.3530185234471E+20,2.1892299583456E+20,956722026041PHPUnit 9.6.13 by Sebastian Bergmann and contributors.
Ciphers
✔ Caesar cipher
✔ Xor cipher
Mono Alphabetic Cipher
✔ Mono alphabetic cipher
Morse Code
✔ Morse code cipher
Conversions
✔ Binary to decimal
✔ Decimal to binary
✔ Octal to decimal
✔ Decimal to octal
✔ Decimal to hex
✔ Hex to decimal
✔ Speed conversion
Singly Linked List
✔ Is palindrome with data set "IsPalindrome"
✔ Is palindrome with data set "IsPalindrome2"
✔ Is palindrome with data set "IsNotPalindrome"
✔ Is palindrome with data set "IsNotPalindrome2"
✔ Delete
Breadth First Search
✔ Breadth first search
✔ Breadth first search
✔ Breadth first search
Depth First Search
✔ Depth first search
✔ Depth first search
✔ Depth first search
Maths
✔ Factorial
✔ Is number armstrong
✔ Is number palindromic
✔ Is prime
✔ Absolute max
✔ Absolute min
✔ Perfect square
✔ Fast exponentiation
✔ Fibonacci series
✔ Neon number
✔ Fibonacci generator
✔ Mean
✔ Median
✔ Mode
Project Euler
✔ Problem 1
✔ Problem 2
✔ Problem 3
✔ Problem 4
✔ Problem 5
✔ Problem 6
✔ Problem 7
✔ Problem 8
✔ Problem 9
✔ Problem 10
✔ Problem 11
Searches
✔ Binary search iterative
✔ Binary search by recursion
✔ Binary search by recursion with empty list
✔ Binary search by recursion with one element list
✔ Binary search by recursion with two element list
✔ Binary search by recursion with three element list
✔ Fibonacci search
✔ Linear search
✔ Lower bound
✔ Upper bound
✔ Jump search
✔ Exponential search
✔ Ternary search iterative
✔ Ternary search by recursion
✔ Interpolation search
Array Keys Sort
✔ Array keys sort
Gnome Sort
✔ Gnome sort
✔ Gnome sort
Sorting
✔ Bubble sort
✔ Bubble sort
✘ Count sort
│
│ Undefined array key -5
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/Sorting/CountSort.php:18
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:81
│
✔ Insertion sort
✔ Merge sort
✘ Quick sort
│
│ Failed asserting that two arrays are equal.
│ --- Expected
│ +++ Actual
│ @@ @@
│ Array (
│ - 0 => 272
│ - 1 => 1392
│ - 2 => 1689
│ - 3 => 1807
│ - 4 => 1856
│ - 5 => 2246
│ - 6 => 2811
│ - 7 => 2847
│ - 8 => 3720
│ - 9 => 3938
│ - 10 => 4204
│ - 11 => 4337
│ - 12 => 4605
│ - 13 => 4696
│ - 14 => 4813
│ - 15 => 5239
│ - 16 => 5257
│ - 17 => 5520
│ - 18 => 5523
│ - 19 => 5676
│ - 20 => 6466
│ - 21 => 6506
│ - 22 => 7018
│ - 23 => 7515
│ - 24 => 7762
│ - 25 => 7853
│ - 26 => 7873
│ - 27 => 8181
│ - 28 => 8350
│ - 29 => 8459
│ - 30 => 8935
│ - 31 => 9358
│ - 32 => 9508
│ - 33 => 9592
│ - 34 => 10786
│ - 35 => 10867
│ - 36 => 11122
│ - 37 => 11754
│ - 38 => 12029
│ - 39 => 12440
│ - 40 => 12973
│ - 41 => 13720
│ - 42 => 13732
│ - 43 => 14098
│ - 44 => 14123
│ - 45 => 14202
│ - 46 => 15003
│ - 47 => 15352
│ - 48 => 16122
│ - 49 => 16387
│ - 50 => 16544
│ - 51 => 16677
│ - 52 => 16868
│ - 53 => 17860
│ - 54 => 18158
│ - 55 => 18362
│ - 56 => 18456
│ - 57 => 18492
│ - 58 => 18708
│ - 59 => 19074
│ - 60 => 19713
│ - 61 => 19756
│ - 62 => 20620
│ - 63 => 21165
│ - 64 => 21746
│ - 65 => 22192
│ - 66 => 22296
│ - 67 => 22479
│ - 68 => 22874
│ - 69 => 23232
│ - 70 => 23606
│ - 71 => 23954
│ - 72 => 24105
│ - 73 => 24689
│ - 74 => 24714
│ - 75 => 24932
│ - 76 => 25236
│ - 77 => 25385
│ - 78 => 25774
│ - 79 => 26277
│ - 80 => 26281
│ - 81 => 26993
│ - 82 => 27230
│ - 83 => 27760
│ - 84 => 27892
│ - 85 => 28229
│ - 86 => 28302
│ - 87 => 28309
│ - 88 => 28493
│ - 89 => 28651
│ - 90 => 29373
│ - 91 => 29411
│ - 92 => 29724
│ - 93 => 30110
│ - 94 => 30258
│ - 95 => 30298
│ - 96 => 30819
│ - 97 => 30948
│ - 98 => 31159
│ - 99 => 31263
│ - 100 => 31577
│ - 101 => 31805
│ - 102 => 31919
│ - 103 => 32074
│ - 104 => 32158
│ - 105 => 32178
│ - 106 => 32392
│ - 107 => 33446
│ - 108 => 33679
│ - 109 => 33963
│ - 110 => 33982
│ - 111 => 34201
│ - 112 => 34649
│ - 113 => 34671
│ - 114 => 34925
│ - 115 => 35245
│ - 116 => 35374
│ - 117 => 36141
│ - 118 => 36625
│ - 119 => 36828
│ - 120 => 36852
│ - 121 => 37348
│ - 122 => 38265
│ - 123 => 38386
│ - 124 => 39583
│ - 125 => 39621
│ - 126 => 40171
│ - 127 => 40206
│ - 128 => 40372
│ - 129 => 40459
│ - 130 => 40565
│ - 131 => 40742
│ - 132 => 40789
│ - 133 => 40858
│ - 134 => 42310
│ - 135 => 42348
│ - 136 => 42422
│ - 137 => 42685
│ - 138 => 43340
│ - 139 => 43688
│ - 140 => 43780
│ - 141 => 43836
│ - 142 => 44044
│ - 143 => 44518
│ - 144 => 44628
│ - 145 => 44637
│ - 146 => 44654
│ - 147 => 45344
│ - 148 => 45519
│ - 149 => 45755
│ - 150 => 45799
│ - 151 => 45894
│ - 152 => 46184
│ - 153 => 46186
│ - 154 => 46528
│ - 155 => 46574
│ - 156 => 46704
│ - 157 => 47432
│ - 158 => 47489
│ - 159 => 47596
│ - 160 => 47615
│ - 161 => 47662
│ - 162 => 47910
│ - 163 => 48208
│ - 164 => 48964
│ - 165 => 49048
│ - 166 => 49052
│ - 167 => 49168
│ - 168 => 49709
│ - 169 => 49809
│ - 170 => 49935
│ - 171 => 50209
│ - 172 => 50596
│ - 173 => 50800
│ - 174 => 51158
│ - 175 => 51433
│ - 176 => 51830
│ - 177 => 51886
│ - 178 => 52068
│ - 179 => 52328
│ - 180 => 52905
│ - 181 => 52928
│ - 182 => 53635
│ - 183 => 54211
│ - 184 => 54616
│ - 185 => 54955
│ - 186 => 55295
│ - 187 => 55416
│ - 188 => 55515
│ - 189 => 55549
│ - 190 => 55908
│ - 191 => 56063
│ - 192 => 56301
│ - 193 => 56494
│ - 194 => 56841
│ - 195 => 56963
│ - 196 => 56992
│ - 197 => 57402
│ - 198 => 57954
│ - 199 => 57981
│ - 200 => 58213
│ - 201 => 58223
│ - 202 => 58336
│ - 203 => 59748
│ - 204 => 59973
│ - 205 => 59992
│ - 206 => 61349
│ - 207 => 61591
│ - 208 => 61968
│ - 209 => 62310
│ - 210 => 63015
│ - 211 => 63178
│ - 212 => 63245
│ - 213 => 63395
│ - 214 => 63771
│ - 215 => 63968
│ - 216 => 64204
│ - 217 => 64208
│ - 218 => 65764
│ - 219 => 66174
│ - 220 => 66178
│ - 221 => 66206
│ - 222 => 66570
│ - 223 => 67025
│ - 224 => 67338
│ - 225 => 67452
│ - 226 => 67957
│ - 227 => 68125
│ - 228 => 68514
│ - 229 => 68756
│ - 230 => 68831
│ - 231 => 68975
│ - 232 => 69091
│ - 233 => 69858
│ - 234 => 70466
│ - 235 => 70474
│ - 236 => 71526
│ - 237 => 71774
│ - 238 => 72472
│ - 239 => 72686
│ - 240 => 72849
│ - 241 => 73437
│ - 242 => 73907
│ - 243 => 74474
│ - 244 => 74813
│ - 245 => 74872
│ - 246 => 75043
│ - 247 => 75045
│ - 248 => 75190
│ - 249 => 75197
│ - 250 => 75786
│ - 251 => 76201
│ - 252 => 76277
│ - 253 => 76474
│ - 254 => 76818
│ - 255 => 77026
│ - 256 => 77849
│ - 257 => 77977
│ - 258 => 78095
│ - 259 => 78105
│ - 260 => 78533
│ - 261 => 78629
│ - 262 => 78828
│ - 263 => 79028
│ - 264 => 79488
│ - 265 => 79935
│ - 266 => 80188
│ - 267 => 81097
│ - 268 => 81960
│ - 269 => 82300
│ - 270 => 82656
│ - 271 => 82785
│ - 272 => 83246
│ - 273 => 83638
│ - 274 => 84076
│ - 275 => 84402
│ - 276 => 85799
│ - 277 => 86070
│ - 278 => 86198
│ - 279 => 86309
│ - 280 => 86358
│ - 281 => 86805
│ - 282 => 86814
│ - 283 => 86897
│ - 284 => 86968
│ - 285 => 87450
│ - 286 => 88246
│ - 287 => 90235
│ - 288 => 90728
│ - 289 => 90876
│ - 290 => 91503
│ - 291 => 92106
│ - 292 => 92215
│ - 293 => 92559
│ - 294 => 92837
│ - 295 => 93070
│ - 296 => 93144
│ - 297 => 93729
│ - 298 => 94083
│ - 299 => 94257
│ - 300 => 94706
│ - 301 => 94807
│ - 302 => 96145
│ - 303 => 96407
│ - 304 => 96782
│ - 305 => 97156
│ - 306 => 97222
│ - 307 => 97577
│ - 308 => 97799
│ - 309 => 98758
│ - 310 => 98845
│ - 311 => 99156
│ - 312 => 99211
│ - 313 => 99272
│ - 314 => 99519
│ - 315 => 99711
│ )
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:126
│
✔ Quick sort with empty input
✔ Radix sort
✘ Selection sort
│
│ Error: Call to undefined function selectionSort()
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:167
│
✔ Bubble sort performance
✔ Bubble sort 2 performance
✘ Count sort performance
│
│ ArgumentCountError: Too few arguments to function countSort(), 1 passed in /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php on line 193 and exactly 3 expected
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/Sorting/CountSort.php:9
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:193
│
✔ Insertion sort performance
✔ Merge sort performance
✔ Quick sort performance
✔ Radix sort performance
✘ Selection sort performance
│
│ Error: Call to undefined function selectionSort()
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:238
│
✔ Count sort cipher
✘ Quick sort cipher
│
│ Failed asserting that two arrays are equal.
│ --- Expected
│ +++ Actual
│ @@ @@
│ Array (
│ - 0 => -8
│ - 1 => -5
│ - 2 => -3
│ - 3 => 2
│ - 4 => 4
│ - 5 => 6
│ - 6 => 9
│ - 7 => 12
│ - 8 => 16
│ - 9 => 20
│ )
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:268
│
✘ Heap sort performance
│
│ Failed asserting that 2.98309588432312 is less than 1.
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:279
│
✔ Heap sort cipher
Strings
✔ Is palindrome
✔ Count sentences
✔ Reverse string
✔ Reverse words
✔ Is anagram
✔ Max character
✔ Count vowels
✔ Count consonants
✔ Find distance
Time: 00:05.730, Memory: 144.20 MB
Summary of non-successful tests:
Sorting
✘ Count sort
│
│ Undefined array key -5
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/Sorting/CountSort.php:18
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:81
│
✘ Quick sort
│
│ Failed asserting that two arrays are equal.
│ --- Expected
│ +++ Actual
│ @@ @@
│ Array (
│ - 0 => 272
│ - 1 => 1392
│ - 2 => 1689
│ - 3 => 1807
│ - 4 => 1856
│ - 5 => 2246
│ - 6 => 2811
│ - 7 => 2847
│ - 8 => 3720
│ - 9 => 3938
│ - 10 => 4204
│ - 11 => 4337
│ - 12 => 4605
│ - 13 => 4696
│ - 14 => 4813
│ - 15 => 5239
│ - 16 => 5257
│ - 17 => 5520
│ - 18 => 5523
│ - 19 => 5676
│ - 20 => 6466
│ - 21 => 6506
│ - 22 => 7018
│ - 23 => 7515
│ - 24 => 7762
│ - 25 => 7853
│ - 26 => 7873
│ - 27 => 8181
│ - 28 => 8350
│ - 29 => 8459
│ - 30 => 8935
│ - 31 => 9358
│ - 32 => 9508
│ - 33 => 9592
│ - 34 => 10786
│ - 35 => 10867
│ - 36 => 11122
│ - 37 => 11754
│ - 38 => 12029
│ - 39 => 12440
│ - 40 => 12973
│ - 41 => 13720
│ - 42 => 13732
│ - 43 => 14098
│ - 44 => 14123
│ - 45 => 14202
│ - 46 => 15003
│ - 47 => 15352
│ - 48 => 16122
│ - 49 => 16387
│ - 50 => 16544
│ - 51 => 16677
│ - 52 => 16868
│ - 53 => 17860
│ - 54 => 18158
│ - 55 => 18362
│ - 56 => 18456
│ - 57 => 18492
│ - 58 => 18708
│ - 59 => 19074
│ - 60 => 19713
│ - 61 => 19756
│ - 62 => 20620
│ - 63 => 21165
│ - 64 => 21746
│ - 65 => 22192
│ - 66 => 22296
│ - 67 => 22479
│ - 68 => 22874
│ - 69 => 23232
│ - 70 => 23606
│ - 71 => 23954
│ - 72 => 24105
│ - 73 => 24689
│ - 74 => 24714
│ - 75 => 24932
│ - 76 => 25236
│ - 77 => 25385
│ - 78 => 25774
│ - 79 => 26277
│ - 80 => 26281
│ - 81 => 26993
│ - 82 => 27230
│ - 83 => 27760
│ - 84 => 27892
│ - 85 => 28229
│ - 86 => 28302
│ - 87 => 28309
│ - 88 => 28493
│ - 89 => 28651
│ - 90 => 29373
│ - 91 => 29411
│ - 92 => 29724
│ - 93 => 30110
│ - 94 => 30258
│ - 95 => 30298
│ - 96 => 30819
│ - 97 => 30948
│ - 98 => 31159
│ - 99 => 31263
│ - 100 => 31577
│ - 101 => 31805
│ - 102 => 31919
│ - 103 => 32074
│ - 104 => 32158
│ - 105 => 32178
│ - 106 => 32392
│ - 107 => 33446
│ - 108 => 33679
│ - 109 => 33963
│ - 110 => 33982
│ - 111 => 34201
│ - 112 => 34649
│ - 113 => 34671
│ - 114 => 34925
│ - 115 => 35245
│ - 116 => 35374
│ - 117 => 36141
│ - 118 => 36625
│ - 119 => 36828
│ - 120 => 36852
│ - 121 => 37348
│ - 122 => 38265
│ - 123 => 38386
│ - 124 => 39583
│ - 125 => 39621
│ - 126 => 40171
│ - 127 => 40206
│ - 128 => 40372
│ - 129 => 40459
│ - 130 => 40565
│ - 131 => 40742
│ - 132 => 40789
│ - 133 => 40858
│ - 134 => 42310
│ - 135 => 42348
│ - 136 => 42422
│ - 137 => 42685
│ - 138 => 43340
│ - 139 => 43688
│ - 140 => 43780
│ - 141 => 43836
│ - 142 => 44044
│ - 143 => 44518
│ - 144 => 44628
│ - 145 => 44637
│ - 146 => 44654
│ - 147 => 45344
│ - 148 => 45519
│ - 149 => 45755
│ - 150 => 45799
│ - 151 => 45894
│ - 152 => 46184
│ - 153 => 46186
│ - 154 => 46528
│ - 155 => 46574
│ - 156 => 46704
│ - 157 => 47432
│ - 158 => 47489
│ - 159 => 47596
│ - 160 => 47615
│ - 161 => 47662
│ - 162 => 47910
│ - 163 => 48208
│ - 164 => 48964
│ - 165 => 49048
│ - 166 => 49052
│ - 167 => 49168
│ - 168 => 49709
│ - 169 => 49809
│ - 170 => 49935
│ - 171 => 50209
│ - 172 => 50596
│ - 173 => 50800
│ - 174 => 51158
│ - 175 => 51433
│ - 176 => 51830
│ - 177 => 51886
│ - 178 => 52068
│ - 179 => 52328
│ - 180 => 52905
│ - 181 => 52928
│ - 182 => 53635
│ - 183 => 54211
│ - 184 => 54616
│ - 185 => 54955
│ - 186 => 55295
│ - 187 => 55416
│ - 188 => 55515
│ - 189 => 55549
│ - 190 => 55908
│ - 191 => 56063
│ - 192 => 56301
│ - 193 => 56494
│ - 194 => 56841
│ - 195 => 56963
│ - 196 => 56992
│ - 197 => 57402
│ - 198 => 57954
│ - 199 => 57981
│ - 200 => 58213
│ - 201 => 58223
│ - 202 => 58336
│ - 203 => 59748
│ - 204 => 59973
│ - 205 => 59992
│ - 206 => 61349
│ - 207 => 61591
│ - 208 => 61968
│ - 209 => 62310
│ - 210 => 63015
│ - 211 => 63178
│ - 212 => 63245
│ - 213 => 63395
│ - 214 => 63771
│ - 215 => 63968
│ - 216 => 64204
│ - 217 => 64208
│ - 218 => 65764
│ - 219 => 66174
│ - 220 => 66178
│ - 221 => 66206
│ - 222 => 66570
│ - 223 => 67025
│ - 224 => 67338
│ - 225 => 67452
│ - 226 => 67957
│ - 227 => 68125
│ - 228 => 68514
│ - 229 => 68756
│ - 230 => 68831
│ - 231 => 68975
│ - 232 => 69091
│ - 233 => 69858
│ - 234 => 70466
│ - 235 => 70474
│ - 236 => 71526
│ - 237 => 71774
│ - 238 => 72472
│ - 239 => 72686
│ - 240 => 72849
│ - 241 => 73437
│ - 242 => 73907
│ - 243 => 74474
│ - 244 => 74813
│ - 245 => 74872
│ - 246 => 75043
│ - 247 => 75045
│ - 248 => 75190
│ - 249 => 75197
│ - 250 => 75786
│ - 251 => 76201
│ - 252 => 76277
│ - 253 => 76474
│ - 254 => 76818
│ - 255 => 77026
│ - 256 => 77849
│ - 257 => 77977
│ - 258 => 78095
│ - 259 => 78105
│ - 260 => 78533
│ - 261 => 78629
│ - 262 => 78828
│ - 263 => 79028
│ - 264 => 79488
│ - 265 => 79935
│ - 266 => 80188
│ - 267 => 81097
│ - 268 => 81960
│ - 269 => 82300
│ - 270 => 82656
│ - 271 => 82785
│ - 272 => 83246
│ - 273 => 83638
│ - 274 => 84076
│ - 275 => 84402
│ - 276 => 85799
│ - 277 => 86070
│ - 278 => 86198
│ - 279 => 86309
│ - 280 => 86358
│ - 281 => 86805
│ - 282 => 86814
│ - 283 => 86897
│ - 284 => 86968
│ - 285 => 87450
│ - 286 => 88246
│ - 287 => 90235
│ - 288 => 90728
│ - 289 => 90876
│ - 290 => 91503
│ - 291 => 92106
│ - 292 => 92215
│ - 293 => 92559
│ - 294 => 92837
│ - 295 => 93070
│ - 296 => 93144
│ - 297 => 93729
│ - 298 => 94083
│ - 299 => 94257
│ - 300 => 94706
│ - 301 => 94807
│ - 302 => 96145
│ - 303 => 96407
│ - 304 => 96782
│ - 305 => 97156
│ - 306 => 97222
│ - 307 => 97577
│ - 308 => 97799
│ - 309 => 98758
│ - 310 => 98845
│ - 311 => 99156
│ - 312 => 99211
│ - 313 => 99272
│ - 314 => 99519
│ - 315 => 99711
│ )
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:126
│
✘ Selection sort
│
│ Error: Call to undefined function selectionSort()
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:167
│
✘ Count sort performance
│
│ ArgumentCountError: Too few arguments to function countSort(), 1 passed in /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php on line 193 and exactly 3 expected
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/Sorting/CountSort.php:9
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:193
│
✘ Selection sort performance
│
│ Error: Call to undefined function selectionSort()
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:238
│
✘ Quick sort cipher
│
│ Failed asserting that two arrays are equal.
│ --- Expected
│ +++ Actual
│ @@ @@
│ Array (
│ - 0 => -8
│ - 1 => -5
│ - 2 => -3
│ - 3 => 2
│ - 4 => 4
│ - 5 => 6
│ - 6 => 9
│ - 7 => 12
│ - 8 => 16
│ - 9 => 20
│ )
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:268
│
✘ Heap sort performance
│
│ Failed asserting that 2.98309588432312 is less than 1.
│
│ /Users/anamarija/htdocs/TheAlgorithms-PHP/tests/Sorting/SortingTest.php:279
│
ERRORS!
Tests: 95, Assertions: 221, Errors: 4, Failures: 3.
I believe the min
and max
functions that you added/fixed are now significantly adding to the runtime, and that's why it's timing out. For the purposes of these tests, we can probably hard code the min and max rather than calculating those.
I believe the
min
andmax
functions that you added/fixed are now significantly adding to the runtime, and that's why it's timing out. For the purposes of these tests, we can probably hard code the min and max rather than calculating those.
Actually, nevermind. I see what you're saying now - these tests weren't running before because the name was Tests
instead of Test
@anamarijapapic , would you try shortening the given range for the failing unit tests? I'd like to have the tests passing before merging this fix.
I believe the
min
andmax
functions that you added/fixed are now significantly adding to the runtime, and that's why it's timing out. For the purposes of these tests, we can probably hard code the min and max rather than calculating those.
In the count sort algorithm, it seems to me that it doesn't make much sense to receive min
and max
as function arguments because when an array is passed as an argument to the function, I don't see why the user would also need to know the min and max values within the passed array.
@anamarijapapic , would you try shortening the given range for the failing unit tests? I'd like to have the tests passing before merging this fix.
Sure 😁
@darwinz, all tests are now passing ✅.
As you can see, I shortened the given range for the failing unit tests (as we agreed). Additionally, I added a CI step to set up PHP and configure PHP INI values to fix PHPUnit exiting with an error. This error occurred because the quick sort algorithm has recursion, which Xdebug was detecting as a possible infinite loop and aborting the script. You can see that error in the GitHub action I previously ran at https://github.com/TheAlgorithms/PHP/actions/runs/6439617184/job/17487494393#step:6:16.
Fixes #127.