summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorAndre Marin <aamarin@us.ibm.com>2018-05-02 14:54:16 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-05-10 22:09:52 -0400
commit89bbfaf84a74f09c2865a87e7f13a020b12f01a0 (patch)
tree7e6832eeb4cbe7bd9eb6a05ce9770a58ee15394c /src/usr
parente33bd00b1ee96d9b54f24c91ffa89c3cd256e224 (diff)
downloadtalos-hostboot-89bbfaf84a74f09c2865a87e7f13a020b12f01a0.tar.gz
talos-hostboot-89bbfaf84a74f09c2865a87e7f13a020b12f01a0.zip
Add additional comparison function objects into functional header
Change-Id: I6314ec8582e1d9cc284adf877e115433e95a168e Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/58217 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/testcore/lib/stl_functional.H62
1 files changed, 61 insertions, 1 deletions
diff --git a/src/usr/testcore/lib/stl_functional.H b/src/usr/testcore/lib/stl_functional.H
index 4b3fe6ea0..0129d0a8c 100644
--- a/src/usr/testcore/lib/stl_functional.H
+++ b/src/usr/testcore/lib/stl_functional.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2016 */
+/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -22,6 +22,9 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+
+
#ifndef __LIB_STL_FUNCTIONAL_H
#define __LIB_STL_FUNCTIONAL_H
@@ -169,6 +172,63 @@ class STLFunctionalTest : public CxxTest::TestSuite
}
+ void test_lessFun()
+ {
+ TS_ASSERT( std::less<uint32_t>()(1,2) );
+ TS_ASSERT( std::less<uint16_t>()(5,20) );
+ TS_ASSERT( !std::less<uint8_t>()(100,2) );
+ TS_ASSERT( !std::less<int>()(-40,-40) );
+ TS_ASSERT( !std::less<int32_t>()(-40,-30) );
+ }
+
+ void test_lessEqualFun()
+ {
+ TS_ASSERT( std::less_equal<int>()(-40,-40) );
+ TS_ASSERT( std::less_equal<uint8_t>()(4,4) );
+ TS_ASSERT( std::less_equal<uint8_t>()(4,200) );
+ TS_ASSERT( std::less_equal<uint32_t>()(5,20) );
+ TS_ASSERT( !std::less_equal<uint16_t>()(300,50) );
+ }
+
+ void test_greaterFun()
+ {
+ TS_ASSERT( !std::greater<int>()(-40,-40) );
+ TS_ASSERT( !std::greater<uint8_t>()(4,4) );
+ TS_ASSERT( !std::greater<uint8_t>()(4,200) );
+ TS_ASSERT( !std::greater<uint32_t>()(5,20) );
+ TS_ASSERT( std::greater<int64_t>()(-5,-20) );
+ TS_ASSERT( std::greater<uint16_t>()(300,50) );
+ }
+
+ void test_greaterEqualFun()
+ {
+ TS_ASSERT( std::greater_equal<int>()(-40,-40) );
+ TS_ASSERT( std::greater_equal<uint8_t>()(4,4) );
+ TS_ASSERT( !std::greater_equal<uint8_t>()(4,200) );
+ TS_ASSERT( !std::greater_equal<uint32_t>()(5,20) );
+ TS_ASSERT( std::greater_equal<int64_t>()(-5,-20) );
+ TS_ASSERT( std::greater_equal<uint16_t>()(300,50) );
+ }
+
+ void test_equalTolFun()
+ {
+ TS_ASSERT( std::equal_to<int>()(-40,-40) );
+ TS_ASSERT( std::equal_to<uint8_t>()(4,4) );
+ TS_ASSERT( !std::equal_to<uint8_t>()(4,200) );
+ TS_ASSERT( !std::equal_to<uint32_t>()(5,20) );
+ TS_ASSERT( !std::equal_to<int64_t>()(-5,-20) );
+ TS_ASSERT( !std::equal_to<uint16_t>()(300,50) );
+ }
+
+ void test_NotEqualTolFun()
+ {
+ TS_ASSERT( std::not_equal_to<int>()(-40,-40) );
+ TS_ASSERT( std::not_equal_to<uint8_t>()(4,4) );
+ TS_ASSERT( !std::not_equal_to<uint8_t>()(4,200) );
+ TS_ASSERT( !std::not_equal_to<uint32_t>()(5,20) );
+ TS_ASSERT( !std::not_equal_to<int64_t>()(-5,-20) );
+ TS_ASSERT( !std::not_equal_to<uint16_t>()(300,50) );
+ }
};
#endif
OpenPOWER on IntegriCloud