Skip to content

Commit

Permalink
Update TestOverloadingGenericMethodInfer.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
vczh committed Feb 16, 2020
1 parent 8b2004d commit fd99a17
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion Tools/CppDoc/UnitTest/TestOverloadingGenericMethodInfer.cpp
Expand Up @@ -7,8 +7,18 @@ namespace Input__TestOverloadingGenericFunction_Method
template<typename... Ts>
struct MakeTuple
{
MakeTuple<int, Ts...> operator++();

MakeTuple<Ts..., int> operator++(int);

template<typename T>
MakeTuple<Ts..., T> operator<<(T);

template<typename T>
MakeTuple<Ts..., T> operator[](T);

template<typename... Us>
MakeTuple<Ts..., Us...> operator+(MakeTuple<Us...>);
};
);
}
Expand All @@ -20,6 +30,34 @@ TEST_FILE
using namespace Input__TestOverloadingGenericFunction_Method;
COMPILE_PROGRAM(program, pa, input);

ASSERT_OVERLOADING_VERBOSE(
(++MakeTuple<>()),
L"((++ MakeTuple<>()))",
L"::MakeTuple<{__int32 $PR}> $PR",
MakeTuple<int>
);

ASSERT_OVERLOADING_VERBOSE(
(++++++MakeTuple<>()),
L"((++ (++ (++ MakeTuple<>()))))",
L"::MakeTuple<{__int32 $PR, __int32 $PR, __int32 $PR}> $PR",
MakeTuple<int, int, int>
);

ASSERT_OVERLOADING_VERBOSE(
(MakeTuple<>()++),
L"((MakeTuple<>() ++))",
L"::MakeTuple<{__int32 $PR}> $PR",
MakeTuple<int>
);

ASSERT_OVERLOADING_VERBOSE(
(MakeTuple<>()++++++),
L"((((MakeTuple<>() ++) ++) ++))",
L"::MakeTuple<{__int32 $PR, __int32 $PR, __int32 $PR}> $PR",
MakeTuple<int, int, int>
);

ASSERT_OVERLOADING_VERBOSE(
(MakeTuple<>() << 1),
L"((MakeTuple<>() << 1))",
Expand All @@ -33,9 +71,30 @@ TEST_FILE
L"::MakeTuple<{__int32 $PR, double $PR, float $PR, char $PR, wchar_t $PR, bool $PR}> $PR",
MakeTuple<int, double, float, char, wchar_t, bool>
);

ASSERT_OVERLOADING_VERBOSE(
(MakeTuple<>()[0]),
L"(MakeTuple<>()[0])",
L"::MakeTuple<{__int32 $PR}> $PR",
MakeTuple<int>
);

ASSERT_OVERLOADING_VERBOSE(
(MakeTuple<>()[0][1][2]),
L"(MakeTuple<>()[0][1][2])",
L"::MakeTuple<{__int32 $PR, __int32 $PR, __int32 $PR}> $PR",
MakeTuple<int, int, int>
);

ASSERT_OVERLOADING_VERBOSE(
(MakeTuple<>()['a'][true][1.0] + ++++++MakeTuple<>()),
L"((MakeTuple<>()['a'][true][1.0] + (++ (++ (++ MakeTuple<>())))))",
L"::MakeTuple<{char $PR, bool $PR, double $PR, __int32 $PR, __int32 $PR, __int32 $PR}> $PR",
MakeTuple<char, bool, double, int, int, int>
);
});

// test methods/operators
// test methods
// use multiple levels of type arguments in function arguments
// call methods/operators on "this"
}

0 comments on commit fd99a17

Please sign in to comment.