Skip to content

Commit 127f466

Browse files
committed
todo, improve testing
1 parent 7a413f6 commit 127f466

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed
Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1+
from code_to_optimize.bubble_sort_dep1_helper import dep1_comparer
2+
from code_to_optimize.bubble_sort_dep2_swap import dep2_swap
13

24

35
def sorter_deps(arr):
4-
n = len(arr)
5-
for i in range(n):
6-
# Introduce a flag that will allow us to exit early if no swaps occur
7-
swapped = False
8-
# Only iterate to the unsorted portion of the list
9-
for j in range(n - 1 - i):
10-
# Inline the comparison function
11-
if arr[j] > arr[j + 1]:
12-
# Inline the swap
13-
arr[j], arr[j + 1] = arr[j + 1], arr[j]
14-
swapped = True
15-
# If no swaps occurred in the last inner loop, the array is sorted
16-
if not swapped:
17-
break
18-
return arr
6+
for i in range(len(arr)):
7+
for j in range(len(arr) - 1):
8+
if dep1_comparer(arr, j):
9+
dep2_swap(arr, j)
10+
return arr

tests/test_test_runner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from pathlib import Path
44

55
import line_profiler
6-
76
from codeflash.models.models import TestFile, TestFiles
87
from codeflash.verification.parse_test_output import parse_test_xml
98
from codeflash.verification.test_results import TestType

0 commit comments

Comments
 (0)