From 05e85b9e9005fa950e90d31762439fff4429c412 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 21 Apr 2022 11:57:55 +0200 Subject: [PATCH] Added mutex traits Added transparent comparator test to multimap --- include/etl/mutex.h | 8 ++++++++ test/test_etl_traits.cpp | 3 +++ test/test_multimap.cpp | 3 +++ 3 files changed, 14 insertions(+) diff --git a/include/etl/mutex.h b/include/etl/mutex.h index d775e649..e153a21c 100644 --- a/include/etl/mutex.h +++ b/include/etl/mutex.h @@ -53,4 +53,12 @@ SOFTWARE. #define ETL_HAS_MUTEX 0 #endif +namespace etl +{ + namespace traits + { + static ETL_CONSTANT bool has_mutex = (ETL_HAS_MUTEX == 1); + } +} + #endif diff --git a/test/test_etl_traits.cpp b/test/test_etl_traits.cpp index 9794b19c..fca12e92 100644 --- a/test/test_etl_traits.cpp +++ b/test/test_etl_traits.cpp @@ -33,6 +33,8 @@ SOFTWARE. #include "etl/platform.h" #include "etl/version.h" #include "etl/char_traits.h" +#include "etl/mutex.h" + namespace { SUITE(test_etl_traits) @@ -60,6 +62,7 @@ namespace CHECK_EQUAL((ETL_USING_8BIT_TYPES == 1), etl::traits::has_8bit_types); CHECK_EQUAL((ETL_USING_64BIT_TYPES == 1), etl::traits::has_64bit_types); CHECK_EQUAL((ETL_HAS_ATOMIC == 1), etl::traits::has_atomic); + CHECK_EQUAL((ETL_HAS_MUTEX == 1), etl::traits::has_mutex); CHECK_EQUAL((ETL_HAS_NULLPTR == 1), etl::traits::has_nullptr); CHECK_EQUAL((ETL_HAS_CHAR8_T == 1), etl::traits::has_char8_t); CHECK_EQUAL((ETL_HAS_NATIVE_CHAR8_T == 1), etl::traits::has_native_char8_t); diff --git a/test/test_multimap.cpp b/test/test_multimap.cpp index 641f4e02..3ec7d4d3 100644 --- a/test/test_multimap.cpp +++ b/test/test_multimap.cpp @@ -1462,6 +1462,9 @@ namespace std::string a("A"); Key b("B"); + + CHECK(compare(a, b)); + CHECK(!compare(b, a)); } //*************************************************************************