|
21 | 21 | #include <array> /// for array
|
22 | 22 | #include <iostream> /// for IO operations
|
23 | 23 | #include <limits> /// for numeric limits
|
| 24 | +#include <cstdint> /// for uint32_t |
24 | 25 |
|
25 | 26 | /**
|
26 | 27 | * @namespace
|
@@ -60,10 +61,12 @@ void findMinimumEdge(const T &infinity,
|
60 | 61 | * define a large constant value for int
|
61 | 62 | * define a large constant value for float
|
62 | 63 | * define a large constant value for double
|
| 64 | + * define infinity for uint32_t |
63 | 65 | */
|
64 | 66 | constexpr int INFINITY_INT = std::numeric_limits<int>::max();
|
65 | 67 | constexpr float INFINITY_FLOAT = std::numeric_limits<float>::max();
|
66 | 68 | constexpr double INFINITY_DOUBLE = std::numeric_limits<double>::max();
|
| 69 | +constexpr uint32_t INFINITY_UINT32 = UINT32_MAX; |
67 | 70 |
|
68 | 71 | /**
|
69 | 72 | * @brief Self-test implementations
|
@@ -161,6 +164,15 @@ static void test() {
|
161 | 164 | 5, 5, 5, 5, 0};
|
162 | 165 | greedy_algorithms::findMinimumEdge(INFINITY_INT, graph10);
|
163 | 166 |
|
| 167 | + // Test Case with uint32_t values |
| 168 | + std::cout << "\nTest Case 11 :\n"; |
| 169 | + std::array<std::array<uint32_t, 4>, 4> graph_uint32{ |
| 170 | + 0, 5, INFINITY_UINT32, 9, |
| 171 | + 5, 0, 2, INFINITY_UINT32, |
| 172 | + INFINITY_UINT32, 2, 0, 6, |
| 173 | + 9, INFINITY_UINT32, 6, 0}; |
| 174 | + greedy_algorithms::findMinimumEdge(INFINITY_UINT32, graph_uint32); |
| 175 | + |
164 | 176 | std::cout << "\nAll tests have successfully passed!\n";
|
165 | 177 | }
|
166 | 178 |
|
|
0 commit comments