build: reconcile module dependency closures, Log.hpp ownership, and consumer tests (X-BASE-03)
This commit is contained in:
1 parent
e385746b74
commit
cd6fc7e5f5
19 files changed
+318
-52
No files matched your search
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(VoidEmbeddedConsumer LANGUAGES CXX)
|
||||
|
||||
set(VOID_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." CACHE PATH "Path to VoidLibrary source")
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Parent static policy" FORCE)
|
||||
set(VOID_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
|
||||
set(VOID_ENABLED_MODULES "Math;Text;Time;Functional;Binary" CACHE STRING "" FORCE)
|
||||
|
||||
add_subdirectory("${VOID_SOURCE_DIR}" void_subbuild)
|
||||
|
||||
add_executable(void_embedded_consumer main.cpp)
|
||||
target_link_libraries(void_embedded_consumer PRIVATE
|
||||
Void::Math
|
||||
Void::Text
|
||||
Void::Time
|
||||
Void::Functional
|
||||
Void::Binary
|
||||
)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME VoidEmbeddedConsumer COMMAND void_embedded_consumer)
|
||||
@@ -0,0 +1,29 @@
|
||||
#include <Void/Binary/Reader.hpp>
|
||||
#include <Void/Functional/Result.hpp>
|
||||
#include <Void/Math/Numeric.hpp>
|
||||
#include <Void/Text/Str.hpp>
|
||||
#include <Void/Time/Stopwatch.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
int main()
|
||||
{
|
||||
const auto r = Void::Numeric::checked_mul(6, 7);
|
||||
if (!r || *r != 42) {
|
||||
return 1;
|
||||
}
|
||||
if (Void::Str::to_upper("ok") != "OK") {
|
||||
return 1;
|
||||
}
|
||||
const std::array bytes{std::byte{0x2A}};
|
||||
Void::Binary::Reader reader{bytes};
|
||||
const auto b = reader.read<std::uint8_t>(std::endian::big);
|
||||
Void::Time::Stopwatch sw;
|
||||
sw.start();
|
||||
(void)sw.stop();
|
||||
const auto res = Void::Result::ok(b.value_or(0));
|
||||
return res && *res == 42 ? 0 : 1;
|
||||
}
|
||||
Reference in new issue
Block a user