Skip to content

Commit aeec5f1

Browse files
committed
Fixing clang-tidy issue.
1 parent aae6653 commit aeec5f1

File tree

1 file changed

+37
-47
lines changed

1 file changed

+37
-47
lines changed

test/arg_stream/arg_stream_test.cpp

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,46 @@
2121
BOOST_AUTO_TEST_CASE(arg_stream_single_basic_functionality) {
2222
// Test basic construction and single use
2323
adobe::arg_stream::single<int> stream(42);
24-
24+
2525
// Should not be at EOF initially
2626
BOOST_CHECK(!stream.eof());
27-
27+
2828
// Get the value once
2929
int value = stream.get_next_arg<int>();
3030
BOOST_CHECK_EQUAL(value, 42);
31-
31+
3232
// Should be at EOF after single use
3333
BOOST_CHECK(stream.eof());
34-
34+
3535
// Should throw no_more_args if we try to get another arg
3636
BOOST_CHECK_THROW(stream.get_next_arg<int>(), adobe::arg_stream::no_more_args);
3737
}
3838

3939
BOOST_AUTO_TEST_CASE(arg_stream_single_multiple_count) {
4040
// Test with repeat count
4141
adobe::arg_stream::single<std::string> stream("hello", 3);
42-
42+
4343
// Should not be at EOF initially
4444
BOOST_CHECK(!stream.eof());
45-
45+
4646
// Get the value three times
4747
for (int i = 0; i < 3; ++i) {
4848
BOOST_CHECK(!stream.eof());
4949
std::string value = stream.get_next_arg<std::string>();
5050
BOOST_CHECK_EQUAL(value, "hello");
5151
}
52-
52+
5353
// Should be at EOF after three uses
5454
BOOST_CHECK(stream.eof());
55-
55+
5656
// Should throw no_more_args if we try to get another arg
5757
BOOST_CHECK_THROW(stream.get_next_arg<std::string>(), adobe::arg_stream::no_more_args);
5858
}
5959

6060
BOOST_AUTO_TEST_CASE(arg_stream_single_type_conversion) {
6161
// Test implicit type conversions
6262
adobe::arg_stream::single<int> stream(42);
63-
63+
6464
// Convert int to double
6565
double d_value = stream.get_next_arg<double>();
6666
BOOST_CHECK_EQUAL(d_value, 42.0);
@@ -69,10 +69,10 @@ BOOST_AUTO_TEST_CASE(arg_stream_single_type_conversion) {
6969
BOOST_AUTO_TEST_CASE(arg_stream_single_zero_count) {
7070
// Test with zero repeat count
7171
adobe::arg_stream::single<int> stream(42, 0);
72-
72+
7373
// Should be at EOF immediately
7474
BOOST_CHECK(stream.eof());
75-
75+
7676
// Should throw no_more_args immediately
7777
BOOST_CHECK_THROW(stream.get_next_arg<int>(), adobe::arg_stream::no_more_args);
7878
}
@@ -81,10 +81,10 @@ BOOST_AUTO_TEST_CASE(arg_stream_single_copy_semantics) {
8181
// Test that the value is properly stored and accessed
8282
std::string original = "test_string";
8383
adobe::arg_stream::single<std::string> stream(original);
84-
84+
8585
std::string retrieved = stream.get_next_arg<std::string>();
8686
BOOST_CHECK_EQUAL(retrieved, original);
87-
87+
8888
// Original should be unchanged
8989
BOOST_CHECK_EQUAL(original, "test_string");
9090
}
@@ -93,57 +93,46 @@ BOOST_AUTO_TEST_CASE(arg_stream_single_reference_type) {
9393
// Test with reference types
9494
int original = 100;
9595
adobe::arg_stream::single<int> stream(original, 2);
96-
96+
9797
// Modify original
9898
original = 200;
99-
99+
100100
// Stream should still have the original value (100) since it stores by value
101101
int first = stream.get_next_arg<int>();
102102
int second = stream.get_next_arg<int>();
103103
BOOST_CHECK_EQUAL(first, 100);
104104
BOOST_CHECK_EQUAL(second, 100);
105+
BOOST_CHECK_EQUAL(original, 200);
105106
}
106107

107108
// Test functions for call tests
108-
int add_two_ints(int a, int b) {
109-
return a + b;
110-
}
109+
int add_two_ints(int a, int b) { return a + b; }
111110

112-
int add_three_ints(int a, int b, int c) {
113-
return a + b + c;
114-
}
111+
int add_three_ints(int a, int b, int c) { return a + b + c; }
115112

116-
double multiply_double_int(double d, int i) {
117-
return d * i;
118-
}
113+
double multiply_double_int(double d, int i) { return d * i; }
119114

120115
void void_function(int /* value */) {
121116
// Just consume the value, nothing to return
122117
}
123118

124-
std::string concat_strings(const std::string& a, const std::string& b) {
125-
return a + b;
126-
}
119+
std::string concat_strings(const std::string& a, const std::string& b) { return a + b; }
127120

128121
// Test class for member function tests
129122
class TestClass {
130123
public:
131124
int value;
132125
TestClass(int v) : value(v) {}
133-
134-
int add_to_value(int x) {
135-
return value + x;
136-
}
137-
138-
int multiply_values(int x, int y) {
139-
return value * x * y;
140-
}
126+
127+
int add_to_value(int x) { return value + x; }
128+
129+
int multiply_values(int x, int y) { return value * x * y; }
141130
};
142131

143132
BOOST_AUTO_TEST_CASE(arg_stream_call_basic_function) {
144133
// Test calling a simple function with two arguments
145134
adobe::arg_stream::single<int> stream1(10, 2);
146-
135+
147136
int result = adobe::arg_stream::call(add_two_ints, stream1);
148137
BOOST_CHECK_EQUAL(result, 20); // 10 + 10
149138
}
@@ -152,20 +141,20 @@ BOOST_AUTO_TEST_CASE(arg_stream_call_mixed_types) {
152141
// Test calling a function with mixed argument types
153142
adobe::arg_stream::single<double> double_stream(2.5);
154143
adobe::arg_stream::single<int> int_stream(4);
155-
144+
156145
auto chained = adobe::arg_stream::make_chain(double_stream, int_stream);
157-
146+
158147
double result = adobe::arg_stream::call(multiply_double_int, chained);
159148
BOOST_CHECK_EQUAL(result, 10.0); // 2.5 * 4
160149
}
161150

162151
BOOST_AUTO_TEST_CASE(arg_stream_call_void_function) {
163152
// Test calling a void function
164153
adobe::arg_stream::single<int> stream(42);
165-
154+
166155
// Should not throw and should consume the argument
167156
adobe::arg_stream::call(void_function, stream);
168-
157+
169158
// Stream should be exhausted
170159
BOOST_CHECK(stream.eof());
171160
}
@@ -174,9 +163,9 @@ BOOST_AUTO_TEST_CASE(arg_stream_call_string_function) {
174163
// Test calling a function with string arguments
175164
adobe::arg_stream::single<std::string> stream1("Hello");
176165
adobe::arg_stream::single<std::string> stream2(" World");
177-
166+
178167
auto chained = adobe::arg_stream::make_chain(stream1, stream2);
179-
168+
180169
std::string result = adobe::arg_stream::call(concat_strings, chained);
181170
BOOST_CHECK_EQUAL(result, "Hello World");
182171
}
@@ -185,7 +174,7 @@ BOOST_AUTO_TEST_CASE(arg_stream_call_member_function) {
185174
// Test calling member functions
186175
TestClass obj(5);
187176
adobe::arg_stream::single<int> stream(10);
188-
177+
189178
int result = adobe::arg_stream::call(&obj, &TestClass::add_to_value, stream);
190179
BOOST_CHECK_EQUAL(result, 15); // 5 + 10
191180
}
@@ -195,17 +184,18 @@ BOOST_AUTO_TEST_CASE(arg_stream_call_member_function_multiple_args) {
195184
TestClass obj(2);
196185
adobe::arg_stream::single<int> stream1(3);
197186
adobe::arg_stream::single<int> stream2(4);
198-
187+
199188
auto chained = adobe::arg_stream::make_chain(stream1, stream2);
200-
189+
201190
int result = adobe::arg_stream::call(&obj, &TestClass::multiply_values, chained);
202191
BOOST_CHECK_EQUAL(result, 24); // 2 * 3 * 4
203192
}
204193

205194
BOOST_AUTO_TEST_CASE(arg_stream_call_insufficient_args) {
206195
// Test that call throws when there are insufficient arguments
207196
adobe::arg_stream::single<int> stream(10, 1); // Only one argument available
208-
197+
209198
// Should throw no_more_args when trying to call a function requiring two arguments
210-
BOOST_CHECK_THROW(adobe::arg_stream::call(add_two_ints, stream), adobe::arg_stream::no_more_args);
199+
BOOST_CHECK_THROW(adobe::arg_stream::call(add_two_ints, stream),
200+
adobe::arg_stream::no_more_args);
211201
}

0 commit comments

Comments
 (0)