Skip to content

Commit 4f7aaec

Browse files
committed
style: apply nimpretty to bogo_sort.nim
1 parent fac45ec commit 4f7aaec

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

sorts/bogo_sort.nim

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ runnableExamples:
99
var arr = @[3, 1, 2]
1010
bogoSort(arr)
1111
doAssert isSorted(arr)
12-
12+
1313
var arr2 = @["c", "a", "b"]
1414
bogoSort(arr2)
1515
doAssert isSorted(arr2)
@@ -18,24 +18,24 @@ runnableExamples:
1818
import random
1919

2020
func isSorted[T](arr: openArray[T]): bool =
21-
for i in 0..<arr.len - 1:
22-
if arr[i] > arr[i + 1]:
23-
return false
24-
return true
21+
for i in 0..<arr.len - 1:
22+
if arr[i] > arr[i + 1]:
23+
return false
24+
return true
2525

2626
proc bogoSort*[T](arr: var openArray[T]) =
27-
while not isSorted(arr):
28-
shuffle(arr)
27+
while not isSorted(arr):
28+
shuffle(arr)
2929

3030
when isMainModule:
31-
import std/unittest
32-
suite "BogoSortTests":
33-
test "sort an array of integers":
34-
var arr = @[3, 1, 2]
35-
bogoSort(arr)
36-
check isSorted(arr)
37-
38-
test "sort an array of strings":
39-
var arr = @["c", "a", "b"]
40-
bogoSort(arr)
41-
check isSorted(arr)
31+
import std/unittest
32+
suite "BogoSortTests":
33+
test "sort an array of integers":
34+
var arr = @[3, 1, 2]
35+
bogoSort(arr)
36+
check isSorted(arr)
37+
38+
test "sort an array of strings":
39+
var arr = @["c", "a", "b"]
40+
bogoSort(arr)
41+
check isSorted(arr)

0 commit comments

Comments
 (0)