Initial commit

This commit is contained in:
2026-01-23 22:15:36 +01:00
commit ca60108606
167 changed files with 5311 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)
find_package(stduuid REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE stduuid::stduuid)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
if(stduuid_VERSION VERSION_LESS "1.1")
target_compile_definitions(${PROJECT_NAME} PRIVATE STDUUID_LT_1_1)
endif()

View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,39 @@
#include <uuid.h>
#include <algorithm>
#include <array>
#include <cassert>
#include <functional>
#include <random>
int main() {
{
auto str = "47183823-2574-4bfd-b411-99ed177d3e43";
auto guid = uuids::uuid::from_string(str);
#ifdef STDUUID_LT_1_1
assert(uuids::to_string(guid) == str);
#else
assert(uuids::to_string(guid.value()) == str);
#endif
}
{
std::random_device rd;
auto seed_data = std::array<int, std::mt19937::state_size> {};
std::generate(std::begin(seed_data), std::end(seed_data), std::ref(rd));
std::seed_seq seq(std::begin(seed_data), std::end(seed_data));
std::mt19937 generator(seq);
uuids::uuid const guid = uuids::uuid_random_generator{generator}();
assert(!guid.is_nil());
#ifdef STDUUID_LT_1_1
assert(guid.size() == 16);
#else
assert(guid.as_bytes().size() == 16);
#endif
assert(guid.version() == uuids::uuid_version::random_number_based);
assert(guid.variant() == uuids::uuid_variant::rfc);
}
return 0;
}