87 std::cout <<
"Test 1 - as a C-array...";
89 std::array<int, size> arr = {-22, 100, 150, 35, -10, 99};
92 assert(std::is_sorted(std::begin(arr), std::end(arr)));
93 std::cout <<
" Passed\n";
94 for (
int i = 0; i < size; i++) {
95 std::cout << arr[i] <<
", ";
97 std::cout << std::endl;
100 std::cout <<
"\nTest 2 - as a std::array...";
101 std::array<double, size> double_arr = {-100.2, 10.2, 20.0, 9.0, 7.5, 7.2};
103 assert(std::is_sorted(std::begin(sorted_arr), std::end(sorted_arr)));
104 std::cout <<
" Passed\n";
105 for (
int i = 0; i < size; i++) {
106 std::cout << double_arr[i] <<
", ";
108 std::cout << std::endl;
111 std::cout <<
"\nTest 3 - 200 random numbers as a std::array...";
112 const int size2 = 200;
113 std::array<float, size2> rand_arr{};
115 for (
auto &a : rand_arr) {
117 a = float(std::rand() % 1000 - 500) / 100.f;
121 assert(std::is_sorted(std::begin(float_arr), std::end(float_arr)));
122 std::cout <<
" Passed\n";
124 std::cout << std::endl;