4
4
*
5
5
* @author Cliff Green, Roxanne Agerone
6
6
*
7
- * @copyright (c) 2019-2024 by Cliff Green, Roxanne Agerone
7
+ * @copyright (c) 2019-2025 by Cliff Green, Roxanne Agerone
8
8
*
9
9
* Distributed under the Boost Software License, Version 1.0.
10
10
* (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
16
16
17
17
#include < cstddef> // std::byte
18
18
#include < cstdint> // std::uint32_t, etc
19
+ #include < ranges> // std::views::iota
19
20
20
21
#include " serialize/extract_append.hpp"
21
22
22
- #include " utility/repeat.hpp"
23
23
#include " utility/byte_array.hpp"
24
24
25
25
constexpr std::uint32_t val1 = 0xDDCCBBAA ;
@@ -65,8 +65,9 @@ TEST_CASE ( "Append values into a buffer", "[append_val]" ) {
65
65
REQUIRE (chops::append_val<std::endian::big>(ptr, val4) == 8u ); ptr += sizeof (val4);
66
66
REQUIRE (chops::append_val<std::endian::big>(ptr, val5) == 4u ); ptr += sizeof (val5);
67
67
REQUIRE (chops::append_val<std::endian::big>(ptr, val6) == 1u );
68
- chops::repeat (arr_sz, [&buf] (int i) {
69
- REQUIRE (std::to_integer<int >(buf[i]) == std::to_integer<int >(net_buf_big[i])); } );
68
+ for (int i : std::views::iota (0 , arr_sz)) {
69
+ REQUIRE (std::to_integer<int >(buf[i]) == std::to_integer<int >(net_buf_big[i]));
70
+ }
70
71
}
71
72
SECTION (" Append_val with multiple values, little endian" ) {
72
73
std::byte* ptr = buf;
@@ -76,8 +77,9 @@ TEST_CASE ( "Append values into a buffer", "[append_val]" ) {
76
77
REQUIRE (chops::append_val<std::endian::little>(ptr, val4) == 8u ); ptr += sizeof (val4);
77
78
REQUIRE (chops::append_val<std::endian::little>(ptr, val5) == 4u ); ptr += sizeof (val5);
78
79
REQUIRE (chops::append_val<std::endian::little>(ptr, val6) == 1u );
79
- chops::repeat (arr_sz, [&buf] (int i) {
80
- REQUIRE (std::to_integer<int >(buf[i]) == std::to_integer<int >(net_buf_little[i])); } );
80
+ for (int i : std::views::iota (0 , arr_sz)) {
81
+ REQUIRE (std::to_integer<int >(buf[i]) == std::to_integer<int >(net_buf_little[i]));
82
+ }
81
83
}
82
84
}
83
85
0 commit comments