Skip to content

Commit fb3242c

Browse files
trial
Signed-off-by: Christian Parpart <[email protected]>
1 parent 19788a1 commit fb3242c

File tree

1 file changed

+49
-49
lines changed

1 file changed

+49
-49
lines changed

test-reflection-cpp.cpp

+49-49
Original file line numberDiff line numberDiff line change
@@ -179,52 +179,52 @@ TEST_CASE("MemberTypeOf", "[reflection]")
179179
static_assert(std::same_as<Reflection::MemberTypeOf<4, TestStruct>, Person>);
180180
}
181181

182-
struct Record
183-
{
184-
int id;
185-
std::string name;
186-
int age;
187-
};
188-
189-
TEST_CASE("Compare.simple", "[reflection]")
190-
{
191-
auto const r1 = Record { .id = 1, .name = "John Doe", .age = 42 };
192-
auto const r2 = Record { .id = 1, .name = "John Doe", .age = 42 };
193-
auto const r3 = Record { .id = 2, .name = "Jane Doe", .age = 43 };
194-
195-
std::string diff;
196-
auto differenceCallback = [&](std::string_view name, auto const& lhs, auto const& rhs) {
197-
diff += std::format("{}: {} != {}\n", name, lhs, rhs);
198-
};
199-
200-
Reflection::CollectDifferences(r1, r2, differenceCallback);
201-
CHECK(diff.empty());
202-
Reflection::CollectDifferences(r1, r3, differenceCallback);
203-
CHECK(diff == "id: 1 != 2\nname: John Doe != Jane Doe\nage: 42 != 43\n");
204-
}
205-
206-
struct Table
207-
{
208-
Record first;
209-
Record second;
210-
};
211-
212-
TEST_CASE("Compare.nested", "[reflection]")
213-
{
214-
auto const t1 = Table { .first = { .id = 1, .name = "John Doe", .age = 42 },
215-
.second = { .id = 2, .name = "Jane Doe", .age = 43 } };
216-
auto const t2 = Table { .first = { .id = 1, .name = "John Doe", .age = 42 },
217-
.second = { .id = 2, .name = "Jane Doe", .age = 43 } };
218-
auto const t3 = Table { .first = { .id = 1, .name = "John Doe", .age = 42 },
219-
.second = { .id = 3, .name = "Jane Doe", .age = 43 } };
220-
221-
std::string diff;
222-
auto differenceCallback = [&](std::string_view name, auto const& lhs, auto const& rhs) {
223-
diff += std::format("{}: {} != {}\n", name, lhs, rhs);
224-
};
225-
226-
Reflection::CollectDifferences(t1, t2, differenceCallback);
227-
CHECK(diff.empty());
228-
Reflection::CollectDifferences(t1, t3, differenceCallback);
229-
CHECK(diff == "id: 2 != 3\n");
230-
}
182+
// struct Record
183+
// {
184+
// int id;
185+
// std::string name;
186+
// int age;
187+
// };
188+
//
189+
// TEST_CASE("Compare.simple", "[reflection]")
190+
// {
191+
// auto const r1 = Record { .id = 1, .name = "John Doe", .age = 42 };
192+
// auto const r2 = Record { .id = 1, .name = "John Doe", .age = 42 };
193+
// auto const r3 = Record { .id = 2, .name = "Jane Doe", .age = 43 };
194+
//
195+
// std::string diff;
196+
// auto differenceCallback = [&](std::string_view name, auto const& lhs, auto const& rhs) {
197+
// diff += std::format("{}: {} != {}\n", name, lhs, rhs);
198+
// };
199+
//
200+
// Reflection::CollectDifferences(r1, r2, differenceCallback);
201+
// CHECK(diff.empty());
202+
// Reflection::CollectDifferences(r1, r3, differenceCallback);
203+
// CHECK(diff == "id: 1 != 2\nname: John Doe != Jane Doe\nage: 42 != 43\n");
204+
// }
205+
//
206+
// struct Table
207+
// {
208+
// Record first;
209+
// Record second;
210+
// };
211+
//
212+
// TEST_CASE("Compare.nested", "[reflection]")
213+
// {
214+
// auto const t1 = Table { .first = { .id = 1, .name = "John Doe", .age = 42 },
215+
// .second = { .id = 2, .name = "Jane Doe", .age = 43 } };
216+
// auto const t2 = Table { .first = { .id = 1, .name = "John Doe", .age = 42 },
217+
// .second = { .id = 2, .name = "Jane Doe", .age = 43 } };
218+
// auto const t3 = Table { .first = { .id = 1, .name = "John Doe", .age = 42 },
219+
// .second = { .id = 3, .name = "Jane Doe", .age = 43 } };
220+
//
221+
// std::string diff;
222+
// auto differenceCallback = [&](std::string_view name, auto const& lhs, auto const& rhs) {
223+
// diff += std::format("{}: {} != {}\n", name, lhs, rhs);
224+
// };
225+
//
226+
// Reflection::CollectDifferences(t1, t2, differenceCallback);
227+
// CHECK(diff.empty());
228+
// Reflection::CollectDifferences(t1, t3, differenceCallback);
229+
// CHECK(diff == "id: 2 != 3\n");
230+
// }

0 commit comments

Comments
 (0)