o3tl/qa/test-sorted_vector.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 72ce1de3e3c70fa94b0ed14541d751dd5654b6b0
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Sun May 13 20:50:57 2018 +0900

    o3tl: add some comments to sorted_vector test
    
    Change-Id: Iebedbb5afb45a92e52a8a390b9b7f6daae2337eb
    Reviewed-on: https://gerrit.libreoffice.org/54192
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/o3tl/qa/test-sorted_vector.cxx b/o3tl/qa/test-sorted_vector.cxx
index 713cb185fa48..2a1f87d93dc8 100644
--- a/o3tl/qa/test-sorted_vector.cxx
+++ b/o3tl/qa/test-sorted_vector.cxx
@@ -37,26 +37,34 @@ public:
     void testBasics()
     {
         o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent> > aVec;
+
+        // create 4 test elements
         std::unique_ptr<SwContent> p1( new SwContent(1) );
         std::unique_ptr<SwContent> p2( new SwContent(2) );
         SwContent *p3 = new SwContent(3);
         std::unique_ptr<SwContent> p4( new SwContent(4) );
 
+        // insert p3, p1 -> not presernt -> second is true
         CPPUNIT_ASSERT( aVec.insert(p3).second );
         CPPUNIT_ASSERT( aVec.insert(p1.get()).second );
+        // insert p3 again -> already present -> second is false
         CPPUNIT_ASSERT( !aVec.insert(p3).second );
 
+        // 2 element should be present
         CPPUNIT_ASSERT_EQUAL( static_cast<size_t>(2), aVec.size() );
 
+        // check the order -> should be p1, p3
+        // by index access
         CPPUNIT_ASSERT_EQUAL( p1.get(), aVec[0] );
         CPPUNIT_ASSERT_EQUAL( p3, aVec[1] );
-
+        // by begin, end
         CPPUNIT_ASSERT_EQUAL( p1.get(), *aVec.begin() );
         CPPUNIT_ASSERT_EQUAL( p3, *(aVec.end()-1) );
-
+        // by front, back
         CPPUNIT_ASSERT_EQUAL( p1.get(), aVec.front() );
         CPPUNIT_ASSERT_EQUAL( p3, aVec.back() );
 
+        // find elements
         CPPUNIT_ASSERT( aVec.find(p1.get()) != aVec.end() );
         CPPUNIT_ASSERT_EQUAL( static_cast<std::ptrdiff_t>(0), 
aVec.find(p1.get()) - aVec.begin() );
         CPPUNIT_ASSERT( aVec.find(p3) != aVec.end() );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to