File indexing completed on 2024-04-06 12:03:58
0001 #include <limits>
0002 #include <string>
0003 #include <vector>
0004
0005 #include "Utilities/Testing/interface/CppUnit_testdriver.icpp"
0006 #include "cppunit/extensions/HelperMacros.h"
0007
0008 #include "DataFormats/Common/interface/traits.h"
0009
0010 class TestTraits : public CppUnit::TestFixture {
0011 CPPUNIT_TEST_SUITE(TestTraits);
0012 CPPUNIT_TEST(vector_is_happy);
0013 CPPUNIT_TEST(string_is_happy);
0014 CPPUNIT_TEST_SUITE_END();
0015
0016 public:
0017 TestTraits() {}
0018 ~TestTraits() {}
0019 void setUp() {}
0020 void tearDown() {}
0021
0022 void vector_is_happy();
0023 void string_is_happy();
0024
0025 private:
0026 };
0027
0028 CPPUNIT_TEST_SUITE_REGISTRATION(TestTraits);
0029
0030 void TestTraits::vector_is_happy() {
0031 typedef std::vector<double>::size_type key_type;
0032 CPPUNIT_ASSERT(edm::key_traits<key_type>::value == std::numeric_limits<key_type>::max());
0033 CPPUNIT_ASSERT(edm::key_traits<key_type>::value == static_cast<key_type>(-1));
0034 }
0035
0036 void TestTraits::string_is_happy() {
0037 std::string const& r = edm::key_traits<std::string>::value;
0038 CPPUNIT_ASSERT(r.size() == 1);
0039 CPPUNIT_ASSERT(r[0] == '\a');
0040 }