summaryrefslogtreecommitdiffstats
path: root/src/usr/testcore/lib/stltest.H
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2012-03-06 14:46:28 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-03-29 21:31:40 -0500
commitdf3648d7cd33ee146de3041d3f0d93a713075e26 (patch)
tree118a6a7502b65beab3619e20dab076eb9bde7b0d /src/usr/testcore/lib/stltest.H
parent05cf6b567b9dd13d7ac763cc4b2740cd7766508d (diff)
downloadtalos-hostboot-df3648d7cd33ee146de3041d3f0d93a713075e26.tar.gz
talos-hostboot-df3648d7cd33ee146de3041d3f0d93a713075e26.zip
Improve std::map by using a SplayTree container.
Originally std::map was implemented as a linked list. Some of the maps in PORE and PRD code will be big enough that this is very inefficient. Converted std::map to a binary search tree implementation based on the Splay-Tree algorithm. RTC: 34071 Change-Id: If77c017f5d95920f8010991e7f087cbe571ca2e9 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/790 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com> Reviewed-by: Bradley W. Bishop <bradleyb@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/testcore/lib/stltest.H')
-rw-r--r--src/usr/testcore/lib/stltest.H37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/usr/testcore/lib/stltest.H b/src/usr/testcore/lib/stltest.H
index ddd2bb46e..b9a16d927 100644
--- a/src/usr/testcore/lib/stltest.H
+++ b/src/usr/testcore/lib/stltest.H
@@ -97,7 +97,16 @@ class STLTest : public CxxTest::TestSuite
}
mymap2 = mymap; // map::operator=
+ if (mymap2.size() != mymap.size())
+ {
+ TS_FAIL("map::operator= test failed");
+ }
+
mymap3.insert(mymap2.begin(),mymap2.end());
+ if (mymap3.size() != mymap2.size())
+ {
+ TS_FAIL("map::insert(itr,itr) test failed");
+ }
mymap.erase(mymap.begin(),mymap.end()); //map::erase(itr,itr)
@@ -168,6 +177,34 @@ class STLTest : public CxxTest::TestSuite
}
--i;
}
+
+ // Test copy constructor.
+ std::map<V,V> mymap4(mymap);
+
+ if (mymap.size() != mymap4.size())
+ {
+ TS_FAIL("stl::map fail Copy constructor size test.");
+ }
+
+ // Test range constructor.
+ std::map<V,V> mymap5(mymap.begin(), mymap.end());
+
+ if (mymap.size() != mymap5.size())
+ {
+ TS_FAIL("stl::map fail Range constructor size test.");
+ }
+
+ // Test erase by key.
+ mymap5.erase(v2);
+ if (mymap5.end() != mymap5.find(v2))
+ {
+ TS_FAIL("std::map fail Erase by iterator test.");
+ }
+ if (mymap.size() != (mymap5.size() + 1))
+ {
+ TS_FAIL("std::map fail Erase by iterator size test.");
+ }
+
}
OpenPOWER on IntegriCloud