Skip to content

Commit e89b5bf

Browse files
committed
Tests are outside the namespace
1 parent 6f0ed16 commit e89b5bf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sorting/bubble_sort_optimized.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* // nums becomes {1, 2, 3, 4, 5}
1818
* @endcode
1919
*
20-
* @author Rohith A K[https://github.com/rohleet]
20+
* @author Rohith A K
2121
* @date 2025-09-25
2222
*/
2323

@@ -53,6 +53,8 @@ std::vector<int>& bubble_sort(std::vector<int>& nums) {
5353
return nums;
5454
}
5555

56+
} // namespace sorting
57+
5658
/**
5759
* @brief Self-test implementations of the bubble_sort function.
5860
*
@@ -64,21 +66,19 @@ std::vector<int>& bubble_sort(std::vector<int>& nums) {
6466
static void tests() {
6567
std::vector<int> v1 = {2, 8, 1, 6, 2, 0, 3, 6};
6668
const std::vector<int> expected1 = {0, 1, 2, 2, 3, 6, 6, 8};
67-
assert(bubble_sort(v1) == expected1);
69+
assert(sorting::bubble_sort(v1) == expected1);
6870

6971
std::vector<int> v2 = {5, 4, 3, 2, 1};
7072
const std::vector<int> expected2 = {1, 2, 3, 4, 5};
71-
assert(bubble_sort(v2) == expected2);
73+
assert(sorting::bubble_sort(v2) == expected2);
7274

7375
std::vector<int> v3 = {1, 2, 3, 4, 5};
7476
const std::vector<int> expected3 = {1, 2, 3, 4, 5};
75-
assert(bubble_sort(v3) == expected3);
77+
assert(sorting::bubble_sort(v3) == expected3);
7678

7779
std::cout << "All tests have successfully passed!\n";
7880
}
7981

80-
} // namespace sorting
81-
8282
/**
8383
* @brief Main function
8484
*
@@ -87,6 +87,6 @@ static void tests() {
8787
* @returns 0 on successful execution
8888
*/
8989
int main() {
90-
sorting::tests(); // run self-test implementations
90+
tests(); // run self-test implementations
9191
return 0;
9292
}

0 commit comments

Comments
 (0)