Commit ee94add5 authored by Davis King's avatar Davis King

Added more tests for DLIB_MAKE_HAS_MEMBER_FUNCTION_TEST and also fixed unit

tests so they work on older versions of visual studio.
parent 282db240
......@@ -14,14 +14,20 @@ namespace
dlib::logger dlog("test.is_same_object");
DLIB_MAKE_HAS_MEMBER_FUNCTION_TEST(has_booya_template, void, template booya<int>, (std::string)const);
DLIB_MAKE_HAS_MEMBER_FUNCTION_TEST(has_booya2_template, void, template booya2<int>, (int)const);
DLIB_MAKE_HAS_MEMBER_FUNCTION_TEST(has_funct_int, void, funct, (int));
DLIB_MAKE_HAS_MEMBER_FUNCTION_TEST(has_funct_double, void, funct, (double));
DLIB_MAKE_HAS_MEMBER_FUNCTION_TEST(has_funct_f, float, funct_f, (int));
class htest
{
public:
template <typename EXP>
void booya(std::string) const {}
template <typename EXP>
void booya2(EXP) const {}
void funct(double) {}
};
......@@ -30,17 +36,28 @@ namespace
public:
void funct(int) {}
float funct_f(int) {}
};
void test_metaprog()
{
DLIB_TEST(has_booya2_template<htest>::value == true)
DLIB_TEST(has_booya2_template<htest2>::value == false)
#if _MSC_VER > 1600 // there is a bug in visual studio 2010 and older that prevents this test from working
DLIB_TEST(has_booya_template<htest>::value == true)
#endif
DLIB_TEST(has_booya_template<htest2>::value == false)
DLIB_TEST(has_funct_int<htest>::value == false)
DLIB_TEST(has_funct_int<htest2>::value == true)
DLIB_TEST(has_funct_double<htest>::value == true)
DLIB_TEST(has_funct_double<htest2>::value == false)
DLIB_TEST(has_funct_f<htest>::value == false)
DLIB_TEST(has_funct_f<htest2>::value == true)
}
class is_same_object_tester : public tester
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment