From 028686b2440d194774ba446d1be712f4cf71995b Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 12 May 2018 08:59:45 +0100 Subject: [PATCH 1/7] Fixed GCC warning for tests --- test/test_c_timer_framework.cpp | 2 +- test/test_callback_timer.cpp | 20 ++++++++++---------- test/test_message_timer.cpp | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/test_c_timer_framework.cpp b/test/test_c_timer_framework.cpp index ec03f140..00e98536 100644 --- a/test/test_c_timer_framework.cpp +++ b/test/test_c_timer_framework.cpp @@ -187,7 +187,7 @@ namespace // Timer should have timed out. - CHECK_EQUAL(50, *callback_list1.data()); + CHECK_EQUAL(50U, *callback_list1.data()); CHECK(ecl_timer_unregister(id1)); CHECK(!ecl_timer_unregister(id1)); diff --git a/test/test_callback_timer.cpp b/test/test_callback_timer.cpp index 5cf31bb4..d5197d3a 100644 --- a/test/test_callback_timer.cpp +++ b/test/test_callback_timer.cpp @@ -80,7 +80,7 @@ namespace etl::callback_timer<3>* p_controller; }; - + Test test; etl::function_imv member_callback; etl::function_imv member_callback2; @@ -147,7 +147,7 @@ namespace timer_controller.enable(true); ticks = 0; - + const uint32_t step = 1; while (ticks <= 100U) @@ -207,7 +207,7 @@ namespace // Timer should have timed out. - CHECK_EQUAL(50, *test.tick_list.data()); + CHECK_EQUAL(50U, *test.tick_list.data()); CHECK(timer_controller.unregister_timer(id1)); CHECK(!timer_controller.unregister_timer(id1)); @@ -346,7 +346,7 @@ namespace std::vector compare1 = { 77 }; std::vector compare2 = { 23 }; std::vector compare3 = { 11, 22, 33, 44, 55, 66, 77, 88, 99 }; - + CHECK(test.tick_list.size() != 0); CHECK(free_tick_list1.size() != 0); CHECK(free_tick_list2.size() != 0); @@ -442,7 +442,7 @@ namespace test.tick_list.clear(); free_tick_list1.clear(); free_tick_list2.clear(); - + timer_controller.start(id3); timer_controller.start(id2); @@ -455,7 +455,7 @@ namespace while (ticks <= 100U) { if (ticks == 40) - { + { timer_controller.unregister_timer(id2); id1 = timer_controller.register_timer(member_callback, 37, etl::timer::mode::REPEATING); @@ -666,11 +666,11 @@ namespace RAISE_THREAD_PRIORITY; FIX_PROCESSOR_AFFINITY; - + while (ticks <= 1000) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); - + if (controller.tick(tick)) { tick = TICK; @@ -699,11 +699,11 @@ namespace controller.start(id1); controller.start(id2); //controller.start(id3); - + controller.enable(true); std::thread t1(timer_event); - + bool restart_1 = true; while (ticks <= 1000U) diff --git a/test/test_message_timer.cpp b/test/test_message_timer.cpp index e7659d80..392cd31a 100644 --- a/test/test_message_timer.cpp +++ b/test/test_message_timer.cpp @@ -229,7 +229,7 @@ namespace // Timer should have timed out. - CHECK_EQUAL(50, *router1.message1.data()); + CHECK_EQUAL(50U, *router1.message1.data()); CHECK(timer_controller.unregister_timer(id1)); CHECK(!timer_controller.unregister_timer(id1)); From 6a444bf9722d029f14b5561de67e35ee1f499280 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 12 May 2018 09:01:18 +0100 Subject: [PATCH 2/7] Added flags to call on_enter_state and on_exit_state for start() and reset() respectively. The default actions are as the previous version. --- include/etl/fsm.h | 98 ++++++++++++++++++++----------------- include/etl/fsm_generator.h | 16 ++++-- 2 files changed, 67 insertions(+), 47 deletions(-) diff --git a/include/etl/fsm.h b/include/etl/fsm.h index eeb343b9..d350467d 100644 --- a/include/etl/fsm.h +++ b/include/etl/fsm.h @@ -31,7 +31,7 @@ SOFTWARE. #endif //*************************************************************************** -// This file has been auto generated. Do not edit this file. +// THIS FILE HAS BEEN AUTO GENERATED. DO NOT EDIT THIS FILE. //*************************************************************************** //*************************************************************************** @@ -238,8 +238,9 @@ namespace etl /// Starts the FSM. /// Can only be called once. /// Subsequent calls will do nothing. + ///\param call_on_enter_state If true will call on_enter_state() for the first state. Default = true. //******************************************* - void start() + void start(bool call_on_enter_state = true) { // Can only be started once. if (p_state == nullptr) @@ -247,7 +248,10 @@ namespace etl p_state = state_list[0]; ETL_ASSERT(p_state != nullptr, ETL_ERROR(etl::fsm_null_state_exception)); - p_state->on_enter_state(); + if (call_on_enter_state) + { + p_state->on_enter_state(); + } } } @@ -335,9 +339,15 @@ namespace etl //******************************************* /// Reset the FSM to pre-started state. + ///\param call_on_exit_state If true will call on_exit_state() for the current state. Default = false. //******************************************* - void reset() + void reset(bool call_on_exit_state = false) { + if ((p_state != nullptr) && call_on_exit_state) + { + p_state->on_exit_state(); + } + p_state = nullptr; } @@ -351,10 +361,10 @@ namespace etl //*************************************************************************** // The definition for all 16 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -412,10 +422,10 @@ namespace etl //*************************************************************************** // Specialisation for 15 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -472,10 +482,10 @@ namespace etl //*************************************************************************** // Specialisation for 14 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -531,10 +541,10 @@ namespace etl //*************************************************************************** // Specialisation for 13 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -589,9 +599,9 @@ namespace etl //*************************************************************************** // Specialisation for 12 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -645,9 +655,9 @@ namespace etl //*************************************************************************** // Specialisation for 11 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -700,9 +710,9 @@ namespace etl //*************************************************************************** // Specialisation for 10 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -754,9 +764,9 @@ namespace etl //*************************************************************************** // Specialisation for 9 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -807,8 +817,8 @@ namespace etl //*************************************************************************** // Specialisation for 8 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -858,8 +868,8 @@ namespace etl //*************************************************************************** // Specialisation for 7 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -908,8 +918,8 @@ namespace etl //*************************************************************************** // Specialisation for 6 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -957,8 +967,8 @@ namespace etl //*************************************************************************** // Specialisation for 5 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -1005,7 +1015,7 @@ namespace etl //*************************************************************************** // Specialisation for 4 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -1051,7 +1061,7 @@ namespace etl //*************************************************************************** // Specialisation for 3 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -1096,7 +1106,7 @@ namespace etl //*************************************************************************** // Specialisation for 2 message types. //*************************************************************************** - template class fsm_state : public ifsm_state { @@ -1140,7 +1150,7 @@ namespace etl //*************************************************************************** // Specialisation for 1 message type. //*************************************************************************** - template class fsm_state : public ifsm_state { diff --git a/include/etl/fsm_generator.h b/include/etl/fsm_generator.h index 91997b63..37007900 100644 --- a/include/etl/fsm_generator.h +++ b/include/etl/fsm_generator.h @@ -250,8 +250,9 @@ namespace etl /// Starts the FSM. /// Can only be called once. /// Subsequent calls will do nothing. + ///\param call_on_enter_state If true will call on_enter_state() for the first state. Default = true. //******************************************* - void start() + void start(bool call_on_enter_state = true) { // Can only be started once. if (p_state == nullptr) @@ -259,7 +260,10 @@ namespace etl p_state = state_list[0]; ETL_ASSERT(p_state != nullptr, ETL_ERROR(etl::fsm_null_state_exception)); - p_state->on_enter_state(); + if (call_on_enter_state) + { + p_state->on_enter_state(); + } } } @@ -347,9 +351,15 @@ namespace etl //******************************************* /// Reset the FSM to pre-started state. + ///\param call_on_exit_state If true will call on_exit_state() for the current state. Default = false. //******************************************* - void reset() + void reset(bool call_on_exit_state = false) { + if ((p_state != nullptr) && call_on_exit_state) + { + p_state->on_exit_state(); + } + p_state = nullptr; } From 83d495bc21134ffc09c5ca263b9dd597c97863b1 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 20 May 2018 09:16:20 +0100 Subject: [PATCH 3/7] Added binary_merge, binary_interleave, is_odd, is_even --- include/etl/binary.h | 70 +++++++++++++++++++++++ src/binary.cpp | 128 +++++++++++++++++++++++++++++++++++++++++++ test/test_binary.cpp | 38 +++++++++++++ 3 files changed, 236 insertions(+) diff --git a/include/etl/binary.h b/include/etl/binary.h index c54bc1fc..c9fa2653 100644 --- a/include/etl/binary.h +++ b/include/etl/binary.h @@ -569,6 +569,76 @@ namespace etl }; #endif + //*************************************************************************** + /// Merges two values according to a mask. + /// Ones in the mask select bits from 'first', zeros select bits from second. + /// Mask is a function parameter. + //*************************************************************************** + template + T binary_merge(const T first, const T second, const T mask) + { + return second ^ ((second ^ first) & mask); + } + + //*************************************************************************** + /// Merges two values according to a mask. + /// Ones in the mask select bits from 'first', zeros select bits from second. + /// Mask is a template parameter. + //*************************************************************************** + template + T binary_merge(const T first, const T second) + { + return second ^ ((second ^ first) & MASK); + } + + //*************************************************************************** + /// Binary interleave + //*************************************************************************** +#if ETL_8BIT_SUPPORT + uint16_t binary_interleave(uint8_t first, uint8_t second); + inline int16_t binary_interleave(int8_t first, int8_t second) { return int16_t(binary_interleave(uint8_t(first), uint8_t(second))); } +#endif + uint32_t binary_interleave(uint16_t first, uint16_t second); + inline int32_t binary_interleave(int16_t first, int16_t second) { return int32_t(binary_interleave(uint16_t(first), uint16_t(second))); } + uint64_t binary_interleave(uint32_t first, uint32_t second); + inline int64_t binary_interleave(int32_t first, int32_t second) { return int64_t(binary_interleave(uint16_t(first), uint16_t(second))); } + + //*************************************************************************** + /// Checks if odd. + //*************************************************************************** + bool is_odd(const unsigned char value); + inline bool is_odd(const char value) { return is_odd((unsigned char)value); } + + bool is_odd(const unsigned short value); + inline bool is_odd(const short value) { return is_odd((unsigned short)value); } + + bool is_odd(const unsigned int value); + inline bool is_odd(const int value) { return is_odd((unsigned int)value); } + + bool is_odd(const unsigned long value); + inline bool is_odd(const long value) { return is_odd((unsigned long)value); } + + bool is_odd(const unsigned long long value); + inline bool is_odd(const long long value) { return is_odd((unsigned long long)value); } + + //*************************************************************************** + /// Checks if even. + //*************************************************************************** + bool is_even(const unsigned char value); + inline bool is_even(const char value) { return is_even((unsigned char)value); } + + bool is_even(const unsigned short value); + inline bool is_even(const short value) { return is_even((unsigned short)value); } + + bool is_even(const unsigned int value); + inline bool is_even(const int value) { return is_even((unsigned int)value); } + + bool is_even(const unsigned long value); + inline bool is_even(const long value) { return is_even((unsigned long)value); } + + bool is_even(const unsigned long long value); + inline bool is_even(const long long value) { return is_even((unsigned long long)value); } + //*************************************************************************** /// 8 bit binary constants. //*************************************************************************** diff --git a/src/binary.cpp b/src/binary.cpp index 52035a5c..7f676070 100644 --- a/src/binary.cpp +++ b/src/binary.cpp @@ -467,4 +467,132 @@ namespace etl return count; } + +#if ETL_8BIT_SUPPORT + //***************************************************************************** + /// Binary interleave + //***************************************************************************** + uint16_t binary_interleave(uint8_t first, uint8_t second) + { + static const uint16_t mask[] = { 0x5555, 0x3333, 0x0F0F }; + + uint16_t f = first; + uint16_t s = second; + + f = (f | (f << 4)) & mask[2]; + f = (f | (f << 2)) & mask[1]; + f = (f | (f << 1)) & mask[0]; + + s = (s | (s << 4)) & mask[2]; + s = (s | (s << 2)) & mask[1]; + s = (s | (s << 1)) & mask[0]; + + return (f | (s << 1)); + } +#endif + + //***************************************************************************** + /// Binary interleave + //***************************************************************************** + uint32_t binary_interleave(uint16_t first, uint16_t second) + { + static const uint32_t mask[] = { 0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF }; + + uint32_t f = first; + uint32_t s = second; + + f = (f | (f << 8)) & mask[3]; + f = (f | (f << 4)) & mask[2]; + f = (f | (f << 2)) & mask[1]; + f = (f | (f << 1)) & mask[0]; + + s = (s | (s << 8)) & mask[3]; + s = (s | (s << 4)) & mask[2]; + s = (s | (s << 2)) & mask[1]; + s = (s | (s << 1)) & mask[0]; + + return (f | (s << 1)); + } + + //***************************************************************************** + /// Binary interleave + //***************************************************************************** + uint64_t binary_interleave(uint32_t first, uint32_t second) + { + static const uint64_t mask[] = { 0x5555555555555555, 0x3333333333333333, 0x0F0F0F0F0F0F0F0F, 0x00FF00FF00FF00FF, 0x0000FFFF0000FFFF }; + + uint64_t f = first; + uint64_t s = second; + + f = (f | (f << 16)) & mask[4]; + f = (f | (f << 8)) & mask[3]; + f = (f | (f << 4)) & mask[2]; + f = (f | (f << 2)) & mask[1]; + f = (f | (f << 1)) & mask[0]; + + s = (s | (s << 16)) & mask[4]; + s = (s | (s << 8)) & mask[3]; + s = (s | (s << 4)) & mask[2]; + s = (s | (s << 2)) & mask[1]; + s = (s | (s << 1)) & mask[0]; + + return (f | (s << 1)); + } + + //*************************************************************************** + /// Checks if odd. + //*************************************************************************** + bool is_odd(const unsigned char value) + { + return ((value & 1U) != 0U); + } + + bool is_odd(const unsigned short value) + { + return ((value & 1U) != 0U); + } + + bool is_odd(const unsigned int value) + { + return ((value & 1U) != 0U); + } + + bool is_odd(const unsigned long value) + { + return ((value & 1U) != 0U); + } + + bool is_odd(const unsigned long long value) + { + return ((value & 1U) != 0U); + } + + //*************************************************************************** + /// Checks if even. + //*************************************************************************** + bool is_even(const unsigned char value) + { + return ((value & 1U) == 0U); + } + + bool is_even(const unsigned short value) + { + return ((value & 1U) == 0U); + } + + bool is_even(const unsigned int value) + { + return ((value & 1U) == 0U); + } + + bool is_even(const unsigned long value) + { + return ((value & 1U) == 0U); + } + + bool is_even(const unsigned long long value) + { + return ((value & 1U) == 0U); + } } + diff --git a/test/test_binary.cpp b/test/test_binary.cpp index fc5ecbc4..35cd1c53 100644 --- a/test/test_binary.cpp +++ b/test/test_binary.cpp @@ -1480,6 +1480,44 @@ namespace CHECK(!(etl::has_byte_n<>::test(int64_t(0x0123456789ABCDEF), 0x12))); CHECK((etl::has_byte_n<>::test(int64_t(0x0123456789ABCDEF), 0xAB))); } + + //************************************************************************* + TEST(test_binary_merge) + { + CHECK_EQUAL((etl::binary_merge(uint8_t(0x12), uint8_t(0x34), uint8_t(0xF0))), uint8_t(0x14)); + CHECK_EQUAL((etl::binary_merge(uint8_t(0x12), uint8_t(0x34))), uint8_t(0x14)); + + CHECK_EQUAL((etl::binary_merge(uint16_t(0x1234), uint16_t(0x3456), uint16_t(0xF0F0))), uint16_t(0x1436)); + CHECK_EQUAL((etl::binary_merge(uint16_t(0x1234), uint16_t(0x3456))), uint16_t(0x1436)); + + CHECK_EQUAL((etl::binary_merge(uint32_t(0x12345678), uint32_t(0x3456789A), uint32_t(0xF0F0F0F0))), uint32_t(0x1436587A)); + CHECK_EQUAL((etl::binary_merge(uint32_t(0x12345678), uint32_t(0x3456789A))), uint32_t(0x1436587A)); + + CHECK_EQUAL((etl::binary_merge(uint64_t(0x123456789ABCDEF0), uint64_t(0x3456789ABCDEF012), uint64_t(0xF0F0F0F0F0F0F0F0))), uint64_t(0x1436587A9CBED0F2)); + CHECK_EQUAL((etl::binary_merge(uint64_t(0x123456789ABCDEF0), uint64_t(0x3456789ABCDEF012))), uint64_t(0x1436587A9CBED0F2)); + } + + //************************************************************************* + TEST(test_binary_interleave) + { + CHECK_EQUAL((etl::binary_interleave(uint8_t(0x5A), uint8_t(0xA5))), uint16_t(0x9966)); + CHECK_EQUAL((etl::binary_interleave(uint16_t(0x5A5A), uint16_t(0xA5A5))), uint32_t(0x99669966)); + CHECK_EQUAL((etl::binary_interleave(uint32_t(0x5A5A5A5A), uint32_t(0xA5A5A5A5))), uint64_t(0x9966996699669966)); + } + + //************************************************************************* + TEST(test_is_odd) + { + CHECK(etl::is_odd(1)); + CHECK(!etl::is_odd(2)); + } + + //************************************************************************* + TEST(test_is_even) + { + CHECK(!etl::is_even(1)); + CHECK(etl::is_even(2)); + } }; } From 7fbc543080ea99b3f0d8f52bebd4254f1991ef5a Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 31 May 2018 22:21:09 +0100 Subject: [PATCH 4/7] Merge remote-tracking branch 'origin/feature/CMake' into development # Conflicts: # test/vs2017/etl.vcxproj.filters --- .gitmodules | 3 - CMakeLists.txt | 14 +- include/etl/debug_count.h | 1 + test/CMakeLists.txt | 157 ++++++++++ test/ExtraCheckMacros.h | 16 +- test/cmake/unit-test_external_project.cmake | 38 +++ test/codeblocks/ETL.cbp | 149 ++++----- test/vs2017/etl.vcxproj | 112 +++---- test/vs2017/etl.vcxproj.filters | 318 ++++++++++---------- unittest-cpp | 1 - 10 files changed, 507 insertions(+), 302 deletions(-) create mode 100644 test/CMakeLists.txt create mode 100644 test/cmake/unit-test_external_project.cmake delete mode 160000 unittest-cpp diff --git a/.gitmodules b/.gitmodules index a144f126..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "unittest-cpp"] - path = unittest-cpp - url = https://github.com/unittest-cpp/unittest-cpp.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 3456c7be..61c57638 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,14 @@ project(etl) set(ETL_PROFILE "DEFAULT" CACHE STRING "Defines what profile header to include. See https://www.etlcpp.com/setup.html" ) +option(BUILD_TESTS "Build unit tests" ON) + + +# Note: this will not compile src/c/ecl_timer.c as that c file has a dependence +# on ecl_user.h which is provided by clients of this library add_library(etl src/binary.cpp + src/crc16.cpp src/crc16_ccitt.cpp src/crc16_kermit.cpp src/crc32.cpp @@ -28,7 +34,7 @@ add_library(etl ) target_include_directories(etl PUBLIC - include/etl/ + include/etl include/etl/atomic include/etl/profiles PRIVATE @@ -63,3 +69,9 @@ target_compile_definitions(etl ${ETL_PROFILE} ) + + +if (BUILD_TESTS) + enable_testing() + add_subdirectory(test) +endif() diff --git a/include/etl/debug_count.h b/include/etl/debug_count.h index e3672d32..b603b00c 100644 --- a/include/etl/debug_count.h +++ b/include/etl/debug_count.h @@ -122,6 +122,7 @@ namespace etl int32_t count; }; + } #else diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..9fb4fb86 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,157 @@ +cmake_minimum_required(VERSION 3.5.0) +project(etl_unit_tests) + +# Bring in the UnitTest++ include directories and libraries +find_package(UnitTest++) + +if(NOT UnitTest++_FOUND) + # Add unittest-cpp as an ExternalProject + include(cmake/unit-test_external_project.cmake) + add_unittest_cpp() +else() + include(${UnitTest++_CONFIG}) + # The CMake install of UnitTest++ puts the include directory to ${CMAKE_INSTALL_PREFIX}/include + # under the assumptions that clients will consume the headers via + # #include + # However the tests in etl include the headers directly, e.g. + # #include "UnitTest++.h" + # Therefore we update the provide UTPP_INCLUDE_DIRS here + set(UTPP_INCLUDE_DIRS "${UTPP_INCLUDE_DIRS}/UnitTest++") +endif() +include_directories(${UTPP_INCLUDE_DIRS}) + +set(TEST_SOURCE_FILES + main.cpp + murmurhash3.cpp + test_algorithm.cpp + test_alignment.cpp + test_array.cpp + test_array_view.cpp + test_array_wrapper.cpp + test_binary.cpp + test_bitset.cpp + test_bloom_filter.cpp + test_bsd_checksum.cpp + test_callback_timer.cpp + test_checksum.cpp + test_compare.cpp + test_constant.cpp + test_container.cpp + test_crc.cpp + test_c_timer_framework.cpp + test_cyclic_value.cpp + test_debounce.cpp + test_deque.cpp + test_endian.cpp + test_enum_type.cpp + test_error_handler.cpp + test_exception.cpp + test_factory.cpp + test_fixed_iterator.cpp + test_flat_map.cpp + test_flat_multimap.cpp + test_flat_multiset.cpp + test_flat_set.cpp + test_fnv_1.cpp + test_forward_list.cpp + test_fsm.cpp + test_functional.cpp + test_function.cpp + test_hash.cpp + test_instance_count.cpp + test_integral_limits.cpp + test_intrusive_forward_list.cpp + test_intrusive_links.cpp + test_intrusive_list.cpp + test_intrusive_queue.cpp + test_intrusive_stack.cpp + test_io_port.cpp + test_iterator.cpp + test_jenkins.cpp + test_largest.cpp + test_list.cpp + test_map.cpp + test_maths.cpp + test_memory.cpp + test_message_bus.cpp + test_message_router.cpp + test_message_timer.cpp + test_multimap.cpp + test_multiset.cpp + test_murmur3.cpp + test_numeric.cpp + test_observer.cpp + test_optional.cpp + test_packet.cpp + test_parameter_type.cpp + test_pearson.cpp + test_pool.cpp + test_priority_queue.cpp + test_queue.cpp + test_random.cpp + test_reference_flat_map.cpp + test_reference_flat_multimap.cpp + test_reference_flat_multiset.cpp + test_reference_flat_set.cpp + test_set.cpp + test_smallest.cpp + test_stack.cpp + test_string_char.cpp + test_string_u16.cpp + test_string_u32.cpp + test_string_wchar_t.cpp + test_task_scheduler.cpp + test_type_def.cpp + test_type_lookup.cpp + test_type_traits.cpp + test_unordered_map.cpp + test_unordered_multimap.cpp + test_unordered_multiset.cpp + test_unordered_set.cpp + test_user_type.cpp + test_utility.cpp + test_variant.cpp + test_variant_pool.cpp + test_vector.cpp + test_vector_non_trivial.cpp + test_vector_pointer.cpp + test_visitor.cpp + test_xor_checksum.cpp + test_xor_rotate_checksum.cpp + + # Compile the source level ecl_timer here as test has provided a ecl_user.h file + ${CMAKE_SOURCE_DIR}/src/c/ecl_timer.c + ) + +if (WIN32) + # test_error_handler.cpp uses windows APIs that assume the microsoft project + # is setup for unicode support. Note: This may have adverse effects on client + # projects and the tests should be updated to be independent of project setup + ADD_DEFINITIONS(-DUNICODE) + ADD_DEFINITIONS(-D_UNICODE) +endif() + +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + list(APPEND TEST_SOURCE_FILES "test_atomic_gcc.cpp") +endif() +add_executable(etl_tests + ${TEST_SOURCE_FILES} + ) +target_link_libraries(etl_tests etl UnitTest++) +target_include_directories(etl_tests + PUBLIC + ${CMAKE_CURRENT_LIST_DIR} + ) + +# Enable the 'make test' CMake target using the executable defined above +add_test(etl_unit_tests etl_tests) + +# Since ctest will only show you the results of the single executable +# define a target that will output all of the failing or passing tests +# as they appear from UnitTest++ +add_custom_target(test_verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose) + + +# Remaining Tests to be implemented: +#1. Enable embedded compile target testing +# - test_embedded_compile.cpp diff --git a/test/ExtraCheckMacros.h b/test/ExtraCheckMacros.h index b8051f6a..17fcd51a 100644 --- a/test/ExtraCheckMacros.h +++ b/test/ExtraCheckMacros.h @@ -1,14 +1,14 @@ #ifndef UNITTEST_EXTRA_CHECKMACROS_H #define UNITTEST_EXTRA_CHECKMACROS_H -#include "../unittest-cpp/UnitTest++/HelperMacros.h" -#include "../unittest-cpp/UnitTest++/ExceptionMacros.h" -#include "../unittest-cpp/UnitTest++/Checks.h" -#include "../unittest-cpp/UnitTest++/AssertException.h" -#include "../unittest-cpp/UnitTest++/MemoryOutStream.h" -#include "../unittest-cpp/UnitTest++/TestDetails.h" -#include "../unittest-cpp/UnitTest++/CurrentTest.h" -#include "../unittest-cpp/UnitTest++/ReportAssertImpl.h" +#include "HelperMacros.h" +#include "ExceptionMacros.h" +#include "Checks.h" +#include "AssertException.h" +#include "MemoryOutStream.h" +#include "TestDetails.h" +#include "CurrentTest.h" +#include "ReportAssertImpl.h" #ifndef CHECK_NO_THROW #define CHECK_NO_THROW(expression) \ diff --git a/test/cmake/unit-test_external_project.cmake b/test/cmake/unit-test_external_project.cmake new file mode 100644 index 00000000..119c64ee --- /dev/null +++ b/test/cmake/unit-test_external_project.cmake @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.5.0) +find_package(Git REQUIRED) +include(ExternalProject) + + +##### +# \breif Function used to add UnitTest++ as an External Project, install it into the +# binary location of the CMake build, add its header directories in the +# include_directories, and finally add the built static library as an imported +# CMake target +##### +function (add_unittest_cpp) + + set(UTPP_INSATLL_DIR "${CMAKE_CURRENT_BINARY_DIR}/unittest++/install") + if (WIN32) + set(UTPP_LIB_NAME "UnitTest++.lib") + else() + set(UTPP_LIB_NAME "libUnitTest++.a") + endif() + + + ExternalProject_Add(unittest-cpp + GIT_REPOSITORY https://github.com/unittest-cpp/unittest-cpp.git + GIT_TAG v2.0.0 + GIT_SHALLOW TRUE # Don't require downloading the entire history + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/unittest++/src" + INSTALL_DIR "${UTPP_INSATLL_DIR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= + TEST_EXCLUDE_FROM_MAIN TRUE # Don't run UnitTest++'s tests by default + ) + + set(UTPP_INCLUDE_DIRS "${UTPP_INSATLL_DIR}/include/UnitTest++" PARENT_SCOPE) + add_library(UnitTest++ STATIC IMPORTED) + set_target_properties(UnitTest++ PROPERTIES IMPORTED_LOCATION "${UTPP_INSATLL_DIR}/lib/${UTPP_LIB_NAME}" ) + # Require the ExternalProject target to complete before importing the library + add_dependencies(UnitTest++ unittest-cpp) + +endfunction(add_unittest_cpp) diff --git a/test/codeblocks/ETL.cbp b/test/codeblocks/ETL.cbp index b4758871..20b6dfb2 100644 --- a/test/codeblocks/ETL.cbp +++ b/test/codeblocks/ETL.cbp @@ -61,19 +61,90 @@ - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -248,76 +319,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index eee0ad5c..4c47ec11 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -161,7 +161,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test + ../../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test false @@ -203,7 +203,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test + ../../../unittest-cpp\UnitTest++;../../include/etl;../../include/etl/c;../../test false @@ -245,7 +245,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test + ../../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test @@ -323,6 +323,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -379,35 +411,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -428,7 +431,6 @@ - @@ -488,8 +490,6 @@ - - @@ -505,12 +505,31 @@ - - + + + + + + + + + + + + + + + + + + + + + @@ -524,24 +543,6 @@ - - - - - - - - - - - - - - - - - - @@ -725,7 +726,6 @@ - diff --git a/test/vs2017/etl.vcxproj.filters b/test/vs2017/etl.vcxproj.filters index 7ba6c7d5..d8a39e36 100644 --- a/test/vs2017/etl.vcxproj.filters +++ b/test/vs2017/etl.vcxproj.filters @@ -75,9 +75,6 @@ - - Header Files - ETL\Utilities @@ -156,9 +153,6 @@ ETL\Containers - - Header Files - ETL\Containers @@ -216,9 +210,6 @@ ETL\Maths - - Header Files - ETL\Containers @@ -297,12 +288,6 @@ ETL\Containers - - Header Files - - - Header Files - ETL\Utilities @@ -366,93 +351,6 @@ ETL\Containers - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - ETL\Frameworks @@ -633,6 +531,102 @@ ETL\Maths + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + @@ -908,60 +902,6 @@ Source Files - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - - - UnitTest++ - Source Files @@ -1037,11 +977,71 @@ ETL\Maths + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++ + + + UnitTest++\Win32 + - - Header Files - Resource Files diff --git a/unittest-cpp b/unittest-cpp deleted file mode 160000 index bc5d87f4..00000000 --- a/unittest-cpp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bc5d87f484cac2959b0a0eafbde228e69e828d74 From 7b7a1c4af290b41b66fb142e5410031bd02ceeba Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 12 Jun 2018 21:09:18 +0100 Subject: [PATCH 5/7] Fixed typo --- include/etl/stack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/etl/stack.h b/include/etl/stack.h index 3f9e1612..497390df 100644 --- a/include/etl/stack.h +++ b/include/etl/stack.h @@ -470,7 +470,7 @@ namespace etl //*************************************************************************** ///\ingroup stack /// A fixed capacity stack. - /// This stack does not suppo7rt concurrent access by different threads. + /// This stack does not support concurrent access by different threads. /// \tparam T The type this stack should support. /// \tparam MAX_SIZE The maximum capacity of the stack. //*************************************************************************** From 5e30f02449a65f9cc9c259aff11b46eeabde414d Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 12 Jun 2018 21:12:04 +0100 Subject: [PATCH 6/7] Fixed missing semicolons --- include/etl/ratio.h | 14 +++++++------- test/vs2017/etl.vcxproj | 1 + test/vs2017/etl.vcxproj.filters | 3 +++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/etl/ratio.h b/include/etl/ratio.h index c0f03436..dfc94e86 100644 --- a/include/etl/ratio.h +++ b/include/etl/ratio.h @@ -28,13 +28,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#ifndef __ETL_RATIO__ -#define __ETL_RATIO__ +#ifndef ETL_RATIO_INCLUDED +#define ETL_RATIO_INCLUDED #include ///\defgroup ratio ratio -///\ingroup utilities +///\ingroup maths namespace etl { @@ -48,8 +48,8 @@ namespace etl #if INT_MAX > INT32_MAX typedef ratio<1, 1000000000000000000000000> yocto; typedef ratio<1, 1000000000000000000000> zepto; - typedef ratio<1, 1000000000000000000> atto - typedef ratio<1, 1000000000000000> femto + typedef ratio<1, 1000000000000000000> atto; + typedef ratio<1, 1000000000000000> femto; typedef ratio<1, 1000000000000> pico; #endif @@ -63,8 +63,8 @@ namespace etl typedef ratio<1, 100> centi; typedef ratio<1, 10> deci; typedef ratio<10, 1> deca; - typedef ratio<100, 1> hecto - typedef ratio<1000, 1> kilo + typedef ratio<100, 1> hecto; + typedef ratio<1000, 1> kilo; #endif #if (INT_MAX >= INT32_MAX) diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index 4c47ec11..58a57d4c 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -394,6 +394,7 @@ + diff --git a/test/vs2017/etl.vcxproj.filters b/test/vs2017/etl.vcxproj.filters index d8a39e36..a67689f1 100644 --- a/test/vs2017/etl.vcxproj.filters +++ b/test/vs2017/etl.vcxproj.filters @@ -627,6 +627,9 @@ Header Files + + ETL\Maths + From eeb6a310c1249f7d591f3455723a40762e2b9049 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 14 Jun 2018 21:53:54 +0100 Subject: [PATCH 7/7] Compatibility changes for Segger IDE, GCC & STLPort --- include/etl/cstring.h | 4 +- include/etl/deque.h | 4 +- include/etl/flat_map.h | 4 +- include/etl/flat_multimap.h | 4 +- include/etl/flat_multiset.h | 4 +- include/etl/flat_set.h | 4 +- include/etl/forward_list.h | 4 +- include/etl/list.h | 4 +- include/etl/map.h | 4 +- include/etl/multimap.h | 4 +- include/etl/multiset.h | 4 +- include/etl/nullptr.h | 6 ++- include/etl/profiles/segger_gcc_stlport.h | 57 +++++++++++++++++++++++ include/etl/set.h | 4 +- include/etl/type_traits.h | 6 +-- include/etl/u16string.h | 4 +- include/etl/u32string.h | 4 +- include/etl/vector.h | 6 +-- include/etl/version.h | 6 +-- include/etl/wstring.h | 4 +- support/Release notes.txt | 8 ++++ test/vs2017/etl.vcxproj | 1 + test/vs2017/etl.vcxproj.filters | 3 ++ 23 files changed, 113 insertions(+), 40 deletions(-) create mode 100644 include/etl/profiles/segger_gcc_stlport.h diff --git a/include/etl/cstring.h b/include/etl/cstring.h index 0ddfc80a..567561e9 100644 --- a/include/etl/cstring.h +++ b/include/etl/cstring.h @@ -35,7 +35,7 @@ SOFTWARE. #include "basic_string.h" #include "hash.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -141,7 +141,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/deque.h b/include/etl/deque.h index da898328..ccccff02 100644 --- a/include/etl/deque.h +++ b/include/etl/deque.h @@ -48,7 +48,7 @@ SOFTWARE. #include "type_traits.h" #include "parameter_type.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -2066,7 +2066,7 @@ namespace etl this->assign(n, value); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index 2c7e2f99..d12f1f0e 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -35,7 +35,7 @@ SOFTWARE. #include "reference_flat_map.h" #include "pool.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -854,7 +854,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index 210664ff..1545eeea 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -35,7 +35,7 @@ SOFTWARE. #include "reference_flat_multimap.h" #include "pool.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -735,7 +735,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index 442f2f99..5858c211 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -35,7 +35,7 @@ SOFTWARE. #include "reference_flat_multiset.h" #include "pool.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -694,7 +694,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index fe7590d6..ab6a4cd2 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -35,7 +35,7 @@ SOFTWARE. #include "reference_flat_set.h" #include "pool.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -760,7 +760,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/forward_list.h b/include/etl/forward_list.h index 407380d3..619547a1 100644 --- a/include/etl/forward_list.h +++ b/include/etl/forward_list.h @@ -46,7 +46,7 @@ SOFTWARE. #include "type_traits.h" #include "parameter_type.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -1415,7 +1415,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/list.h b/include/etl/list.h index d48a6f5d..242ac520 100644 --- a/include/etl/list.h +++ b/include/etl/list.h @@ -47,7 +47,7 @@ SOFTWARE. #include "parameter_type.h" #include "algorithm.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -1655,7 +1655,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/map.h b/include/etl/map.h index 4e7476fb..b04ffc87 100644 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -47,7 +47,7 @@ SOFTWARE. #include "type_traits.h" #include "parameter_type.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -2063,7 +2063,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* diff --git a/include/etl/multimap.h b/include/etl/multimap.h index e08e65dd..6be6b681 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -46,7 +46,7 @@ SOFTWARE. #include "type_traits.h" #include "parameter_type.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -1948,7 +1948,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* diff --git a/include/etl/multiset.h b/include/etl/multiset.h index 47673ee5..e0be09db 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -46,7 +46,7 @@ SOFTWARE. #include "nullptr.h" #include "type_traits.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -1928,7 +1928,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* diff --git a/include/etl/nullptr.h b/include/etl/nullptr.h index 07de981b..641b6338 100644 --- a/include/etl/nullptr.h +++ b/include/etl/nullptr.h @@ -72,14 +72,18 @@ namespace std /// A null pointer. ///\ingroup nullptr //***************************************************************************** - const nullptr_t nullptr = {}; + #if !defined(ETL_STLPORT) + const nullptr_t nullptr = { }; + #endif } //***************************************************************************** /// A null pointer. ///\ingroup nullptr //***************************************************************************** +#if !defined(ETL_STLPORT) const std::nullptr_t nullptr = {}; +#endif #else #include diff --git a/include/etl/profiles/segger_gcc_stlport.h b/include/etl/profiles/segger_gcc_stlport.h new file mode 100644 index 00000000..095f4601 --- /dev/null +++ b/include/etl/profiles/segger_gcc_stlport.h @@ -0,0 +1,57 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2017 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef ETL_GCC_INCLUDED +#define ETL_GCC_INCLUDED + +//***************************************************************************** +// GCC +//***************************************************************************** + +#include + +#define ETL_TARGET_DEVICE_GENERIC +#define ETL_TARGET_OS_NONE +#define ETL_COMPILER_GCC +#ifdef __cplusplus + #define ETL_CPP11_SUPPORTED (__cplusplus >= 201103L) + #define ETL_CPP14_SUPPORTED (__cplusplus >= 201402L) + #define ETL_CPP17_SUPPORTED 0 +#else + #define ETL_CPP11_SUPPORTED 0 + #define ETL_CPP14_SUPPORTED 0 + #define ETL_CPP17_SUPPORTED 0 +#endif +#define ETL_NO_NULLPTR_SUPPORT 1 +#define ETL_NO_LARGE_CHAR_SUPPORT !ETL_CPP11_SUPPORTED +#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED 0 +#define ETL_STLPORT 1 + +#endif diff --git a/include/etl/set.h b/include/etl/set.h index e405de30..59283c0c 100644 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -46,7 +46,7 @@ SOFTWARE. #include "type_traits.h" #include "parameter_type.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -1986,7 +1986,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index a28a2065..36036944 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -33,7 +33,7 @@ SOFTWARE. #endif //*************************************************************************** -// This file has been auto generated. Do not edit this file. +// THIS FILE HAS BEEN AUTO GENERATED. DO NOT EDIT THIS FILE. //*************************************************************************** //*************************************************************************** @@ -269,14 +269,14 @@ namespace etl /// is_pod /// For C++03, only fundamental and pointers types are recognised. ///\ingroup type_traits -#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO)) && !defined(ETL_IN_UNIT_TEST) +#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO) && !defined(ETL_STLPORT)) && !defined(ETL_IN_UNIT_TEST) // For compilers that support C++11 template struct is_pod : std::is_pod {}; #else template struct is_pod : etl::integral_constant::value || etl::is_pointer::value> {}; #endif -#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_IN_UNIT_TEST) +#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_STLPORT) && !defined(ETL_IN_UNIT_TEST) /// is_trivially_constructible ///\ingroup type_traits template struct is_trivially_constructible : std::is_trivially_constructible {}; diff --git a/include/etl/u16string.h b/include/etl/u16string.h index f9c5d22f..e4b8c1af 100644 --- a/include/etl/u16string.h +++ b/include/etl/u16string.h @@ -35,7 +35,7 @@ SOFTWARE. #include "basic_string.h" #include "hash.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -145,7 +145,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/u32string.h b/include/etl/u32string.h index 23554cf4..7a325634 100644 --- a/include/etl/u32string.h +++ b/include/etl/u32string.h @@ -35,7 +35,7 @@ SOFTWARE. #include "basic_string.h" #include "hash.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -145,7 +145,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/include/etl/vector.h b/include/etl/vector.h index 41683a93..51203597 100644 --- a/include/etl/vector.h +++ b/include/etl/vector.h @@ -53,7 +53,7 @@ SOFTWARE. #include "debug_count.h" #include "private/vector_base.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -1067,7 +1067,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* @@ -1183,7 +1183,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Constructor, from an initializer_list. //************************************************************************* diff --git a/include/etl/version.h b/include/etl/version.h index fa2e0a6d..015898b2 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -37,10 +37,10 @@ SOFTWARE. /// Definitions of the ETL version ///\ingroup utilities -#define ETL_VERSION "11.9.2" +#define ETL_VERSION "11.11.0" #define ETL_VERSION_MAJOR 11 -#define ETL_VERSION_MINOR 9 -#define ETL_VERSION_PATCH 2 +#define ETL_VERSION_MINOR 11 +#define ETL_VERSION_PATCH 0 #endif diff --git a/include/etl/wstring.h b/include/etl/wstring.h index d3d6eb65..a4f7bc23 100644 --- a/include/etl/wstring.h +++ b/include/etl/wstring.h @@ -35,7 +35,7 @@ SOFTWARE. #include "basic_string.h" #include "hash.h" -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) #include #endif @@ -146,7 +146,7 @@ namespace etl this->assign(first, last); } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) //************************************************************************* /// Construct from initializer_list. //************************************************************************* diff --git a/support/Release notes.txt b/support/Release notes.txt index 09ce8ee4..3501b177 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,11 @@ +=============================================================================== +11.11.0 +Compatibilty changes for Segger IDE, GCC & STLPort + +=============================================================================== +11.10.0 +Merged CMake branch + =============================================================================== 11.9.2 Fixed compile error when ETL_DEBUG_COUNT is not defined. diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index 58a57d4c..d866d331 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -393,6 +393,7 @@ + diff --git a/test/vs2017/etl.vcxproj.filters b/test/vs2017/etl.vcxproj.filters index a67689f1..78786739 100644 --- a/test/vs2017/etl.vcxproj.filters +++ b/test/vs2017/etl.vcxproj.filters @@ -630,6 +630,9 @@ ETL\Maths + + ETL\Profiles +