mirror of
https://github.com/boostorg/uuid.git
synced 2026-01-19 04:42:16 +00:00
Add RFC-9562 compliant Max UUID (section 5.10)
This commit is contained in:
committed by
Jim King
parent
434329f8dc
commit
bf16d95746
@@ -36,6 +36,7 @@ boost_test(TYPE run SOURCES test_to_chars_2.cpp)
|
||||
|
||||
boost_test(TYPE run SOURCES test_uuid_clock.cpp)
|
||||
|
||||
boost_test(TYPE run SOURCES test_max_generator.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_random_generator.cpp LINK_LIBRARIES Boost::random Boost::predef)
|
||||
|
||||
@@ -100,6 +100,7 @@ run test_uuid_clock.cpp ;
|
||||
|
||||
# test generators
|
||||
|
||||
run test_max_generator.cpp ;
|
||||
run test_nil_generator.cpp ;
|
||||
run test_string_generator.cpp ;
|
||||
|
||||
|
||||
31
test/test_max_generator.cpp
Normal file
31
test/test_max_generator.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2025 James E. King III
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// libs/uuid/test/test_max_generator.cpp -------------------------------//
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include <boost/uuid/max_generator.hpp>
|
||||
#include <boost/uuid/nil_generator.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
int main(int, char*[])
|
||||
{
|
||||
using namespace boost::uuids;
|
||||
|
||||
uuid uunil = nil_generator()();
|
||||
uuid uumax = max_generator()();
|
||||
uuid expected = {{
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
|
||||
}};
|
||||
BOOST_TEST_EQ(uumax, expected);
|
||||
BOOST_TEST_LT(uunil, uumax);
|
||||
|
||||
uuid u3 = max_uuid();
|
||||
BOOST_TEST_EQ(u3, expected);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user