|
|
@@ -48,8 +48,26 @@ namespace test_meta { |
|
|
|
EXPECT_EQ(false, false_::value);
|
|
|
|
EXPECT_EQ(true, (std::is_same<bool, true_::value_type>::value));
|
|
|
|
EXPECT_EQ(true, true_::value);
|
|
|
|
|
|
|
|
EXPECT_EQ(true, (std::is_same<int8_t, int8_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42, int8_<42>::value);
|
|
|
|
EXPECT_EQ(true, (std::is_same<uint8_t, uint8_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42u, uint8_<42u>::value);
|
|
|
|
EXPECT_EQ(true, (std::is_same<int16_t, int16_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42, int16_<42>::value);
|
|
|
|
EXPECT_EQ(true, (std::is_same<uint16_t, uint16_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42u, uint16_<42u>::value);
|
|
|
|
EXPECT_EQ(true, (std::is_same<int32_t, int32_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42, int32_<42>::value);
|
|
|
|
EXPECT_EQ(true, (std::is_same<uint32_t, uint32_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42u, uint32_<42u>::value);
|
|
|
|
|
|
|
|
EXPECT_EQ(true, (std::is_same<char, char_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42, char_<42>::value);
|
|
|
|
EXPECT_EQ(true, (std::is_same<int, int_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42, int_<42>::value);
|
|
|
|
EXPECT_EQ(true, (std::is_same<long, long_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42, long_<42>::value);
|
|
|
|
|
|
|
|
EXPECT_EQ(true, (std::is_same<index_t, index_t_<0>::value_type>::value));
|
|
|
|
EXPECT_EQ(42U, index_t_<42U>::value);
|
|
|
@@ -88,11 +106,15 @@ namespace test_meta { |
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Tmeta_logical, BitOperations) {
|
|
|
|
EXPECT_EQ (0x00, (bitand_<int_<0x55>, int_<0xAA>>()));
|
|
|
|
EXPECT_EQ (0xFF, (bitor_<int_<0x55>, int_<0xAA>>()));
|
|
|
|
EXPECT_EQ (0xFA, (bitxor_<int_<0x55>, int_<0xAF>>()));
|
|
|
|
EXPECT_EQ (0x00, (bitnot_<int_<-1>>()));
|
|
|
|
//XXX: add shifts
|
|
|
|
EXPECT_EQ (0x00, (bitand_<uint8_<0x55>, uint8_<0xAA>>()));
|
|
|
|
EXPECT_EQ (0xFF, (bitor_ <uint8_<0x55>, uint8_<0xAA>>()));
|
|
|
|
EXPECT_EQ (0xFA, (bitxor_<uint8_<0x55>, uint8_<0xAF>>()));
|
|
|
|
EXPECT_EQ (0x00, (bitnot_<uint8_<-1>>()));
|
|
|
|
|
|
|
|
EXPECT_EQ (0x04, (shift_left<uint8_<0x01>, uint8_<2>>()));
|
|
|
|
EXPECT_EQ (0x00, (shift_left<uint8_<0x80>, uint8_<1>>()));
|
|
|
|
EXPECT_EQ (0x02, (shift_right<uint8_<0x08>, uint8_<2>>()));
|
|
|
|
EXPECT_EQ (0x00, (shift_right<uint8_<0x01>, uint8_<1>>()));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(Tmeta_logical, TypeOperations) {
|
|
|
@@ -103,10 +125,10 @@ namespace test_meta { |
|
|
|
EXPECT_EQ (true, (std::is_same<int_<42>, if_c<true, int_<42>, bool_<false>>>()));
|
|
|
|
EXPECT_EQ (true, (std::is_same<int_<42>, if_<bool_<true>, int_<42>, bool_<false>>>()));
|
|
|
|
|
|
|
|
EXPECT_EQ (true, (std::is_same<bool_<true>, or_<bool_<true>, bool_<false>>>()));
|
|
|
|
EXPECT_EQ (true, (std::is_same<bool_<false>, or_<bool_<false>, bool_<false>>>()));
|
|
|
|
EXPECT_EQ (true, (std::is_same<bool_<false>, and_<bool_<true>, bool_<false>>>()));
|
|
|
|
EXPECT_EQ (true, (std::is_same<bool_<true>, and_<bool_<true>, bool_<true>>>()));
|
|
|
|
EXPECT_EQ (true, (std::is_same<true_, or_<true_, false_>>()));
|
|
|
|
EXPECT_EQ (true, (std::is_same<false_, or_<false_, false_>>()));
|
|
|
|
EXPECT_EQ (true, (std::is_same<false_, and_<true_, false_>>()));
|
|
|
|
EXPECT_EQ (true, (std::is_same<true_, and_<true_, true_>>()));
|
|
|
|
|
|
|
|
EXPECT_EQ (true, (same_<Foo, Foo>()));
|
|
|
|
EXPECT_EQ (false, (same_<Foo, Bar>()));
|
|
|
|