From 1afbe56e54017e9dd3698d3fdf0c1c1df4016d7b Mon Sep 17 00:00:00 2001 From: David Dight Date: Sat, 18 May 2024 17:51:36 +1000 Subject: [PATCH] .github/workflows/Ubuntu-gcc-latest.yml --- .github/workflows/Ubuntu-gcc-latest.yml | 4 +-- CMakeLists.txt | 8 ++--- examples/statictest.cpp | 47 +++++++++++++++++++++++-- {examples => utests}/edgetests.cpp | 0 {examples => utests}/unittests.cpp | 0 5 files changed, 51 insertions(+), 8 deletions(-) rename {examples => utests}/edgetests.cpp (100%) rename {examples => utests}/unittests.cpp (100%) diff --git a/.github/workflows/Ubuntu-gcc-latest.yml b/.github/workflows/Ubuntu-gcc-latest.yml index ea1f1df0..ddd07adb 100644 --- a/.github/workflows/Ubuntu-gcc-latest.yml +++ b/.github/workflows/Ubuntu-gcc-latest.yml @@ -13,8 +13,8 @@ on: env: BUILD_TYPE: Release - CC: gcc-13 - CXX: g++-13 + CC: gcc-14 + CXX: g++-14 jobs: linux: diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a4c909e..a1992ead 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,8 +55,8 @@ message("-- Build with all warnings : ${BUILD_ALL_WARNINGS}") option(BUILD_UNITTESTS "enable building unit tests" true) message("-- Build unit tests: ${BUILD_UNITTESTS}") -function(build x) - add_executable(${x} examples/${x}.cpp) +function(build loc x) + add_executable(${x} ${loc}/${x}.cpp) add_dependencies(${x} srcloctest) # srcloctest should be built even if errors with conjure_enum set_target_properties(${x} PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED true) target_include_directories(${x} PRIVATE include) @@ -73,7 +73,7 @@ function(build x) endfunction() foreach(x srcloctest example statictest) - build(${x}) + build(examples ${x}) if(BUILD_STRIP_EXE) add_custom_command(TARGET ${x} POST_BUILD COMMAND ${CMAKE_STRIP} ${x}) endif() @@ -91,7 +91,7 @@ if(BUILD_UNITTESTS) include(Catch) enable_testing() foreach(x unittests edgetests) - build(${x}) + build(utests ${x}) target_link_libraries(${x} PRIVATE Catch2::Catch2WithMain) catch_discover_tests(${x}) endforeach() diff --git a/examples/statictest.cpp b/examples/statictest.cpp index 8a9a5fb0..fffaca3a 100644 --- a/examples/statictest.cpp +++ b/examples/statictest.cpp @@ -32,10 +32,47 @@ #include //----------------------------------------------------------------------------------------- -using namespace FIX8; +enum class component : int { scheme, authority, userinfo, user, password, host, port, path, query, fragment }; + +namespace TEST +{ + enum class NineEnums : int { One, Two, Three, Four, Five, Six, Seven, Eight, Nine }; + enum NineEnums1 : int { One, Two, Three, Four, Five, Six, Seven, Eight, Nine }; + namespace TEST1 + { + enum class NineEnums : int { One, Two, Three, Four, Five, Six, Seven, Eight, Nine }; + enum NineEnums1 : int { One, Two, Three, Four, Five, Six, Seven, Eight, Nine }; + namespace TEST2::TEST3::TEST4::TEST5 + { + enum class NineEnums : int { One, Two, Three, Four, Five, Six, Seven, Eight, Nine }; + enum NineEnums1 : int { One, Two, Three, Four, Five, Six, Seven, Eight, Nine }; + } + } +} + +namespace gsdsp::dsp::fd +{ + +class AnalysisFrame +{ + public: + enum class PrecomputedFrames + { one }; +}; +} + +namespace gsdsp::utilities +{ + template + [[nodiscard]] + constexpr size_t countOf() + { + return FIX8::conjure_enum::count(); + } +} //----------------------------------------------------------------------------------------- -enum class component : int { scheme, authority, userinfo, user, password, host, port, path, query, fragment }; +using namespace FIX8; //----------------------------------------------------------------------------------------- int main(void) @@ -48,5 +85,11 @@ int main(void) std::cout << a << '\n'; for(const auto& a : conjure_enum::unscoped_names) std::cout << a << '\n'; + + for(const auto& [a, b] : conjure_enum::entries) + std::cout << conjure_enum::enum_to_int(a) << ' ' << b << '\n'; + std::cout << conjure_enum::count() << '\n'; + + std::cout << gsdsp::utilities::countOf() << '\n'; return 0; } diff --git a/examples/edgetests.cpp b/utests/edgetests.cpp similarity index 100% rename from examples/edgetests.cpp rename to utests/edgetests.cpp diff --git a/examples/unittests.cpp b/utests/unittests.cpp similarity index 100% rename from examples/unittests.cpp rename to utests/unittests.cpp