Changeset 170:9e644011fe22 in rrlib_serialization


Ignore:
Timestamp:
10.09.2017 11:50:00 (22 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Move type trait tests (via static_assert) to unit test

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/serialization.cpp

    r167 r170  
    6666{ 
    6767 
    68 // We check this here so that not all programs using rrlib_serialization include <set> by default 
     68// Some type trait tests (checked here instead of header in order to shorten compile times) 
     69static_assert(IsSerializableContainer<int>::value == false, "Incorrect trait implementation"); 
     70static_assert(IsSerializableContainer<std::vector<int>>::value == true, "Incorrect trait implementation"); 
     71static_assert(IsSerializableContainer<std::vector<bool>>::value == true, "Incorrect trait implementation"); 
     72static_assert(IsSerializableContainer<std::map<int, std::string>>::value == true, "Incorrect trait implementation"); 
     73static_assert(IsSerializableMap<std::vector<int>>::value == false, "Incorrect trait implementation"); 
     74static_assert(IsSerializableMap<std::map<int, std::string>>::value == true, "Incorrect trait implementation"); 
     75static_assert(IsConstElementContainer<std::vector<std::string>>::value == false, "Incorrect trait implementation"); 
     76 
     77static_assert(IsStringSerializable<bool>::value, "Incorrect trait implementation"); 
     78static_assert(!IsStringSerializable<std::vector<bool>>::value, "Incorrect trait implementation"); 
     79static_assert(detail::IsStringInputSerializable<typename std::vector<bool>::reference>::value, "Incorrect trait implementation"); 
     80 
    6981static_assert(IsSerializableContainer<std::set<std::string>>::value == true, "Incorrect trait implementation"); 
    7082static_assert(IsConstElementContainer<std::set<std::string>>::value == true, "Incorrect trait implementation"); 
  • type_traits.h

    r169 r170  
    280280}; 
    281281 
    282  
    283 // Some type trait tests 
    284 static_assert(IsSerializableContainer<int>::value == false, "Incorrect trait implementation"); 
    285 static_assert(IsSerializableContainer<std::vector<int>>::value == true, "Incorrect trait implementation"); 
    286 static_assert(IsSerializableContainer<std::vector<bool>>::value == true, "Incorrect trait implementation"); 
    287 static_assert(IsSerializableContainer<std::map<int, std::string>>::value == true, "Incorrect trait implementation"); 
    288 static_assert(IsSerializableMap<std::vector<int>>::value == false, "Incorrect trait implementation"); 
    289 static_assert(IsSerializableMap<std::map<int, std::string>>::value == true, "Incorrect trait implementation"); 
    290 static_assert(IsConstElementContainer<std::vector<std::string>>::value == false, "Incorrect trait implementation"); 
    291  
    292 static_assert(IsStringSerializable<bool>::value, "Incorrect trait implementation"); 
    293 static_assert(!IsStringSerializable<std::vector<bool>>::value, "Incorrect trait implementation"); 
    294 static_assert(detail::IsStringInputSerializable<typename std::vector<bool>::reference>::value, "Incorrect trait implementation"); 
    295  
    296282//---------------------------------------------------------------------- 
    297283// End of namespace declaration 
Note: See TracChangeset for help on using the changeset viewer.