MCPcopy Create free account
hub / github.com/davisking/dlib / test_functions

Function test_functions

dlib/test/invoke.cpp:64–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 }
63
64 void test_functions()
65 {
66 static_assert(dlib::is_invocable<decltype(func_testargs), int, std::string, const std::string&, const std::string&, std::string&>::value, "should be invocable!");
67 static_assert(dlib::is_invocable<decltype(func_testargs), int, std::string, std::string, const std::string&, std::string&>::value, "should be invocable!");
68 static_assert(dlib::is_invocable<decltype(func_testargs), int, std::string, std::string, std::string, std::string&>::value, "should be invocable!");
69 static_assert(dlib::is_invocable<decltype(func_testargs), int, std::string, std::string, std::string, std::reference_wrapper<std::string>>::value, "should be invocable!");
70 static_assert(dlib::is_invocable<decltype(func_return_addition), int, int>::value, "should be invocable!");
71 static_assert(dlib::is_invocable_r<float, decltype(func_return_addition), int, int>::value, "should be invocable_r!");
72 static_assert(!dlib::is_invocable_r<std::string, decltype(func_return_addition), int, int>::value, "should be invocable_r!");
73
74 static_assert(std::is_same<dlib::callable_args<decltype(func_testargs)>,
75 dlib::types_<int, std::string, const std::string&, const std::string&, std::string&>
76 >::value, "make this correct");
77
78 static_assert(dlib::callable_nargs<decltype(func_testargs)>::value == 5, "bad");
79
80 static_assert(std::is_same<dlib::callable_arg<0, decltype(func_testargs)>,
81 int>::value, "make this correct");
82
83 static_assert(std::is_same<dlib::callable_arg<1, decltype(func_testargs)>,
84 std::string>::value, "make this correct");
85
86 static_assert(std::is_same<dlib::callable_arg<2, decltype(func_testargs)>,
87 const std::string&>::value, "make this correct");
88
89 static_assert(std::is_same<dlib::callable_arg<3, decltype(func_testargs)>,
90 const std::string&>::value, "make this correct");
91
92 static_assert(std::is_same<dlib::callable_arg<4, decltype(func_testargs)>,
93 std::string&>::value, "make this correct");
94
95 static_assert(std::is_same<dlib::callable_return<decltype(func_testargs)>,
96 void>::value, "make this correct");
97
98 static_assert(is_callable<decltype(func_testargs)>::value, "bad");
99
100 static_assert(std::is_same<dlib::callable_args<decltype(func_return_addition)>,
101 dlib::types_<int, int>
102 >::value, "make this correct");
103
104 static_assert(dlib::callable_nargs<decltype(func_return_addition)>::value == 2, "bad");
105
106 static_assert(std::is_same<dlib::callable_arg<0, decltype(func_return_addition)>,
107 int
108 >::value, "make this correct");
109
110 static_assert(std::is_same<dlib::callable_arg<1, decltype(func_return_addition)>,
111 int
112 >::value, "make this correct");
113
114 static_assert(std::is_same<dlib::callable_return<decltype(func_return_addition)>,
115 int>::value, "make this correct");
116
117 static_assert(is_callable<decltype(func_return_addition)>::value, "bad");
118
119 {
120 std::string str = run1_str4;
121 dlib::invoke(func_testargs, 1, run1_str1, run1_str2, std::cref(run1_str3), std::ref(str));

Callers 1

perform_testMethod · 0.85

Calls 5

invokeFunction · 0.85
crefFunction · 0.85
refFunction · 0.85
applyFunction · 0.85
make_tupleFunction · 0.85

Tested by

no test coverage detected