5#include <system/object.h>
6#include <system/shared_ptr.h>
7#include <system/string.h>
8#include <gtest/gtest.h>
14template <
class TReturn,
class... TArgs>
29 TestCaseData::expectedResult = result;
35 template <
class TCallback>
36 void test(
const TCallback& callback)
38 auto actualResult = callTuple(callback, std::index_sequence_for<TArgs...>());
39 if (actualResult != expectedResult)
41 FAIL() << (
System::String::Format(u
"Expected: {0}, but was: {1}.", expectedResult, actualResult)).ToUtf8String();
47 template <
class TCallback, std::size_t... Indices>
48 auto callTuple(TCallback& callback, std::index_sequence<Indices...>)
50 return callback(std::get<Indices>(arguments)...);
55 std::tuple<TArgs...> arguments;
57 TReturn expectedResult;
61template <
class... TArgs>
73 template <
class TCallback>
74 void test(
const TCallback& callback)
76 callTuple(callback, std::index_sequence_for<TArgs...>());
81 template <
class TCallback, std::size_t... Indices>
82 auto callTuple(TCallback& callback, std::index_sequence<Indices...>)
84 callback(std::get<Indices>(arguments)...);
89 std::tuple<TArgs...> arguments;
TestCaseData(TArgs... args)
Initializes a new instance of the TestCaseData class.
Definition: test_case_data.h:67
void test(const TCallback &callback)
Call callback.
Definition: test_case_data.h:74
The TestCaseData class provides extended test case information for a parameterized test.
Definition: test_case_data.h:16
TestCaseData(TArgs... args)
Initializes a new instance of the TestCaseData class.
Definition: test_case_data.h:20
System::SharedPtr< TestCaseData > Returns(TReturn result)
Sets the expected result for the test.
Definition: test_case_data.h:27
void test(const TCallback &callback)
Call callback and check the result.
Definition: test_case_data.h:36
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
static String Format(const SharedPtr< IFormatProvider > &fp, const String &format, const Args &... args)
Formats string in C# style.
Definition: string.h:1405
Definition: exceptions.h:943
SmartPtr< X > MakeSharedPtr(X *p)
Converts raw pointer to smart pointer.
Definition: smart_ptr.h:1650