mirror of
https://github.com/boostorg/uuid.git
synced 2026-01-19 04:42:16 +00:00
Add test_time_generator
This commit is contained in:
@@ -28,12 +28,12 @@ boost_test(TYPE run SOURCES test_uuid_clock.cpp)
|
||||
|
||||
boost_test(TYPE run SOURCES test_nil_generator.cpp)
|
||||
boost_test(TYPE run SOURCES test_string_generator.cpp)
|
||||
|
||||
boost_test(TYPE run SOURCES test_namespaces.cpp)
|
||||
boost_test(TYPE run SOURCES test_name_generator.cpp LINK_LIBRARIES Boost::predef)
|
||||
|
||||
boost_test(TYPE run SOURCES test_namespaces.cpp)
|
||||
boost_test(TYPE run SOURCES test_random_generator.cpp LINK_LIBRARIES Boost::random Boost::predef)
|
||||
|
||||
boost_test(TYPE run SOURCES test_time_generator.cpp LINK_LIBRARIES $<$<CXX_COMPILER_ID:GNU>:atomic>)
|
||||
|
||||
boost_test(TYPE run SOURCES test_time_generator_v1.cpp LINK_LIBRARIES $<$<CXX_COMPILER_ID:GNU>:atomic>)
|
||||
boost_test(TYPE run SOURCES test_time_generator_v1_2.cpp LINK_LIBRARIES $<$<CXX_COMPILER_ID:GNU>:atomic>)
|
||||
boost_test(TYPE run SOURCES test_time_generator_v1_3.cpp LINK_LIBRARIES $<$<CXX_COMPILER_ID:GNU>:atomic> Threads::Threads)
|
||||
|
||||
@@ -76,14 +76,16 @@ run test_uuid_clock.cpp ;
|
||||
|
||||
run test_nil_generator.cpp ;
|
||||
run test_string_generator.cpp ;
|
||||
|
||||
run test_namespaces.cpp ;
|
||||
run test_name_generator.cpp ;
|
||||
|
||||
run test_namespaces.cpp ;
|
||||
run test_random_generator.cpp ;
|
||||
|
||||
lib atomic ;
|
||||
|
||||
run test_time_generator.cpp
|
||||
: : : <toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
|
||||
<toolset>gcc-4.8,<address-model>32:<build>no ;
|
||||
|
||||
run test_time_generator_v1.cpp
|
||||
: : : <toolset>gcc:<library>atomic <toolset>clang-linux:<library>atomic
|
||||
<toolset>gcc-4.8,<address-model>32:<build>no ;
|
||||
|
||||
28
test/test_time_generator.cpp
Normal file
28
test/test_time_generator.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2024 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/uuid/time_generator.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::uuids;
|
||||
|
||||
int main()
|
||||
{
|
||||
uuid u1 = time_generator_v1()();
|
||||
|
||||
BOOST_TEST_EQ( u1.variant(), uuid::variant_rfc_4122 );
|
||||
BOOST_TEST_EQ( u1.version(), uuid::version_time_based );
|
||||
|
||||
uuid u2 = time_generator_v6()();
|
||||
|
||||
BOOST_TEST_EQ( u2.variant(), uuid::variant_rfc_4122 );
|
||||
BOOST_TEST_EQ( u2.version(), uuid::version_time_based_v6 );
|
||||
|
||||
uuid u3 = time_generator_v7()();
|
||||
|
||||
BOOST_TEST_EQ( u3.variant(), uuid::variant_rfc_4122 );
|
||||
BOOST_TEST_EQ( u3.version(), uuid::version_time_based_v7 );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user