2
0
mirror of https://github.com/boostorg/uuid.git synced 2026-01-19 04:42:16 +00:00

Add test_namespaces.cpp

This commit is contained in:
Peter Dimov
2024-04-29 22:13:48 +03:00
parent 6ddc957a7b
commit 3358a67c6e
3 changed files with 30 additions and 2 deletions

View File

@@ -27,8 +27,11 @@ boost_test(TYPE run SOURCES test_io.cpp LINK_LIBRARIES Boost::lexical_cast Boost
boost_test(TYPE run SOURCES test_uuid_clock.cpp)
boost_test(TYPE run SOURCES test_nil_generator.cpp)
boost_test(TYPE run SOURCES test_name_generator.cpp LINK_LIBRARIES Boost::predef)
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_random_generator.cpp LINK_LIBRARIES Boost::random Boost::predef)
boost_test(TYPE run SOURCES test_time_generator_v1.cpp LINK_LIBRARIES $<$<CXX_COMPILER_ID:GNU>:atomic>)

View File

@@ -75,8 +75,11 @@ run test_uuid_clock.cpp ;
# test generators
run test_nil_generator.cpp ;
run test_name_generator.cpp ;
run test_string_generator.cpp ;
run test_namespaces.cpp ;
run test_name_generator.cpp ;
run test_random_generator.cpp ;
lib atomic ;

22
test/test_namespaces.cpp Normal file
View File

@@ -0,0 +1,22 @@
// Copyright 2010 Andy Tompkins
// Copyright 2024 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/uuid/namespaces.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/string_generator.hpp>
#include <boost/core/lightweight_test.hpp>
using namespace boost::uuids;
int main()
{
BOOST_TEST_EQ( ns::dns(), string_generator()("6ba7b810-9dad-11d1-80b4-00c04fd430c8"));
BOOST_TEST_EQ( ns::url(), string_generator()("6ba7b811-9dad-11d1-80b4-00c04fd430c8"));
BOOST_TEST_EQ( ns::oid(), string_generator()("6ba7b812-9dad-11d1-80b4-00c04fd430c8"));
BOOST_TEST_EQ( ns::x500dn(), string_generator()("6ba7b814-9dad-11d1-80b4-00c04fd430c8"));
return boost::report_errors();
}