diff --git a/alib2std/test-src/extensions/VectorTest.cpp b/alib2std/test-src/extensions/VectorTest.cpp index 30857c5d5f8728bedb6025d754da8a3713e27bca..3a3986d15c9bfa3f361bc6582876c47e534d0a40 100644 --- a/alib2std/test-src/extensions/VectorTest.cpp +++ b/alib2std/test-src/extensions/VectorTest.cpp @@ -1,5 +1,6 @@ #include "VectorTest.h" #include <vector> +#include <type_traits> CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( VectorTest, "bits" ); CPPUNIT_TEST_SUITE_REGISTRATION( VectorTest ); @@ -49,3 +50,11 @@ void VectorTest::testVector() { std::compare<std::ptr_vector<VectorTest::test>> comp; CPPUNIT_ASSERT(comp(vector, vector4) < 0); } + +void VectorTest::testProperties() { + std::vector<int> data = {1, 2, 3, 4}; + + const std::vector<int>& constData = data; + + CPPUNIT_ASSERT((std::is_same<decltype(constData[0]), const int&>::value)); +} diff --git a/alib2std/test-src/extensions/VectorTest.h b/alib2std/test-src/extensions/VectorTest.h index b04ae03ea32f9f1b36d9621345a0b031a214563f..b1b31ec93fec64621df1ecddf5d6d4a9b38c146d 100644 --- a/alib2std/test-src/extensions/VectorTest.h +++ b/alib2std/test-src/extensions/VectorTest.h @@ -8,6 +8,7 @@ class VectorTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( VectorTest ); CPPUNIT_TEST( testVector ); + CPPUNIT_TEST( testProperties ); CPPUNIT_TEST_SUITE_END(); public: @@ -26,6 +27,7 @@ public: void tearDown(); void testVector(); + void testProperties(); };