]> git.seodisparate.com - SimpleArchiver/commitdiff
Fix unit test for priority heap
authorStephen Seo <seo.disparate@gmail.com>
Sun, 30 Jun 2024 11:02:47 +0000 (20:02 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Sun, 30 Jun 2024 11:02:47 +0000 (20:02 +0900)
src/data_structures/test.c

index 99c06025bc32d2f61b16c2f76c628b4a41450743..e5299a6fd8bd5865e37bfdbb636bab3adec63b7c 100644 (file)
@@ -224,7 +224,7 @@ int main(void) {
     for (unsigned int idx = max - 1; idx-- > 0;) {
       unsigned int other_idx = simple_archiver_algo_lcg_defaults(idx) %
                                (unsigned long long)(idx + 1);
-      if (idx != other_idx) {
+      if (max - 1 != other_idx) {
         unsigned int temp = array[max - 1];
         array[max - 1] = array[other_idx];
         array[other_idx] = temp;
@@ -292,7 +292,7 @@ int main(void) {
     for (unsigned int idx = max - 1; idx-- > 0;) {
       unsigned int other_idx = simple_archiver_algo_lcg_defaults(idx) %
                                (unsigned long long)(idx + 1);
-      if (idx != other_idx) {
+      if (max - 1 != other_idx) {
         unsigned int temp = array[max - 1];
         array[max - 1] = array[other_idx];
         array[other_idx] = temp;