|
28 | 28 | #include "../helper_macros.h" |
29 | 29 | #include "../helper_types.h" |
30 | 30 |
|
31 | | -#include <print> // REMOVE ME |
32 | | -#include <iostream> // REMOVE ME |
33 | | - |
34 | 31 | template <typename CharT, typename TraitsT> |
35 | 32 | void test_ispanstream(std::basic_ispanstream<CharT, TraitsT>& spSt, std::size_t size) { |
36 | 33 | assert(spSt); |
@@ -80,42 +77,41 @@ void test() { |
80 | 77 | constexpr std::basic_string_view<CharT, TraitsT> sv{SV("zmt 94 hkt 82 pir 43vr")}; |
81 | 78 | assert(sv.size() < 30UZ); |
82 | 79 |
|
83 | | - // Create a std::span test value |
84 | | - CharT arr[30UZ]{}; |
85 | | - initialize_array_from_string_view(arr, sv); |
86 | | - |
87 | | - std::span<CharT> sp{arr}; |
88 | | - |
89 | | - // Create a "Read Only Sequence" test value |
90 | | - CharT rosArr[30UZ]{}; |
91 | | - initialize_array_from_string_view(rosArr, sv); |
92 | | - |
93 | | - ReadOnlySpan<CharT, 30UZ> ros{rosArr}; |
94 | | - assert(ros.size() == 30UZ); |
95 | | - |
96 | | - // std::span` + Mode: default (`in`) |
97 | | - { |
98 | | - SpStream spSt(sp); |
99 | | - test_ispanstream(spSt, 30UZ); |
100 | | - } |
101 | | - // std::span` + Mode: explicit `in` |
102 | | - { |
103 | | - SpStream spSt(sp, std::ios_base::in); |
104 | | - test_ispanstream(spSt, 30UZ); |
105 | | - } |
106 | | - |
107 | | - // `ReadOnlySpan` + Mode: default (`in`) |
108 | 80 | { |
109 | | - SpStream spSt(ros); |
110 | | - test_ispanstream(spSt, 30UZ); |
| 81 | + // Create a std::span test value |
| 82 | + CharT arr[30UZ]{}; |
| 83 | + initialize_array_from_string_view(arr, sv); |
| 84 | + |
| 85 | + std::span<CharT> sp{arr}; |
| 86 | + |
| 87 | + // std::span` + Mode: default (`in`) |
| 88 | + { |
| 89 | + SpStream spSt(sp); |
| 90 | + test_ispanstream(spSt, 30UZ); |
| 91 | + } |
| 92 | + // std::span` + Mode: explicit `in` |
| 93 | + { |
| 94 | + SpStream spSt(sp, std::ios_base::in); |
| 95 | + test_ispanstream(spSt, 30UZ); |
| 96 | + } |
111 | 97 | } |
112 | 98 |
|
113 | 99 | { |
114 | | - SpStream spSt(sp, std::ios_base::ate); |
115 | | - std::println(stderr, "spSt.span().size() = {}", spSt.span().size()); |
116 | | - // std::println(stderr, "spSt.tellg() = {}", spSt.tellg()); |
117 | | - std::cerr << "spSt.tellg() = " << spSt.tellg() << std::endl; |
118 | | - assert(false); |
| 100 | + // Create a "Read Only Sequence" test value |
| 101 | + CharT arr[30UZ]{}; |
| 102 | + initialize_array_from_string_view(arr, sv); |
| 103 | + |
| 104 | + ReadOnlySpan<CharT, 30UZ> ros{arr}; |
| 105 | + assert(ros.size() == 30UZ); |
| 106 | + |
| 107 | + { |
| 108 | + SpStream spSt(ros); |
| 109 | + test_ispanstream(spSt, 30UZ); |
| 110 | + } |
| 111 | + { |
| 112 | + SpStream spSt(std::move(ros)); |
| 113 | + test_ispanstream(spSt, 30UZ); |
| 114 | + } |
119 | 115 | } |
120 | 116 | } |
121 | 117 |
|
|
0 commit comments