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

Function metaprogramming_test

dlib/test/metaprogramming.cpp:23–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23 void metaprogramming_test (
24 )
25 /*!
26 ensures
27 - runs tests on template metaprogramming objects and functions for compliance with the specs
28 !*/
29 {
30
31 print_spinner();
32
33 DLIB_TEST(is_signed_type<signed char>::value == true);
34 DLIB_TEST(is_signed_type<signed short>::value == true);
35 DLIB_TEST(is_signed_type<signed int>::value == true);
36 DLIB_TEST(is_signed_type<signed long>::value == true);
37 DLIB_TEST(is_unsigned_type<signed char>::value == false);
38 DLIB_TEST(is_unsigned_type<signed short>::value == false);
39 DLIB_TEST(is_unsigned_type<signed int>::value == false);
40 DLIB_TEST(is_unsigned_type<signed long>::value == false);
41
42 DLIB_TEST(is_unsigned_type<unsigned char>::value == true);
43 DLIB_TEST(is_unsigned_type<unsigned short>::value == true);
44 DLIB_TEST(is_unsigned_type<unsigned int>::value == true);
45 DLIB_TEST(is_unsigned_type<unsigned long>::value == true);
46 DLIB_TEST(is_signed_type<unsigned char>::value == false);
47 DLIB_TEST(is_signed_type<unsigned short>::value == false);
48 DLIB_TEST(is_signed_type<unsigned int>::value == false);
49 DLIB_TEST(is_signed_type<unsigned long>::value == false);
50
51
52 COMPILE_TIME_ASSERT(is_signed_type<signed char>::value == true);
53 COMPILE_TIME_ASSERT(is_signed_type<signed short>::value == true);
54 COMPILE_TIME_ASSERT(is_signed_type<signed int>::value == true);
55 COMPILE_TIME_ASSERT(is_signed_type<signed long>::value == true);
56 COMPILE_TIME_ASSERT(is_unsigned_type<signed char>::value == false);
57 COMPILE_TIME_ASSERT(is_unsigned_type<signed short>::value == false);
58 COMPILE_TIME_ASSERT(is_unsigned_type<signed int>::value == false);
59 COMPILE_TIME_ASSERT(is_unsigned_type<signed long>::value == false);
60
61 COMPILE_TIME_ASSERT(is_unsigned_type<unsigned char>::value == true);
62 COMPILE_TIME_ASSERT(is_unsigned_type<unsigned short>::value == true);
63 COMPILE_TIME_ASSERT(is_unsigned_type<unsigned int>::value == true);
64 COMPILE_TIME_ASSERT(is_unsigned_type<unsigned long>::value == true);
65 COMPILE_TIME_ASSERT(is_signed_type<unsigned char>::value == false);
66 COMPILE_TIME_ASSERT(is_signed_type<unsigned short>::value == false);
67 COMPILE_TIME_ASSERT(is_signed_type<unsigned int>::value == false);
68 COMPILE_TIME_ASSERT(is_signed_type<unsigned long>::value == false);
69
70
71 }
72
73
74 void test_call_if_valid()

Callers 1

perform_testMethod · 0.85

Calls 1

print_spinnerFunction · 0.85

Tested by

no test coverage detected