17
17
* // nums becomes {1, 2, 3, 4, 5}
18
18
* @endcode
19
19
*
20
- * @author Rohith A K[https://github.com/rohleet]
20
+ * @author Rohith A K
21
21
* @date 2025-09-25
22
22
*/
23
23
@@ -53,6 +53,8 @@ std::vector<int>& bubble_sort(std::vector<int>& nums) {
53
53
return nums;
54
54
}
55
55
56
+ } // namespace sorting
57
+
56
58
/* *
57
59
* @brief Self-test implementations of the bubble_sort function.
58
60
*
@@ -64,21 +66,19 @@ std::vector<int>& bubble_sort(std::vector<int>& nums) {
64
66
static void tests () {
65
67
std::vector<int > v1 = {2 , 8 , 1 , 6 , 2 , 0 , 3 , 6 };
66
68
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);
68
70
69
71
std::vector<int > v2 = {5 , 4 , 3 , 2 , 1 };
70
72
const std::vector<int > expected2 = {1 , 2 , 3 , 4 , 5 };
71
- assert (bubble_sort (v2) == expected2);
73
+ assert (sorting:: bubble_sort (v2) == expected2);
72
74
73
75
std::vector<int > v3 = {1 , 2 , 3 , 4 , 5 };
74
76
const std::vector<int > expected3 = {1 , 2 , 3 , 4 , 5 };
75
- assert (bubble_sort (v3) == expected3);
77
+ assert (sorting:: bubble_sort (v3) == expected3);
76
78
77
79
std::cout << " All tests have successfully passed!\n " ;
78
80
}
79
81
80
- } // namespace sorting
81
-
82
82
/* *
83
83
* @brief Main function
84
84
*
@@ -87,6 +87,6 @@ static void tests() {
87
87
* @returns 0 on successful execution
88
88
*/
89
89
int main () {
90
- sorting:: tests (); // run self-test implementations
90
+ tests (); // run self-test implementations
91
91
return 0 ;
92
92
}
0 commit comments