mirror of
https://github.com/boostorg/uuid.git
synced 2025-05-12 05:51:43 +00:00
43 lines
869 B
C++
43 lines
869 B
C++
// Copyright 2024 Peter Dimov
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// https://www.boost.org/LICENSE_1_0.txt
|
|
|
|
#include <boost/uuid/uuid.hpp>
|
|
#include <boost/uuid/random_generator.hpp>
|
|
#include <boost/core/lightweight_test.hpp>
|
|
#include <unordered_set>
|
|
|
|
int main()
|
|
{
|
|
using namespace boost::uuids;
|
|
|
|
std::size_t const N = 256;
|
|
|
|
{
|
|
std::unordered_set<uuid> set;
|
|
|
|
random_generator gen;
|
|
|
|
for( std::size_t i = 0; i < N; ++i )
|
|
{
|
|
set.insert( gen() );
|
|
}
|
|
|
|
BOOST_TEST_EQ( set.size(), N );
|
|
}
|
|
|
|
{
|
|
std::unordered_set<uuid> set;
|
|
|
|
for( std::size_t i = 0; i < N; ++i )
|
|
{
|
|
uuid id = { { static_cast<std::uint8_t>( i ), 0 } };
|
|
set.insert( id );
|
|
}
|
|
|
|
BOOST_TEST_EQ( set.size(), N );
|
|
}
|
|
|
|
return boost::report_errors();
|
|
}
|