55
66using namespace java_symbols ;
77
8+ template <typename T1 , typename T2 >
9+ static std::ostream &operator <<(std::ostream &os, const std::tuple<T1 , T2 > &t)
10+ {
11+ return os << " (" << std::get<0 >(t) << " , " << std::get<1 >(t) << " )" ;
12+ }
13+
814static void assert_eq (const auto & expected, const auto & actual)
915{
1016 if (expected != actual)
@@ -15,14 +21,6 @@ static void assert_eq(const auto& expected, const auto& actual)
1521 }
1622}
1723
18- static void assert_that (bool value)
19- {
20- if (not value)
21- {
22- throw std::runtime_error (" Test failed" );
23- }
24- }
25-
2624int main ()
2725{
2826 std::cout << " Running tests..." << " \n " ;
@@ -96,28 +94,28 @@ int main()
9694 assert_eq (0 , find_token (" import/" , " import" , 0 , true ));
9795 assert_eq (0 , find_token (" import+" , " import" , 0 , true ));
9896
99- assert_that (next_annotation_t (" @A" , " A" ) == next_annotation (" @A" ));
100- assert_that (next_annotation_t (" @A" , " A" ) == next_annotation (" @A\n " ));
101- assert_that (next_annotation_t (" @A()" , " A" ) == next_annotation (" @A()" ));
97+ assert_eq (next_annotation_t (" @A" , " A" ), next_annotation (" @A" ));
98+ assert_eq (next_annotation_t (" @A" , " A" ), next_annotation (" @A\n " ));
99+ assert_eq (next_annotation_t (" @A()" , " A" ), next_annotation (" @A()" ));
102100
103- assert_that (next_annotation_t (" @A" , " A" ) == next_annotation (" @A class B {}" ));
101+ assert_eq (next_annotation_t (" @A" , " A" ), next_annotation (" @A class B {}" ));
104102
105- assert_that (next_annotation_t (" @A(a = ')')" , " A" ) == next_annotation (" @A(a = ')')" ));
106- assert_that (next_annotation_t (" @A(a = ')')" , " A" ) == next_annotation (" @A(a = ')') class B {}" ));
103+ assert_eq (next_annotation_t (" @A(a = ')')" , " A" ), next_annotation (" @A(a = ')')" ));
104+ assert_eq (next_annotation_t (" @A(a = ')')" , " A" ), next_annotation (" @A(a = ')') class B {}" ));
107105
108- assert_that (next_annotation_t (" @A(a = \" )\" )" , " A" ) == next_annotation (" @A(a = \" )\" )" ));
109- assert_that (next_annotation_t (" @A(a = \" )))\" /*)))*/)" , " A" ) == next_annotation (" @A(a = \" )))\" /*)))*/) class B {}" ));
110- assert_that (next_annotation_t (" @A(/* ) */)" , " A" ) == next_annotation (" @A(/* ) */)" ));
111- assert_that (next_annotation_t (" @A" , " A" ) == next_annotation (" method(@A Object o)" ));
106+ assert_eq (next_annotation_t (" @A(a = \" )\" )" , " A" ), next_annotation (" @A(a = \" )\" )" ));
107+ assert_eq (next_annotation_t (" @A(a = \" )))\" /*)))*/)" , " A" ), next_annotation (" @A(a = \" )))\" /*)))*/) class B {}" ));
108+ assert_eq (next_annotation_t (" @A(/* ) */)" , " A" ), next_annotation (" @A(/* ) */)" ));
109+ assert_eq (next_annotation_t (" @A" , " A" ), next_annotation (" method(@A Object o)" ));
112110
113- assert_that (next_annotation_t (" @A(\n value = \" )\" /* ) */\n // )\n )" , " A" ) == next_annotation (" @A(\n value = \" )\" /* ) */\n // )\n )\n " ));
111+ assert_eq (next_annotation_t (" @A(\n value = \" )\" /* ) */\n // )\n )" , " A" ), next_annotation (" @A(\n value = \" )\" /* ) */\n // )\n )\n " ));
114112
115- assert_that (next_annotation_t (" @D" , " D" ) == next_annotation (" // @A\n /* @B */\n value = \" @C\" ;\n @D" ));
113+ assert_eq (next_annotation_t (" @D" , " D" ), next_annotation (" // @A\n /* @B */\n value = \" @C\" ;\n @D" ));
116114
117- assert_that (next_annotation_t (" @a.b.C" , " a.b.C" ) == next_annotation (" @a.b.C" ));
118- assert_that (next_annotation_t (" @a/**/.B" , " a.B" ) == next_annotation (" @a/**/.B" ));
115+ assert_eq (next_annotation_t (" @a.b.C" , " a.b.C" ), next_annotation (" @a.b.C" ));
116+ assert_eq (next_annotation_t (" @a/**/.B" , " a.B" ), next_annotation (" @a/**/.B" ));
119117
120- assert_that (next_annotation_t (" @A(value = /* ) */ \" )\" )" , " A" ) == next_annotation (" @A(value = /* ) */ \" )\" )//)" ));
118+ assert_eq (next_annotation_t (" @A(value = /* ) */ \" )\" )" , " A" ), next_annotation (" @A(value = /* ) */ \" )\" )//)" ));
121119
122120 {
123121 constexpr std::string_view original_content = R"(
0 commit comments