Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59535 - in trunk: boost/uuid libs/uuid libs/uuid/test
From: atompkins_at_[hidden]
Date: 2010-02-06 17:32:52


Author: atompkins
Date: 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
New Revision: 59535
URL: http://svn.boost.org/trac/boost/changeset/59535

Log:
switch from the Boost Test Library to boost/detail/lightweight_test.hpp
moved uuid generators into their own file
Added:
   trunk/boost/uuid/name_generator.hpp (contents, props changed)
   trunk/boost/uuid/nil_generator.hpp (contents, props changed)
   trunk/boost/uuid/random_generator.hpp (contents, props changed)
   trunk/boost/uuid/string_generator.hpp (contents, props changed)
   trunk/libs/uuid/test/compile_name_generator.cpp (contents, props changed)
   trunk/libs/uuid/test/compile_nil_generator.cpp (contents, props changed)
   trunk/libs/uuid/test/compile_random_generator.cpp (contents, props changed)
   trunk/libs/uuid/test/compile_string_generator.cpp (contents, props changed)
   trunk/libs/uuid/test/compile_uuid.cpp (contents, props changed)
   trunk/libs/uuid/test/compile_uuid_generators.cpp (contents, props changed)
   trunk/libs/uuid/test/compile_uuid_io.cpp (contents, props changed)
   trunk/libs/uuid/test/compile_uuid_serialize.cpp (contents, props changed)
   trunk/libs/uuid/test/lightweight_test_ex.hpp (contents, props changed)
   trunk/libs/uuid/test/test_name_generator.cpp (contents, props changed)
   trunk/libs/uuid/test/test_nil_generator.cpp (contents, props changed)
   trunk/libs/uuid/test/test_random_generator.cpp (contents, props changed)
   trunk/libs/uuid/test/test_string_generator.cpp (contents, props changed)
Text files modified:
   trunk/boost/uuid/uuid_generators.hpp | 389 ---------------------------------------
   trunk/libs/uuid/test/Jamfile.v2 | 99 ++++-----
   trunk/libs/uuid/test/test_include1.cpp | 11
   trunk/libs/uuid/test/test_include2.cpp | 4
   trunk/libs/uuid/test/test_io.cpp | 48 ++--
   trunk/libs/uuid/test/test_serialization.cpp | 9
   trunk/libs/uuid/test/test_sha1.cpp | 69 +++++-
   trunk/libs/uuid/test/test_tagging.cpp | 24 +-
   trunk/libs/uuid/test/test_uuid.cpp | 97 +++++----
   trunk/libs/uuid/test/test_uuid_class.cpp | 16
   trunk/libs/uuid/test/test_wserialization.cpp | 7
   trunk/libs/uuid/uuid.html | 188 ++++++++++++-------
   12 files changed, 337 insertions(+), 624 deletions(-)

Added: trunk/boost/uuid/name_generator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/uuid/name_generator.hpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,125 @@
+// Boost name_generator.hpp header file ----------------------------------------------//
+
+// Copyright 2010 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UUID_NAME_GENERATOR_HPP
+#define BOOST_UUID_NAME_GENERATOR_HPP
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/sha1.hpp>
+#include <boost/assert.hpp>
+#include <string>
+#include <cstring> // for strlen, wcslen
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+ using ::strlen;
+ using ::wcslen;
+} //namespace std
+#endif //BOOST_NO_STDC_NAMESPACE
+
+namespace boost {
+namespace uuids {
+
+// generate a name-based uuid
+// TODO: add in common namesspace uuids
+class name_generator {
+public:
+ typedef uuid result_type;
+
+ explicit name_generator(uuid const& namespace_uuid)
+ : namespace_uuid(namespace_uuid)
+ {}
+
+ uuid operator()(const char* name) {
+ reset();
+ process_characters(name, std::strlen(name));
+ return sha_to_uuid();
+ }
+
+ uuid operator()(const wchar_t* name) {
+ reset();
+ process_characters(name, std::wcslen(name));
+ return sha_to_uuid();
+ }
+
+ template <typename ch, typename char_traits, typename alloc>
+ uuid operator()(std::basic_string<ch, char_traits, alloc> const& name) {
+ reset();
+ process_characters(name.c_str(), name.length());
+ return sha_to_uuid();
+ }
+
+ uuid operator()(void const* buffer, std::size_t byte_count) {
+ reset();
+ sha.process_bytes(buffer, byte_count);
+ return sha_to_uuid();
+ };
+
+private:
+ // we convert all characters to uint32_t so that each
+ // character is 4 bytes reguardless of sizeof(char) or
+ // sizeof(wchar_t). We want the name string on any
+ // platform / compiler to generate the same uuid
+ // except for char
+ template <typename char_type>
+ void process_characters(char_type const*const characters, size_t count) {
+ BOOST_ASSERT(sizeof(uint32_t) >= sizeof(char_type));
+
+ for (size_t i=0; i<count; i++) {
+ uint32_t c = characters[i];
+ sha.process_byte( (c >> 0) && 0xFF );
+ sha.process_byte( (c >> 8) && 0xFF );
+ sha.process_byte( (c >> 16) && 0xFF );
+ sha.process_byte( (c >> 24) && 0xFF );
+ }
+ }
+
+ void process_characters(char const*const characters, size_t count) {
+ sha.process_bytes(characters, count);
+ }
+
+ void reset()
+ {
+ sha.reset();
+ sha.process_bytes(namespace_uuid.begin(), namespace_uuid.size());
+ }
+
+ uuid sha_to_uuid()
+ {
+ unsigned int digest[5];
+
+ sha.get_digest(digest);
+
+ uuid u;
+ for (int i=0; i<4; ++i) {
+ *(u.begin() + i*4+0) = ((digest[i] >> 24) & 0xFF);
+ *(u.begin() + i*4+1) = ((digest[i] >> 16) & 0xFF);
+ *(u.begin() + i*4+2) = ((digest[i] >> 8) & 0xFF);
+ *(u.begin() + i*4+3) = ((digest[i] >> 0) & 0xFF);
+ }
+
+ // set variant
+ // must be 0b10xxxxxx
+ *(u.begin()+8) &= 0xBF;
+ *(u.begin()+8) |= 0x80;
+
+ // set version
+ // must be 0b0101xxxx
+ *(u.begin()+6) &= 0x5F; //0b01011111
+ *(u.begin()+6) |= 0x50; //0b01010000
+
+ return u;
+ }
+
+private:
+ uuid namespace_uuid;
+ detail::sha1 sha;
+};
+
+}} // namespace boost::uuids
+
+#endif // BOOST_UUID_NAME_GENERATOR_HPP

Added: trunk/boost/uuid/nil_generator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/uuid/nil_generator.hpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,34 @@
+// Boost nil_generator.hpp header file ----------------------------------------------//
+
+// Copyright 2010 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UUID_NIL_GENERATOR_HPP
+#define BOOST_UUID_NIL_GENERATOR_HPP
+
+#include <boost/uuid/uuid.hpp>
+
+namespace boost {
+namespace uuids {
+
+// generate a nil uuid
+struct nil_generator {
+ typedef uuid result_type;
+
+ uuid operator()() const {
+ // initialize to all zeros
+ uuid u = {{0}};
+ return u;
+ }
+};
+
+inline uuid nil_uuid() {
+ return nil_generator()();
+}
+
+}} // namespace boost::uuids
+
+#endif // BOOST_UUID_NIL_GENERATOR_HPP
+

Added: trunk/boost/uuid/random_generator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/uuid/random_generator.hpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,117 @@
+// Boost random_generator.hpp header file ----------------------------------------------//
+
+// Copyright 2010 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UUID_RANDOM_GENERATOR_HPP
+#define BOOST_UUID_RANDOM_GENERATOR_HPP
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/seed_rng.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/assert.hpp>
+#include <boost/shared_ptr.hpp>
+#include <limits>
+
+namespace boost {
+namespace uuids {
+
+// generate a random-based uuid
+template <typename UniformRandomNumberGenerator>
+class basic_random_generator {
+private:
+ typedef uniform_int<unsigned long> distribution_type;
+ typedef variate_generator<UniformRandomNumberGenerator*, distribution_type> generator_type;
+
+ struct null_deleter
+ {
+ void operator()(void const *) const {}
+ };
+
+public:
+ typedef uuid result_type;
+
+ // default constructor creates the random number generator
+ basic_random_generator()
+ : pURNG(new UniformRandomNumberGenerator)
+ , generator
+ ( pURNG.get()
+ , distribution_type
+ ( (std::numeric_limits<unsigned long>::min)()
+ , (std::numeric_limits<unsigned long>::max)()
+ )
+ )
+ {
+ // seed the random number generator
+ detail::seed(*pURNG);
+ }
+
+ // keep a reference to a random number generator
+ // don't seed a given random number generator
+ explicit basic_random_generator(UniformRandomNumberGenerator& gen)
+ : pURNG(&gen, null_deleter())
+ , generator
+ ( pURNG.get()
+ , distribution_type
+ ( (std::numeric_limits<unsigned long>::min)()
+ , (std::numeric_limits<unsigned long>::max)()
+ )
+ )
+ {}
+
+ // keep a pointer to a random number generator
+ // don't seed a given random number generator
+ explicit basic_random_generator(UniformRandomNumberGenerator* pGen)
+ : pURNG(pGen, null_deleter())
+ , generator
+ ( pURNG.get()
+ , distribution_type
+ ( (std::numeric_limits<unsigned long>::min)()
+ , (std::numeric_limits<unsigned long>::max)()
+ )
+ )
+ {
+ BOOST_ASSERT(pURNG);
+ }
+
+ uuid operator()()
+ {
+ uuid u;
+
+ int i=0;
+ unsigned long random_value = generator();
+ for (uuid::iterator it=u.begin(); it!=u.end(); ++it, ++i) {
+ if (i==sizeof(unsigned long)) {
+ random_value = generator();
+ }
+
+ *it = ((random_value >> (i*8)) & 0xFF);
+ }
+
+ // set variant
+ // must be 0b10xxxxxx
+ *(u.begin()+8) &= 0xBF;
+ *(u.begin()+8) |= 0x80;
+
+ // set version
+ // must be 0b0100xxxx
+ *(u.begin()+6) &= 0x4F; //0b01001111
+ *(u.begin()+6) |= 0x40; //0b01000000
+
+ return u;
+ }
+
+private:
+ shared_ptr<UniformRandomNumberGenerator> pURNG;
+ generator_type generator;
+};
+
+typedef basic_random_generator<mt19937> random_generator;
+
+}} // namespace boost::uuids
+
+#endif //BOOST_UUID_RANDOM_GENERATOR_HPP

Added: trunk/boost/uuid/string_generator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/uuid/string_generator.hpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,184 @@
+// Boost string_generator.hpp header file ----------------------------------------------//
+
+// Copyright 2010 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UUID_STRING_GENERATOR_HPP
+#define BOOST_UUID_STRING_GENERATOR_HPP
+
+#include <boost/uuid/uuid.hpp>
+#include <string>
+#include <cstring> // for strlen, wcslen
+#include <iterator>
+#include <algorithm> // for find
+#include <stdexcept>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+ using ::strlen;
+ using ::wcslen;
+} //namespace std
+#endif //BOOST_NO_STDC_NAMESPACE
+
+namespace boost {
+namespace uuids {
+
+// generate a uuid from a string
+// lexical_cast works fine using uuid_io.hpp
+// but this generator should accept more forms
+// and be more efficient
+// would like to accept the following forms:
+// 0123456789abcdef0123456789abcdef
+// 01234567-89ab-cdef-0123456789abcdef
+// {01234567-89ab-cdef-0123456789abcdef}
+// {0123456789abcdef0123456789abcdef}
+// others?
+struct string_generator {
+ typedef uuid result_type;
+
+ template <typename ch, typename char_traits, typename alloc>
+ uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const {
+ return operator()(s.begin(), s.end());
+ };
+
+ uuid operator()(char const*const s) const {
+ return operator()(s, s+std::strlen(s));
+ }
+
+ uuid operator()(wchar_t const*const s) const {
+ return operator()(s, s+std::wcslen(s));
+ }
+
+ template <typename CharIterator>
+ uuid operator()(CharIterator begin, CharIterator end) const
+ {
+ typedef typename std::iterator_traits<CharIterator>::value_type char_type;
+
+ // check open brace
+ char_type c = get_next_char(begin, end);
+ bool has_open_brace = is_open_brace(c);
+ char_type open_brace_char = c;
+ if (has_open_brace) {
+ c = get_next_char(begin, end);
+ }
+
+ bool has_dashes = false;
+
+ uuid u;
+ int i=0;
+ for (uuid::iterator it_byte=u.begin(); it_byte!=u.end(); ++it_byte, ++i) {
+ if (it_byte != u.begin()) {
+ c = get_next_char(begin, end);
+ }
+
+ if (i == 4) {
+ has_dashes = is_dash(c);
+ if (has_dashes) {
+ c = get_next_char(begin, end);
+ }
+ }
+
+ if (has_dashes) {
+ if (i == 6 || i == 8 || i == 10) {
+ if (is_dash(c)) {
+ c = get_next_char(begin, end);
+ } else {
+ throw_invalid();
+ }
+ }
+ }
+
+ *it_byte = get_value(c);
+
+ c = get_next_char(begin, end);
+ *it_byte <<= 4;
+ *it_byte |= get_value(c);
+ }
+
+ // check close brace
+ if (has_open_brace) {
+ c = get_next_char(begin, end);
+ check_close_brace(c, open_brace_char);
+ }
+
+ return u;
+ }
+
+private:
+ template <typename CharIterator>
+ typename std::iterator_traits<CharIterator>::value_type
+ get_next_char(CharIterator& begin, CharIterator end) const {
+ if (begin == end) {
+ throw_invalid();
+ }
+ return *begin++;
+ }
+
+ unsigned char get_value(char c) const {
+ static char const*const digits_begin = "0123456789abcdefABCDEF";
+ static char const*const digits_end = digits_begin + 22;
+
+ static unsigned char const values[] =
+ { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,10,11,12,13,14,15
+ , static_cast<unsigned char>(-1) };
+
+ char const* d = std::find(digits_begin, digits_end, c);
+ return values[d - digits_begin];
+ }
+
+ unsigned char get_value(wchar_t c) const {
+ static wchar_t const*const digits_begin = L"0123456789abcdefABCDEF";
+ static wchar_t const*const digits_end = digits_begin + 22;
+
+ static unsigned char const values[] =
+ { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,10,11,12,13,14,15
+ , static_cast<unsigned char>(-1) };
+
+ wchar_t const* d = std::find(digits_begin, digits_end, c);
+ return values[d - digits_begin];
+ }
+
+ bool is_dash(char c) const {
+ return c == '-';
+ }
+
+ bool is_dash(wchar_t c) const {
+ return c == L'-';
+ }
+
+ // return closing brace
+ bool is_open_brace(char c) const {
+ return (c == '{');
+ }
+
+ bool is_open_brace(wchar_t c) const {
+ return (c == L'{');
+ }
+
+ void check_close_brace(char c, char open_brace) const {
+ if (open_brace == '{' && c == '}') {
+ //great
+ } else {
+ throw_invalid();
+ }
+ }
+
+ void check_close_brace(wchar_t c, wchar_t open_brace) const {
+ if (open_brace == L'{' && c == L'}') {
+ // great
+ } else {
+ throw_invalid();
+ }
+ }
+
+ void throw_invalid() const {
+ throw std::runtime_error("invalid uuid string");
+ }
+};
+
+}} // namespace boost::uuids
+
+#endif //BOOST_UUID_STRING_GENERATOR_HPP
+

Modified: trunk/boost/uuid/uuid_generators.hpp
==============================================================================
--- trunk/boost/uuid/uuid_generators.hpp (original)
+++ trunk/boost/uuid/uuid_generators.hpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -11,390 +11,9 @@
 #ifndef BOOST_UUID_GENERATORS_HPP
 #define BOOST_UUID_GENERATORS_HPP
 
-#include <boost/uuid/uuid.hpp>
-#include <boost/uuid/sha1.hpp>
-#include <boost/uuid/seed_rng.hpp>
-#include <algorithm>
-#include <string>
-#include <limits>
-#include <cstring>
-#include <cwchar>
-#include <iterator> // for distance
-#include <boost/cstdint.hpp>
-#include <boost/assert.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/random/uniform_int.hpp>
-#include <boost/random/variate_generator.hpp>
-#include <boost/random/mersenne_twister.hpp>
-
-#ifdef BOOST_NO_STDC_NAMESPACE
-namespace std {
- using ::strlen;
- using ::wcslen;
-} //namespace std
-#endif //BOOST_NO_STDC_NAMESPACE
-
-namespace boost {
-namespace uuids {
-
-// generate a nil uuid
-struct nil_generator {
- typedef uuid result_type;
-
- uuid operator()() const {
- // initialize to all zeros
- uuid u = {{0}};
- return u;
- }
-};
-
-inline uuid nil_uuid() {
- return nil_generator()();
-}
-
-// generate a uuid from a string
-// lexical_cast works fine using uuid_io.hpp
-// but this generator should accept more forms
-// and be more efficient
-// would like to accept the following forms:
-// 0123456789abcdef0123456789abcdef
-// 01234567-89ab-cdef-0123456789abcdef
-// {01234567-89ab-cdef-0123456789abcdef}
-// {0123456789abcdef0123456789abcdef}
-// others?
-struct string_generator {
- typedef uuid result_type;
-
- template <typename ch, typename char_traits, typename alloc>
- uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const {
- return operator()(s.begin(), s.end());
- };
-
- uuid operator()(char const*const s) const {
- return operator()(s, s+std::strlen(s));
- }
-
- uuid operator()(wchar_t const*const s) const {
- return operator()(s, s+std::wcslen(s));
- }
-
- template <typename CharIterator>
- uuid operator()(CharIterator begin, CharIterator end) const
- {
- typedef typename std::iterator_traits<CharIterator>::value_type char_type;
-
- // check open brace
- char_type c = get_next_char(begin, end);
- bool has_open_brace = is_open_brace(c);
- char_type open_brace_char = c;
- if (has_open_brace) {
- c = get_next_char(begin, end);
- }
-
- bool has_dashes = false;
-
- uuid u;
- int i=0;
- for (uuid::iterator it_byte=u.begin(); it_byte!=u.end(); ++it_byte, ++i) {
- if (it_byte != u.begin()) {
- c = get_next_char(begin, end);
- }
-
- if (i == 4) {
- has_dashes = is_dash(c);
- if (has_dashes) {
- c = get_next_char(begin, end);
- }
- }
-
- if (has_dashes) {
- if (i == 6 || i == 8 || i == 10) {
- if (is_dash(c)) {
- c = get_next_char(begin, end);
- } else {
- throw_invalid();
- }
- }
- }
-
- *it_byte = get_value(c);
-
- c = get_next_char(begin, end);
- *it_byte <<= 4;
- *it_byte |= get_value(c);
- }
-
- // check close brace
- if (has_open_brace) {
- c = get_next_char(begin, end);
- check_close_brace(c, open_brace_char);
- }
-
- return u;
- }
-
-private:
- template <typename CharIterator>
- typename std::iterator_traits<CharIterator>::value_type
- get_next_char(CharIterator& begin, CharIterator end) const {
- if (begin == end) {
- throw_invalid();
- }
- return *begin++;
- }
-
- unsigned char get_value(char c) const {
- static char const*const digits_begin = "0123456789abcdefABCDEF";
- static char const*const digits_end = digits_begin + 22;
-
- static unsigned char const values[] =
- { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,10,11,12,13,14,15
- , static_cast<unsigned char>(-1) };
-
- char const* d = std::find(digits_begin, digits_end, c);
- return values[std::distance(digits_begin, d)];
- }
-
- unsigned char get_value(wchar_t c) const {
- static wchar_t const*const digits_begin = L"0123456789abcdefABCDEF";
- static wchar_t const*const digits_end = digits_begin + 22;
-
- static unsigned char const values[] =
- { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,10,11,12,13,14,15
- , static_cast<unsigned char>(-1) };
-
- wchar_t const* d = std::find(digits_begin, digits_end, c);
- return values[std::distance(digits_begin, d)];
- }
-
- bool is_dash(char c) const {
- return c == '-';
- }
-
- bool is_dash(wchar_t c) const {
- return c == L'-';
- }
-
- // return closing brace
- bool is_open_brace(char c) const {
- return (c == '{');
- }
-
- bool is_open_brace(wchar_t c) const {
- return (c == L'{');
- }
-
- void check_close_brace(char c, char open_brace) const {
- if (open_brace == '{' && c == '}') {
- //great
- } else {
- throw_invalid();
- }
- }
-
- void check_close_brace(wchar_t c, wchar_t open_brace) const {
- if (open_brace == L'{' && c == L'}') {
- // great
- } else {
- throw_invalid();
- }
- }
-
- void throw_invalid() const {
- throw std::runtime_error("invalid uuid string");
- }
-};
-
-// generate a name-based uuid
-// TODO: add in common namesspace uuids
-class name_generator {
-public:
- typedef uuid result_type;
-
- explicit name_generator(uuid const& namespace_uuid)
- : namespace_uuid(namespace_uuid)
- {}
-
- uuid operator()(const char* name) {
- reset();
- process_characters(name, std::strlen(name));
- return sha_to_uuid();
- }
-
- uuid operator()(const wchar_t* name) {
- reset();
- process_characters(name, std::wcslen(name));
- return sha_to_uuid();
- }
-
- template <typename ch, typename char_traits, typename alloc>
- uuid operator()(std::basic_string<ch, char_traits, alloc> const& name) {
- reset();
- process_characters(name.c_str(), name.length());
- return sha_to_uuid();
- }
-
- uuid operator()(void const* buffer, std::size_t byte_count) {
- reset();
- sha.process_bytes(buffer, byte_count);
- return sha_to_uuid();
- };
-
-private:
- // we convert all characters to uint32_t so that each
- // character is 4 bytes reguardless of sizeof(char) or
- // sizeof(wchar_t). We want the name string on any
- // platform / compiler to generate the same uuid
- // except for char
- template <typename char_type>
- void process_characters(char_type const*const characters, size_t count) {
- BOOST_ASSERT(sizeof(uint32_t) >= sizeof(char_type));
-
- for (size_t i=0; i<count; i++) {
- uint32_t c = characters[i];
- sha.process_byte( (c >> 0) && 0xFF );
- sha.process_byte( (c >> 8) && 0xFF );
- sha.process_byte( (c >> 16) && 0xFF );
- sha.process_byte( (c >> 24) && 0xFF );
- }
- }
-
- void process_characters(char const*const characters, size_t count) {
- sha.process_bytes(characters, count);
- }
-
- void reset()
- {
- sha.reset();
- sha.process_bytes(namespace_uuid.begin(), namespace_uuid.size());
- }
-
- uuid sha_to_uuid()
- {
- unsigned int digest[5];
-
- sha.get_digest(digest);
-
- uuid u;
- for (int i=0; i<4; ++i) {
- *(u.begin() + i*4+0) = ((digest[i] >> 24) & 0xFF);
- *(u.begin() + i*4+1) = ((digest[i] >> 16) & 0xFF);
- *(u.begin() + i*4+2) = ((digest[i] >> 8) & 0xFF);
- *(u.begin() + i*4+3) = ((digest[i] >> 0) & 0xFF);
- }
-
- // set variant
- // must be 0b10xxxxxx
- *(u.begin()+8) &= 0xBF;
- *(u.begin()+8) |= 0x80;
-
- // set version
- // must be 0b0101xxxx
- *(u.begin()+6) &= 0x5F; //0b01011111
- *(u.begin()+6) |= 0x50; //0b01010000
-
- return u;
- }
-
-private:
- uuid namespace_uuid;
- detail::sha1 sha;
-};
-
-// generate a random-based uuid
-template <typename UniformRandomNumberGenerator>
-class basic_random_generator {
-private:
- typedef uniform_int<unsigned long> distribution_type;
- typedef variate_generator<UniformRandomNumberGenerator*, distribution_type> generator_type;
-
- struct null_deleter
- {
- void operator()(void const *) const {}
- };
-
-public:
- typedef uuid result_type;
-
- // default constructor creates the random number generator
- basic_random_generator()
- : pURNG(new UniformRandomNumberGenerator)
- , generator
- ( pURNG.get()
- , distribution_type
- ( (std::numeric_limits<unsigned long>::min)()
- , (std::numeric_limits<unsigned long>::max)()
- )
- )
- {
- // seed the random number generator
- detail::seed(*pURNG);
- }
-
- // keep a reference to a random number generator
- // don't seed a given random number generator
- explicit basic_random_generator(UniformRandomNumberGenerator& gen)
- : pURNG(&gen, null_deleter())
- , generator
- ( pURNG.get()
- , distribution_type
- ( (std::numeric_limits<unsigned long>::min)()
- , (std::numeric_limits<unsigned long>::max)()
- )
- )
- {}
-
- // keep a pointer to a random number generator
- // don't seed a given random number generator
- explicit basic_random_generator(UniformRandomNumberGenerator* pGen)
- : pURNG(pGen, null_deleter())
- , generator
- ( pURNG.get()
- , distribution_type
- ( (std::numeric_limits<unsigned long>::min)()
- , (std::numeric_limits<unsigned long>::max)()
- )
- )
- {
- BOOST_ASSERT(pURNG);
- }
-
- uuid operator()()
- {
- uuid u;
-
- int i=0;
- unsigned long random_value = generator();
- for (uuid::iterator it=u.begin(); it!=u.end(); ++it, ++i) {
- if (i==sizeof(unsigned long)) {
- random_value = generator();
- }
-
- *it = ((random_value >> (i*8)) & 0xFF);
- }
-
- // set variant
- // must be 0b10xxxxxx
- *(u.begin()+8) &= 0xBF;
- *(u.begin()+8) |= 0x80;
-
- // set version
- // must be 0b0100xxxx
- *(u.begin()+6) &= 0x4F; //0b01001111
- *(u.begin()+6) |= 0x40; //0b01000000
-
- return u;
- }
-
-private:
- shared_ptr<UniformRandomNumberGenerator> pURNG;
- generator_type generator;
-};
-
-typedef basic_random_generator<mt19937> random_generator;
-
-//TODO add native_generator
-
-}} //namespace boost::uuids
+#include <boost/uuid/nil_generator.hpp>
+#include <boost/uuid/string_generator.hpp>
+#include <boost/uuid/name_generator.hpp>
+#include <boost/uuid/random_generator.hpp>
 
 #endif //BOOST_UUID_GENERATORS_HPP

Modified: trunk/libs/uuid/test/Jamfile.v2
==============================================================================
--- trunk/libs/uuid/test/Jamfile.v2 (original)
+++ trunk/libs/uuid/test/Jamfile.v2 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -5,54 +5,51 @@
 
 import testing ;
 
-{
- test-suite uuid :
- # make sure uuid.hpp is self-contained
- [ compile compile_uuid_h.cpp ]
-
- # make sure uuid_io.hpp is self-contained
- [ compile compile_uuid_io_h.cpp ]
-
- # make sure uuid_serialize.hpp is self-contained
- [ compile compile_uuid_serialize_h.cpp ]
-
- # make sure uuid_generators.hpp is self-contained
- [ compile compile_uuid_generators_h.cpp ]
-
- # I want to look for issues when multiple translation units include
- # uuid header files. For example missing inline on non-template functions
- #[ link test_uuid.cpp compile_uuid_h.cpp : : multiple_translation_units ]
-
- # main test - added compile_uuid_header.cpp in lue of above test
- [ run test_uuid.cpp compile_uuid_h.cpp ]
-
- # test inclucing all .hpp files in 2 translations units
- # to make sure a inline state is not missing
- [ run test_include1.cpp test_include2.cpp ]
-
- # test uuid_io.hpp
- [ run test_io.cpp ]
-
- # test uuid_generators.hpp
- [ run test_generators.cpp ]
-
- # test tagging an object
- [ run test_tagging.cpp ]
-
- # test uuid class
- [ run test_uuid_class.cpp ]
-
- # test serializing uuids
- [ run test_serialization.cpp ../../serialization/build//boost_serialization
- ]
- # TODO - This test fails to like with boost_wserialization
- #[ run test_wserialization.cpp
- # ../../serialization/build//boost_serialization
- # ../../serialization/build//boost_wserialization
- # : : : <dependency>../../config/test/all//BOOST_NO_STD_WSTREAMBUF
- #]
-
- # test sha1 hash function
- [ run test_sha1.cpp ]
- ;
-}
+test-suite uuid :
+ # make sure each header file is self-contained
+ [ compile compile_uuid.cpp ]
+ [ compile compile_uuid_io.cpp ]
+ [ compile compile_uuid_serialize.cpp ]
+ [ compile compile_uuid_generators.cpp ]
+ [ compile compile_nil_generator.cpp ]
+ [ compile compile_name_generator.cpp ]
+ [ compile compile_string_generator.cpp ]
+ [ compile compile_random_generator.cpp ]
+
+ # test inclucing all .hpp files in 2 translations units
+ # to look for issues when using multiple translation units
+ # eg. missing inline on a global functionstate is not missing
+ [ run test_include1.cpp test_include2.cpp ]
+
+ # main test
+ [ run test_uuid.cpp ]
+
+ # test uuid_io.hpp
+ [ run test_io.cpp ]
+
+ # test generators
+ [ run test_nil_generator.cpp ]
+ [ run test_name_generator.cpp ]
+ [ run test_string_generator.cpp ]
+ [ run test_random_generator.cpp ]
+
+ # test tagging an object
+ [ run test_tagging.cpp ]
+
+ # test uuid class
+ [ run test_uuid_class.cpp ]
+
+ # test serializing uuids
+ [ run test_serialization.cpp ../../serialization/build//boost_serialization
+ ]
+ # TODO - This test fails to like with boost_wserialization
+ #[ run test_wserialization.cpp
+ # ../../serialization/build//boost_serialization
+ # ../../serialization/build//boost_wserialization
+ # : : : <dependency>../../config/test/all//BOOST_NO_STD_WSTREAMBUF
+ #]
+
+ # test sha1 hash function
+ [ run test_sha1.cpp ]
+ ;
+

Added: trunk/libs/uuid/test/compile_name_generator.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/compile_name_generator.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,13 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to make sure that a translation unit consisting of just the contents
+// of the header file will compile successfully.
+
+#include <boost/uuid/name_generator.hpp>

Added: trunk/libs/uuid/test/compile_nil_generator.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/compile_nil_generator.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,13 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to make sure that a translation unit consisting of just the contents
+// of the header file will compile successfully.
+
+#include <boost/uuid/nil_generator.hpp>

Added: trunk/libs/uuid/test/compile_random_generator.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/compile_random_generator.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,13 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to make sure that a translation unit consisting of just the contents
+// of the header file will compile successfully.
+
+#include <boost/uuid/random_generator.hpp>

Added: trunk/libs/uuid/test/compile_string_generator.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/compile_string_generator.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,13 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to make sure that a translation unit consisting of just the contents
+// of the header file will compile successfully.
+
+#include <boost/uuid/string_generator.hpp>

Added: trunk/libs/uuid/test/compile_uuid.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/compile_uuid.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,13 @@
+// (C) Copyright Andy Tompkins 2008. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to make sure that a translation unit consisting of just the contents
+// of the header file will compile successfully.
+
+#include <boost/uuid/uuid.hpp>

Added: trunk/libs/uuid/test/compile_uuid_generators.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/compile_uuid_generators.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,13 @@
+// (C) Copyright Andy Tompkins 2008. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to make sure that a translation unit consisting of just the contents
+// of the header file will compile successfully.
+
+#include <boost/uuid/uuid_generators.hpp>

Added: trunk/libs/uuid/test/compile_uuid_io.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/compile_uuid_io.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,13 @@
+// (C) Copyright Andy Tompkins 2008. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to make sure that a translation unit consisting of just the contents
+// of the header file will compile successfully.
+
+#include <boost/uuid/uuid_io.hpp>

Added: trunk/libs/uuid/test/compile_uuid_serialize.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/compile_uuid_serialize.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,13 @@
+// (C) Copyright Andy Tompkins 2008. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to make sure that a translation unit consisting of just the contents
+// of the header file will compile successfully.
+
+#include <boost/uuid/uuid_serialize.hpp>

Added: trunk/libs/uuid/test/lightweight_test_ex.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/lightweight_test_ex.hpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,40 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// libs/uuid/test/lightweight_test_ex.hpp -------------------------------//
+
+// BOOST_TEST_NE(expr1, expr2)
+
+#ifndef BOOST_UUID_TEST_LIGHTWEIGHT_TEST_EX_HPP
+#define BOOST_UUID_TEST_LIGHTWEIGHT_TEST_EX_HPP
+
+#include <boost/detail/lightweight_test.hpp>
+
+namespace boost {
+namespace detail {
+
+template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u )
+{
+ if( t != u )
+ {
+ }
+ else
+ {
+ std::cerr << file << "(" << line << "): test '" << expr1 << " != " << expr2
+ << "' failed in function '" << function << "': "
+ << "'" << t << "' == '" << u << "'" << std::endl;
+ ++test_errors();
+ }
+}
+
+}} // namespace boost::detail
+
+#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
+
+#endif //BOOST_UUID_TEST_LIGHTWEIGHT_TEST_EX_HPP

Modified: trunk/libs/uuid/test/test_include1.cpp
==============================================================================
--- trunk/libs/uuid/test/test_include1.cpp (original)
+++ trunk/libs/uuid/test/test_include1.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -9,15 +9,16 @@
 
 // libs/uuid/test/test_include1.cpp -------------------------------//
 
-#include <boost/test/included/test_exec_monitor.hpp>
-//#include <boost/test/test_tools.hpp>
-
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_io.hpp>
-#include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_serialize.hpp>
+#include <boost/uuid/uuid_generators.hpp>
+#include <boost/uuid/nil_generator.hpp>
+#include <boost/uuid/name_generator.hpp>
+#include <boost/uuid/string_generator.hpp>
+#include <boost/uuid/random_generator.hpp>
 
-int test_main(int, char*[])
+int main(int, char*[])
 {
     return 0;
 }

Modified: trunk/libs/uuid/test/test_include2.cpp
==============================================================================
--- trunk/libs/uuid/test/test_include2.cpp (original)
+++ trunk/libs/uuid/test/test_include2.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -13,3 +13,7 @@
 #include <boost/uuid/uuid_io.hpp>
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_serialize.hpp>
+#include <boost/uuid/nil_generator.hpp>
+#include <boost/uuid/name_generator.hpp>
+#include <boost/uuid/string_generator.hpp>
+#include <boost/uuid/random_generator.hpp>

Modified: trunk/libs/uuid/test/test_io.cpp
==============================================================================
--- trunk/libs/uuid/test/test_io.cpp (original)
+++ trunk/libs/uuid/test/test_io.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -11,39 +11,31 @@
 
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_io.hpp>
-
-#include <boost/test/included/test_exec_monitor.hpp>
-#include <boost/test/test_tools.hpp>
-#include <boost/test/output_test_stream.hpp>
+#include <boost/detail/lightweight_test.hpp>
 
 #include <boost/lexical_cast.hpp>
 #include <string>
 
-int test_main(int, char*[])
+int main(int, char*[])
 {
     using namespace boost::uuids;
- using boost::test_tools::output_test_stream;
 
     const uuid u1 = {{0}};
     const uuid u2 = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}};
     const uuid u3 = {{0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef,0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef}};
 
     { // test insert/extract operators
- output_test_stream output;
- output << u1;
- BOOST_CHECK(!output.is_empty(false));
- BOOST_CHECK(output.check_length(36, false));
- BOOST_CHECK(output.is_equal("00000000-0000-0000-0000-000000000000"));
-
- output << u2;
- BOOST_CHECK(!output.is_empty(false));
- BOOST_CHECK(output.check_length(36, false));
- BOOST_CHECK(output.is_equal("00010203-0405-0607-0809-0a0b0c0d0e0f"));
-
- output << u3;
- BOOST_CHECK(!output.is_empty(false));
- BOOST_CHECK(output.check_length(36, false));
- BOOST_CHECK(output.is_equal("12345678-90ab-cdef-1234-567890abcdef"));
+ std::stringstream ss1;
+ ss1 << u1;
+ BOOST_TEST_EQ(ss1.str(), "00000000-0000-0000-0000-000000000000");
+
+ std::stringstream ss2;
+ ss2 << u2;
+ BOOST_TEST_EQ(ss2.str(), "00010203-0405-0607-0809-0a0b0c0d0e0f");
+
+ std::stringstream ss3;
+ ss3 << u3;
+ BOOST_TEST_EQ(ss3.str(), "12345678-90ab-cdef-1234-567890abcdef");
     }
 
     {
@@ -52,20 +44,20 @@
         std::stringstream ss;
         ss << "00000000-0000-0000-0000-000000000000";
         ss >> u;
- BOOST_CHECK_EQUAL(u, u1);
+ BOOST_TEST_EQ(u, u1);
 
         ss << "12345678-90ab-cdef-1234-567890abcdef";
         ss >> u;
- BOOST_CHECK_EQUAL(u, u3);
+ BOOST_TEST_EQ(u, u3);
     }
 
     { // test with lexical_cast
- BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(u1), std::string("00000000-0000-0000-0000-000000000000"));
- BOOST_CHECK_EQUAL(boost::lexical_cast<uuid>("00000000-0000-0000-0000-000000000000"), u1);
+ BOOST_TEST_EQ(boost::lexical_cast<std::string>(u1), std::string("00000000-0000-0000-0000-000000000000"));
+ BOOST_TEST_EQ(boost::lexical_cast<uuid>("00000000-0000-0000-0000-000000000000"), u1);
 
- BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(u3), std::string("12345678-90ab-cdef-1234-567890abcdef"));
- BOOST_CHECK_EQUAL(boost::lexical_cast<uuid>("12345678-90ab-cdef-1234-567890abcdef"), u3);
+ BOOST_TEST_EQ(boost::lexical_cast<std::string>(u3), std::string("12345678-90ab-cdef-1234-567890abcdef"));
+ BOOST_TEST_EQ(boost::lexical_cast<uuid>("12345678-90ab-cdef-1234-567890abcdef"), u3);
     }
 
- return 0;
+ return boost::report_errors();
 }

Added: trunk/libs/uuid/test/test_name_generator.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/test_name_generator.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,49 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// libs/uuid/test/test_name_generator.cpp -------------------------------//
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_io.hpp>
+#include <boost/uuid/name_generator.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main(int, char*[])
+{
+ using namespace boost::uuids;
+
+ uuid dns_namespace_uuid = {{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}};
+ uuid correct = {{0x21, 0xf7, 0xf8, 0xde, 0x80, 0x51, 0x5b, 0x89, 0x86, 0x80, 0x01, 0x95, 0xef, 0x79, 0x8b, 0x6a}};
+ uuid wcorrect = {{0xb9, 0x50, 0x66, 0x13, 0x2c, 0x04, 0x51, 0x2d, 0xb8, 0xfe, 0xbf, 0x8d, 0x0b, 0xa1, 0xb2, 0x71}};
+
+ name_generator gen(dns_namespace_uuid);
+
+ uuid u = gen("www.widgets.com");
+ BOOST_TEST_EQ(u, correct);
+ BOOST_TEST_EQ(u.variant(), boost::uuids::uuid::variant_rfc_4122);
+
+ u = gen(L"www.widgets.com");
+ BOOST_TEST_EQ(u, wcorrect);
+ BOOST_TEST_EQ(u.variant(), boost::uuids::uuid::variant_rfc_4122);
+
+ u = gen(std::string("www.widgets.com"));
+ BOOST_TEST_EQ(u, correct);
+ BOOST_TEST_EQ(u.variant(), boost::uuids::uuid::variant_rfc_4122);
+
+ u = gen(std::wstring(L"www.widgets.com"));
+ BOOST_TEST_EQ(u, wcorrect);
+ BOOST_TEST_EQ(u.variant(), boost::uuids::uuid::variant_rfc_4122);
+
+ char name[] = "www.widgets.com";
+ u = gen(name, 15);
+ BOOST_TEST_EQ(u, correct);
+ BOOST_TEST_EQ(u.variant(), boost::uuids::uuid::variant_rfc_4122);
+
+ return boost::report_errors();
+}

Added: trunk/libs/uuid/test/test_nil_generator.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/test_nil_generator.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,29 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// libs/uuid/test/test_nil_generator.cpp -------------------------------//
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_io.hpp>
+#include <boost/uuid/nil_generator.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main(int, char*[])
+{
+ using namespace boost::uuids;
+
+ uuid u1 = nil_generator()();
+ uuid u2 = {{0}};
+ BOOST_TEST_EQ(u1, u2);
+
+ uuid u3 = nil_uuid();
+ BOOST_TEST_EQ(u3, u2);
+
+ return boost::report_errors();
+}

Added: trunk/libs/uuid/test/test_random_generator.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/test_random_generator.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,61 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// libs/uuid/test/test_random_generator.cpp -------------------------------//
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/random_generator.hpp>
+#include <boost/uuid/uuid_io.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test_ex.hpp"
+#include <boost/random.hpp>
+
+template <typename RandomUuidGenerator>
+void check_random_generator(RandomUuidGenerator& uuid_gen)
+{
+ boost::uuids::uuid u1 = uuid_gen();
+ boost::uuids::uuid u2 = uuid_gen();
+
+ BOOST_TEST_NE(u1, u2);
+
+ // check variant
+ BOOST_TEST_EQ(u1.variant(), boost::uuids::uuid::variant_rfc_4122);
+
+ // version
+ BOOST_TEST_EQ(u1.version(), boost::uuids::uuid::version_random_number_based);
+}
+
+int main(int, char*[])
+{
+ using namespace boost::uuids;
+
+ // default random number generator
+ random_generator uuid_gen1;
+ check_random_generator(uuid_gen1);
+
+ // specific random number generator
+ basic_random_generator<boost::rand48> uuid_gen2;
+ check_random_generator(uuid_gen2);
+
+ // pass by reference
+ boost::ecuyer1988 ecuyer1988_gen;
+ basic_random_generator<boost::ecuyer1988> uuid_gen3(ecuyer1988_gen);
+ check_random_generator(uuid_gen3);
+
+ // pass by pointer
+ boost::lagged_fibonacci607 lagged_fibonacci607_gen;
+ basic_random_generator<boost::lagged_fibonacci607> uuid_gen4(&lagged_fibonacci607_gen);
+ check_random_generator(uuid_gen4);
+
+ // random device
+ //basic_random_generator<boost::random_device> uuid_gen5;
+ //check_random_generator(uuid_gen5);
+
+ return boost::report_errors();
+}

Modified: trunk/libs/uuid/test/test_serialization.cpp
==============================================================================
--- trunk/libs/uuid/test/test_serialization.cpp (original)
+++ trunk/libs/uuid/test/test_serialization.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -9,8 +9,7 @@
 
 // Purpose to test serializing uuids with narrow archives
 
-#include <boost/test/included/test_exec_monitor.hpp>
-#include <boost/test/test_tools.hpp>
+#include <boost/detail/lightweight_test.hpp>
 #include <sstream>
 #include <iostream>
 
@@ -56,10 +55,10 @@
         ia >> BOOST_SERIALIZATION_NVP(u2);
     }
     
- BOOST_CHECK_EQUAL(u1, u2);
+ BOOST_TEST_EQ(u1, u2);
 }
 
-int test_main( int /* argc */, char* /* argv */[] )
+int main( int /* argc */, char* /* argv */[] )
 {
     using namespace std;
     using namespace boost::archive;
@@ -68,5 +67,5 @@
     test_archive<xml_oarchive, xml_iarchive, ostringstream, istringstream>();
     test_archive<binary_oarchive, binary_iarchive, ostringstream, istringstream>();
 
- return 0;
+ return boost::report_errors();
 }

Modified: trunk/libs/uuid/test/test_sha1.cpp
==============================================================================
--- trunk/libs/uuid/test/test_sha1.cpp (original)
+++ trunk/libs/uuid/test/test_sha1.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -10,16 +10,12 @@
 // libs/uuid/test/test_sha1.cpp -------------------------------//
 
 #include <boost/uuid/sha1.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test_ex.hpp"
 #include <algorithm>
 #include <cstring>
 #include <cstddef>
 
-#define BOOST_TEST_MAIN
-#include <boost/test/included/unit_test.hpp>
-
-#define BOOST_AUTO_TEST_MAIN
-#include <boost/test/auto_unit_test.hpp>
-
 #ifdef BOOST_NO_STDC_NAMESPACE
 namespace std {
   using ::strlen;
@@ -27,18 +23,49 @@
 } //namespace std
 #endif
 
+// this is to just make using BOOST_TEST_EQ easier
+struct digest_type {
+ digest_type() {}
+ digest_type(const unsigned int (d)[5]) {
+ for (size_t i=0; i<5; ++i) {
+ digest[i] = d[i];
+ }
+ }
+ unsigned int digest[5];
+};
+bool operator==(digest_type const& lhs, digest_type const& rhs)
+{
+ for (size_t i=0; i<5; ++i) {
+ if (lhs.digest[i] != rhs.digest[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+template <typename ch, typename char_traits>
+std::basic_ostream<ch, char_traits>& operator<<(std::basic_ostream<ch, char_traits> &os, digest_type const& d)
+{
+ os << "{";
+ for (size_t i=0; i<5; ++i) {
+ os.setf(std::ios_base::hex);
+ os << d.digest[i];
+ }
+ os << "}";
+ return os;
+}
+
 void test_sha1(char const*const message, unsigned int length, const unsigned int (&correct_digest)[5])
 {
     boost::uuids::detail::sha1 sha;
     sha.process_bytes(message, length);
 
- unsigned int digest[5];
- sha.get_digest(digest);
+ digest_type digest;
+ sha.get_digest(digest.digest);
 
- BOOST_CHECK_EQUAL_COLLECTIONS(digest, digest+5, correct_digest, correct_digest+5);
+ BOOST_TEST_EQ(digest, digest_type(correct_digest));
 }
 
-BOOST_AUTO_TEST_CASE(test_quick)
+void test_quick()
 {
     struct test_case
     {
@@ -64,7 +91,7 @@
 //http://csrc.nist.gov/cryptval/shs.htm
 //http://csrc.nist.gov/cryptval/shs/shabytetestvectors.zip
 //values from SHA1ShortMsg.txt
-BOOST_AUTO_TEST_CASE(test_short_messages)
+void test_short_messages()
 {
     struct test_case
     {
@@ -212,18 +239,18 @@
 
         boost::uuids::detail::sha1 sha;
         std::size_t message_length = std::strlen(tc.message);
- BOOST_CHECK_EQUAL(message_length%2, 0u);
+ BOOST_TEST_EQ(message_length%2, 0u);
 
         for (std::size_t b=0; b!=message_length; b+=2) {
             char c = tc.message[b];
             char const* f = std::find(xdigits, xdigits_end, c);
- BOOST_CHECK(f != xdigits_end);
+ BOOST_TEST_NE(f, xdigits_end);
             
             unsigned char byte = static_cast<unsigned char>(std::distance(&xdigits[0], f));
 
             c = tc.message[b+1];
             f = std::find(xdigits, xdigits_end, c);
- BOOST_CHECK(f != xdigits_end);
+ BOOST_TEST_NE(f, xdigits_end);
 
             byte <<= 4;
             byte |= static_cast<unsigned char>(std::distance(&xdigits[0], f));
@@ -231,9 +258,17 @@
             sha.process_byte(byte);
         }
 
- unsigned int digest[5];
- sha.get_digest(digest);
+ digest_type digest;
+ sha.get_digest(digest.digest);
 
- BOOST_CHECK_EQUAL_COLLECTIONS(digest, digest+5, tc.digest, tc.digest+5);
+ BOOST_TEST_EQ(digest, digest_type(tc.digest));
     }
 }
+
+int main(int, char*[])
+{
+ test_quick();
+ test_short_messages();
+
+ return boost::report_errors();
+}
\ No newline at end of file

Added: trunk/libs/uuid/test/test_string_generator.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/uuid/test/test_string_generator.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -0,0 +1,58 @@
+// (C) Copyright Andy Tompkins 2010. Permission to copy, use, modify, sell and
+// distribute this software is granted provided this copyright notice appears
+// in all copies. This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// libs/uuid/test/test_string_generator.cpp -------------------------------//
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_io.hpp>
+#include <boost/uuid/string_generator.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/config.hpp>
+#include <string>
+
+int main(int, char*[])
+{
+ using namespace boost::uuids;
+
+ uuid nil_uuid = {{0}};
+ BOOST_TEST_EQ(nil_uuid.is_nil(), true);
+
+ string_generator gen;
+ uuid u = gen("00000000-0000-0000-0000-000000000000");
+ BOOST_TEST_EQ(u, nil_uuid);
+ BOOST_TEST_EQ(u.is_nil(), true);
+
+ const uuid u_increasing = {{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }};
+ const uuid u_decreasing = {{ 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }};
+
+ u = gen("0123456789abcdef0123456789ABCDEF");
+ BOOST_TEST_EQ(u, u_increasing);
+
+ u = gen("{0123456789abcdef0123456789ABCDEF}");
+ BOOST_TEST_EQ(u, u_increasing);
+
+ u = gen("{01234567-89AB-CDEF-0123-456789abcdef}");
+ BOOST_TEST_EQ(u, u_increasing);
+
+ u = gen("01234567-89AB-CDEF-0123-456789abcdef");
+ BOOST_TEST_EQ(u, u_increasing);
+
+ u = gen(std::string("fedcba98-7654-3210-fedc-ba9876543210"));
+ BOOST_TEST_EQ(u, u_decreasing);
+
+#ifndef BOOST_NO_STD_WSTRING
+ u = gen(L"fedcba98-7654-3210-fedc-ba9876543210");
+ BOOST_TEST_EQ(u, u_decreasing);
+
+ u = gen(std::wstring(L"01234567-89ab-cdef-0123-456789abcdef"));
+ BOOST_TEST_EQ(u, u_increasing);
+#endif //BOOST_NO_STD_WSTRING
+
+ return boost::report_errors();
+}

Modified: trunk/libs/uuid/test/test_tagging.cpp
==============================================================================
--- trunk/libs/uuid/test/test_tagging.cpp (original)
+++ trunk/libs/uuid/test/test_tagging.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -11,9 +11,8 @@
 
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_generators.hpp>
-
-#include <boost/test/included/test_exec_monitor.hpp>
-#include <boost/test/test_tools.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test_ex.hpp"
 
 class object
 {
@@ -22,7 +21,7 @@
         : tag(boost::uuids::random_generator()())
         , state(0)
     {}
-
+
     explicit object(int state)
         : tag(boost::uuids::random_generator()())
         , state(state)
@@ -36,6 +35,9 @@
     bool operator==(object const& rhs) const {
         return tag == rhs.tag;
     }
+ bool operator!=(object const& rhs) const {
+ return !(operator==(rhs));
+ }
     
     object& operator=(object const& rhs) {
         tag = rhs.tag;
@@ -59,23 +61,21 @@
     return os;
 }
 
-int test_main(int, char*[])
+int main(int, char*[])
 {
- //using boost::test_tools::output_test_stream;
-
     object o1(1);
 
     object o2 = o1;
- BOOST_CHECK_EQUAL(o1, o2);
+ BOOST_TEST_EQ(o1, o2);
 
     o2.set_state(2);
- BOOST_CHECK_EQUAL(o1, o2);
+ BOOST_TEST_EQ(o1, o2);
     
     object o3;
     o3.set_state(3);
 
- BOOST_CHECK_NE(o1, o3);
- BOOST_CHECK_NE(o2, o3);
+ BOOST_TEST_NE(o1, o3);
+ BOOST_TEST_NE(o2, o3);
     
- return 0;
+ return boost::report_errors();
 }

Modified: trunk/libs/uuid/test/test_uuid.cpp
==============================================================================
--- trunk/libs/uuid/test/test_uuid.cpp (original)
+++ trunk/libs/uuid/test/test_uuid.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -10,51 +10,70 @@
 // libs/uuid/test/test_uuid.cpp -------------------------------//
 
 #include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_io.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test_ex.hpp"
+#include <boost/functional/hash.hpp>
+#include <boost/current_function.hpp>
 
-#include <boost/test/included/test_exec_monitor.hpp>
-#include <boost/test/test_tools.hpp>
+void test_uuid_equal_array(char const * file, int line, char const * function,
+ boost::uuids::uuid const& lhs, const unsigned char (&rhs)[16])
+{
+ for (size_t i=0; i<16; i++) {
+ if ( *(lhs.begin()+i) != rhs[i]) {
+ std::cerr << file << "(" << line << "): uuid " << lhs << " not equal " << "{";
+ for (size_t j=0; j<16; j++) {
+ if (j != 0) {
+ std::cerr << " ";
+ }
+ std::cerr << std::hex << (int)rhs[j];
+ }
+ std::cerr << "} in function '" << function << "'" << std::endl;
+ ++boost::detail::test_errors();
+ return;
+ }
+ }
+}
 
-#include <boost/functional/hash.hpp>
 
-#include <boost/uuid/uuid_io.hpp>
+#define BOOST_TEST_UUID(lhs, rhs) ( test_uuid_equal_array(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, lhs, rhs) )
 
-int test_main(int, char*[])
+int main(int, char*[])
 {
     using namespace boost::uuids;
- using boost::test_tools::output_test_stream;
 
     // uuid::static_size
- BOOST_CHECK_EQUAL(uuid::static_size(), 16U);
+ BOOST_TEST_EQ(uuid::static_size(), 16U);
 
     { // uuid::operator=()
         uuid u1 = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}};
         uuid u2 = u1;
- BOOST_CHECK_EQUAL(u2, u1);
+ BOOST_TEST_EQ(u2, u1);
     }
 
     { // uuid::begin(), end()
         uuid u = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}};
         unsigned char values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- BOOST_CHECK_EQUAL_COLLECTIONS(u.begin(), u.end(), values, values+16);
+ BOOST_TEST_UUID(u, values);
     }
 
     { // uuid::begin() const, end() const
         const uuid u = {{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}};
         unsigned char values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- BOOST_CHECK_EQUAL_COLLECTIONS(u.begin(), u.end(), values, values+16);
+ BOOST_TEST_UUID(u, values);
     }
     
      { // uuid::size()
         uuid u; // uninitialized
- BOOST_CHECK_EQUAL(u.size(), 16U);
+ BOOST_TEST_EQ(u.size(), 16U);
     }
 
     { // uuid::is_nil()
         uuid u1 = {{0}};
- BOOST_CHECK_EQUAL(u1.is_nil(), true);
+ BOOST_TEST_EQ(u1.is_nil(), true);
 
         uuid u2 = {{1,0}};
- BOOST_CHECK_EQUAL(u2.is_nil(), false);
+ BOOST_TEST_EQ(u2.is_nil(), false);
     }
     
     { // uuid::variant()
@@ -84,7 +103,7 @@
             uuid u = {};
             u.data[8] = tests[i].octet7; // note that octet7 is array index 8
             
- BOOST_CHECK_EQUAL(u.variant(), tests[i].variant);
+ BOOST_TEST_EQ(u.variant(), tests[i].variant);
         }
     }
     
@@ -115,7 +134,7 @@
             uuid u = {{0}};
             u.data[6] = tests[i].octet9; // note that octet9 is array index 8
             
- BOOST_CHECK_EQUAL(u.version(), tests[i].version);
+ BOOST_TEST_EQ(u.version(), tests[i].version);
         }
     }
 
@@ -126,12 +145,12 @@
         
         unsigned char values1[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
         unsigned char values2[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
- BOOST_CHECK_EQUAL_COLLECTIONS(u1.begin(), u1.end(), values2, values2+16);
- BOOST_CHECK_EQUAL_COLLECTIONS(u2.begin(), u2.end(), values1, values1+16);
+ BOOST_TEST_UUID(u1, values2);
+ BOOST_TEST_UUID(u2, values1);
 
         swap(u1, u2);
- BOOST_CHECK_EQUAL_COLLECTIONS(u1.begin(), u1.end(), values1, values1+16);
- BOOST_CHECK_EQUAL_COLLECTIONS(u2.begin(), u2.end(), values2, values2+16);
+ BOOST_TEST_UUID(u1, values1);
+ BOOST_TEST_UUID(u2, values2);
     }
 
     { // test comparsion
@@ -139,25 +158,25 @@
         uuid u2 = {{1,0}};
         uuid u3 = {{255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}};
 
- BOOST_CHECK_EQUAL(u1, u1);
+ BOOST_TEST_EQ(u1, u1);
 
- BOOST_CHECK_NE(u1, u2);
+ BOOST_TEST_NE(u1, u2);
    
- BOOST_CHECK_LT(u1, u2);
- BOOST_CHECK_LT(u2, u3);
+ BOOST_TEST(u1 < u2);
+ BOOST_TEST(u2 < u3);
 
- BOOST_CHECK_LE(u1, u1);
- BOOST_CHECK_LE(u1, u2);
- BOOST_CHECK_LE(u2, u3);
-
- BOOST_CHECK_GT(u2, u1);
- BOOST_CHECK_GT(u3, u1);
-
- BOOST_CHECK_GE(u3, u3);
- BOOST_CHECK_GE(u2, u1);
- BOOST_CHECK_GE(u3, u1);
+ BOOST_TEST(u1 <= u1);
+ BOOST_TEST(u1 <= u2);
+ BOOST_TEST(u2 <= u3);
+
+ BOOST_TEST(u2 >= u1);
+ BOOST_TEST(u3 >= u1);
+
+ BOOST_TEST(u3 >= u3);
+ BOOST_TEST(u2 >= u1);
+ BOOST_TEST(u3 >= u1);
     }
-
+
     { // test hash
         uuid u1 = {{0}};
         uuid u2 = {{1,0}};
@@ -165,14 +184,14 @@
 
         boost::hash<uuid> uuid_hasher;
         
- BOOST_CHECK_EQUAL(uuid_hasher(u1), boost::hash_range(u1.begin(), u1.end()));
- BOOST_CHECK_EQUAL(uuid_hasher(u2), boost::hash_range(u2.begin(), u2.end()));
- BOOST_CHECK_EQUAL(uuid_hasher(u3), boost::hash_range(u3.begin(), u3.end()));
+ BOOST_TEST_EQ(uuid_hasher(u1), boost::hash_range(u1.begin(), u1.end()));
+ BOOST_TEST_EQ(uuid_hasher(u2), boost::hash_range(u2.begin(), u2.end()));
+ BOOST_TEST_EQ(uuid_hasher(u3), boost::hash_range(u3.begin(), u3.end()));
     }
     
     { // test is_pod
- BOOST_CHECK_EQUAL(boost::is_pod<uuid>::value, true);
+ BOOST_TEST_EQ(boost::is_pod<uuid>::value, true);
     }
 
- return 0;
+ return boost::report_errors();
 }

Modified: trunk/libs/uuid/test/test_uuid_class.cpp
==============================================================================
--- trunk/libs/uuid/test/test_uuid_class.cpp (original)
+++ trunk/libs/uuid/test/test_uuid_class.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -13,8 +13,8 @@
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_io.hpp>
 
-#include <boost/test/included/test_exec_monitor.hpp>
-#include <boost/test/test_tools.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include "lightweight_test_ex.hpp"
 
 class uuid_class : public boost::uuids::uuid
 {
@@ -28,16 +28,16 @@
     {}
 };
 
-int test_main(int, char*[])
+int main(int, char*[])
 {
     uuid_class u1;
     uuid_class u2;
- BOOST_CHECK_NE(u1, u2);
- BOOST_CHECK_EQUAL(u1.is_nil(), false);
- BOOST_CHECK_EQUAL(u2.is_nil(), false);
+ BOOST_TEST_NE(u1, u2);
+ BOOST_TEST_EQ(u1.is_nil(), false);
+ BOOST_TEST_EQ(u2.is_nil(), false);
 
     u2 = u1;
- BOOST_CHECK_EQUAL(u1, u2);
+ BOOST_TEST_EQ(u1, u2);
 
- return 0;
+ return boost::report_errors();
 }

Modified: trunk/libs/uuid/test/test_wserialization.cpp
==============================================================================
--- trunk/libs/uuid/test/test_wserialization.cpp (original)
+++ trunk/libs/uuid/test/test_wserialization.cpp 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -9,8 +9,7 @@
 
 // Purpose to test serializing uuids with wide stream archives
 
-#include <boost/test/included/test_exec_monitor.hpp>
-#include <boost/test/test_tools.hpp>
+#include <boost/detail/lightweight_test.hpp>
 #include <sstream>
 #include <iostream>
 
@@ -56,7 +55,7 @@
         ia >> BOOST_SERIALIZATION_NVP(u2);
     }
     
- BOOST_CHECK_EQUAL(u1, u2);
+ BOOST_TEST_EQ(u1, u2);
 }
 
 int test_main( int /* argc */, char* /* argv */[] )
@@ -68,5 +67,5 @@
     test_archive<xml_woarchive, xml_wiarchive, wostringstream, wistringstream>();
     test_archive<binary_woarchive, binary_wiarchive, wostringstream, wistringstream>();
 
- return 0;
+ return report_errors();
 }

Modified: trunk/libs/uuid/uuid.html
==============================================================================
--- trunk/libs/uuid/uuid.html (original)
+++ trunk/libs/uuid/uuid.html 2010-02-06 17:32:49 EST (Sat, 06 Feb 2010)
@@ -9,7 +9,7 @@
 <body>
 <h1><img src="../../boost.png" alt="Boost" WIDTH="277" HEIGHT="86">Uuid</h1>
 
-<h2><a name="Contents"></a>Contents</h2>
+<h2><a name="Contents">Contents</a></h2>
 
 <ol>
     <li>Introduction</li>
@@ -36,9 +36,25 @@
         <li>boost/uuid/uuid_generators.hpp</li>
         <ul>
             <li>Synopsis</li>
+ </ul>
+ <li>boost/uuid/nil_generator.hpp</li>
+ <ul>
+ <li>Synopsis</li>
             <li>Nil Generator</li>
+ </ul>
+ <li>boost/uuid/string_generator.hpp</li>
+ <ul>
+ <li>Synopsis</li>
             <li>String Generator</li>
+ </ul>
+ <li>boost/uuid/name_generator.hpp</li>
+ <ul>
+ <li>Synopsis</li>
             <li>Name Generator</li>
+ </ul>
+ <li>boost/uuid/random_generator.hpp</li>
+ <ul>
+ <li>Synopsis</li>
             <li>Random Generator</li>
         </ul>
         <li>boost/uuid/uuid_io.hpp</li>
@@ -56,7 +72,7 @@
     <li>History and Acknowledgements</li>
 </ol>
 
-<h2><a name="Introduction"></a>Introduction</h2>
+<h2><a name="Introduction">Introduction</a></h2>
 <p>
 A UUID, or Universally unique identifier, is intended to uniquely identify
 information in a distributed environment without significant central
@@ -86,8 +102,8 @@
 never be generated again), or it is extremely likely to be unique (depending
 on the mechanism).
 
-<h2><a name="Examples"></a>Examples</h2>
-<h3><a name="Tagging"></a>Tagging</h3>
+<h2><a name="Examples">Examples</a></h2>
+<h3><a name="Tagging">Tagging</a></h3>
 <pre>
 // example of tagging an object with a uuid
 // see boost/libs/uuid/test/test_tagging.cpp
@@ -141,7 +157,7 @@
 assert(o2 != o3);
 </pre>
 
-<h3><a name="POD Efficiencies"></a>POD Efficiencies</h3>
+<h3><a name="POD Efficiencies">POD Efficiencies</a></h3>
 <p>
 This library implements a UUID as a POD allowing a UUID
 to be used in the most efficient ways, including using memcpy,
@@ -207,7 +223,7 @@
 assert(u1 != u2);
 </pre>
 
-<h3><a name="Byte Extraction"></a>Byte Extraction</h3>
+<h3><a name="Byte Extraction">Byte Extraction</a></h3>
 <p>It is sometimes useful to get at the 16 bytes of a <b>uuid</b> directly.
 Typical use is as follows:
 
@@ -219,12 +235,10 @@
 
 <p>Note: <tt>boost::uuids::uuid::size()</tt> always returns 16.
 
-<h2><a name="Reference"></a>Reference</h2>
-<h3><a name="boost/uuid/uuid.hpp"</a>boost/uuid/uuid.hpp</h3>
-<h4><a name="Synopsis"</a>Synopsis</h4>
+<h2><a name="Reference">Reference</a></h2>
+<h3><a name="boost/uuid/uuid.hpp" href="./../../boost/uuid/uuid.hpp">boost/uuid/uuid.hpp</a></h3>
+<h4><a name="Synopsis">Synopsis</a></h4>
 <pre>
-#include &lt;boost/uuid/uuid.hpp&gt;
-
 namespace boost {
 namespace uuids {
 
@@ -289,7 +303,7 @@
 }} // namespace boost::uuids
 </pre>
 
-<h4><a name="Size"</a>Size</h4>
+<h4><a name="Size">Size</a></h4>
 
 <p>The size of a <b>uuid</b> (in bytes) can be obtained either by
 calling the function <tt>boost::uuids::uuid::size()</tt> or by
@@ -301,7 +315,7 @@
     assert(16 == boost::uuids::uuid::static_size());
 </pre>
 
-<h4><a name="Iteration"</a>Iteration</h4>
+<h4><a name="Iteration">Iteration</a></h4>
 
 <p>Both iterators and constant iterators are provided.
 <pre>
@@ -314,19 +328,19 @@
     }
 </pre>
 
-<h4><a name="Nil"></a>Nil uuid</h4>
+<h4><a name="Nil">Nil uuid</a></h4>
 <p>The function, <tt>boost::uuids::uuid::is_null()</tt> returns true if and
 only if the <b>uuid</b> is equal to {00000000-0000-0000-0000-000000000000}.
 </p>
 
-<h4><a name="Variant"></a>Variant</h4>
+<h4><a name="Variant">Variant</a></h4>
 <p>Three bits of a <b>uuid</b> determine the variant.</p>
 <pre>
     boost::uuids::uuid u;
     boost::uuids::uuid::variant_type v = u.variant();
 </pre>
 
-<h4><a name="Version"></a>Version</h4>
+<h4><a name="Version">Version</a></h4>
 <p>Four bits of a <b>uuid</b> determine the variant, that is the mechanism
 used to generate the <b>uuid</b>.
 </p>
@@ -335,7 +349,7 @@
     boost::uuids::uuid::version_type v = u.version();
 </pre>
 
-<h4><a name="Swap"></a>Swap</h4>
+<h4><a name="Swap">Swap</a></h4>
 <p>Both <tt>boost::uuids::uuid::swap()</tt> and <tt>boost::uuids::swap()</tt>
 are provided.
 </p>
@@ -345,7 +359,7 @@
     swap(u1, u2);
 </pre>
 
-<h4><a name="Operators"></a>Operators</h4>
+<h4><a name="Operators">Operators</a></h4>
 <p>
 All of the standard numeric operators are defined for the <b>uuid</b>
 class. These include:
@@ -358,7 +372,7 @@
     operator&gt;=
 </pre>
 
-<h4><a name="Hash"></a>Hash Function</h4>
+<h4><a name="Hash">Hash Function</a></h4>
 <p>
 This function allows <b>uuid</b>s to be used with
 <a href="http://www.boost.org/doc/html/hash.html"><b>boost::hash</b></a>
@@ -368,11 +382,19 @@
 std::size_t uuid_hash_value = uuid_hasher(boost::uuids::uuid());
 </pre>
 
-<h3><a name="boost/uuid/uuid_generators.hpp"</a>boost/uuid/uuid_generators.hpp</h3>
-<h4><a name="Synopsis_generators"</a>Synopsis</h4>
-<pre>
-#include &lt;boost/uuid/uuid_generators.hpp&gt;
+<h3><a name="boost/uuid/uuid_generators.hpp" href="./../../boost/uuid/uuid_generators.hpp">boost/uuid/uuid_generators.hpp</a></h3>
+<h4><a name="Synopsis_generators">Synopsis</a></h4>
+This file includes all the <b>uuid</b> generators for convenience.
+<pre>
+#include &lt;boost/uuid/nil_generator.hpp&gt;
+#include &lt;boost/uuid/string_generator.hpp&gt;
+#include &lt;boost/uuid/name_generator.hpp&gt;
+#include &lt;boost/uuid/random_generator.hpp&gt;
+</pre>
 
+<h3><a name="boost/uuid/nil_generator.hpp" href="./../../boost/uuid/nil_generator.hpp">boost/uuid/nil_generator.hpp</a></h3>
+<h4><a name="Synopsis_nil_generator">Synopsis</a></h4>
+<pre>
 namespace boost {
 namespace uuids {
 
@@ -383,6 +405,28 @@
 };
 uuid nil_uuid();
 
+}} //namespace boost::uuids
+</pre>
+
+<h4><a name="Nil Generator">Nil Generator</a></h4>
+<p>The <tt>boost::uuids::nil_generator</tt> class always generates a nil <b>uuid</b>.
+<pre>
+boost::uuids::nil_generator gen;
+boost::uuids::uuid u = gen();
+assert(u.is_nil() == true);
+
+// or for convenience
+boost::uuids::uuid u = boost::uuids::nil_uuid();
+assert(u.is_nil() == true);
+</pre>
+
+<h3><a name="boost/uuid/string_generator.hpp" href="./../../boost/uuid/string_generator.hpp">boost/uuid/string_generator.hpp</a></h3>
+<h4><a name="Synopsis_string_generator">Synopsis</a></h4>
+
+<pre>
+namespace boost {
+namespace uuids {
+
 struct string_generator {
     typedef uuid result_type;
 
@@ -390,6 +434,26 @@
         uuid operator()(std::basic_string&lt;ch, char_traits, alloc&gt; const&amp; s) const;
 };
 
+}} //namespace boost::uuids
+</pre>
+
+<h4><a name="String Generator">String Generator</a></h4>
+<p>The <tt>boost::uuids::string_generator</tt> class generates a <b>uuid</b> from a string.
+<pre>
+boost::uuids::string_generator gen;
+boost::uuids::uuid u1 = gen("{01234567-89ab-cdef-0123456789abcdef}");
+boost::uuids::uuid u2 = gen(L"01234567-89ab-cdef-0123456789abcdef");
+boost::uuids::uuid u3 = gen(std::string("0123456789abcdef0123456789abcdef"));
+boost::uuids::uuid u4 = gen(std::wstring(L"01234567-89ab-cdef-0123456789abcdef"));
+</pre>
+
+<h3><a name="boost/uuid/name_generator.hpp" href="./../../boost/uuid/name_generator.hpp">boost/uuid/name_generator.hpp</a></h3>
+<h4><a name="Synopsis_name_generator">Synopsis</a></h4>
+
+<pre>
+namespace boost {
+namespace uuids {
+
 class name_generator {
 public:
     typedef uuid result_type;
@@ -403,6 +467,27 @@
     uuid operator()(void const* buffer, std::size_t byte_count) const;
 };
 
+}} //namespace boost::uuids
+</pre>
+
+<h4><a name="Name Generator">Name Generator</a></h4>
+<p>
+The <tt>boost::uuids::name_generator</tt> class generates a name based <b>uuid</b> from a
+namespace uuid and a name.
+<pre>
+boost::uuids::uuid dns_namespace_uuid; // initialize to {6ba7b810-9dad-11d1-80b4-00c04fd430c8}
+
+boost::uuids::name_generator gen(dns_namespace_uuid);
+boost::uuids::uuid u = gen("boost.org");
+</pre>
+
+<h3><a name="boost/uuid/random_generator.hpp" href="./../../boost/uuid/random_generator.hpp">boost/uuid/random_generator.hpp</a></h3>
+<h4><a name="Synopsis_random_generator">Synopsis</a></h4>
+
+<pre>
+namespace boost {
+namespace uuids {
+
 template &lt;typename UniformRandomNumberGenerator&gt;
 class basic_random_generator {
 public:
@@ -419,40 +504,7 @@
 }} // namespace boost::uuids
 </pre>
 
-<h4><a name="Nil Generator"</a>Nil Generator</h4>
-<p>The <tt>boost::uuids::nil_generator</tt> class always generates a nil <b>uuid</b>.
-<pre>
-boost::uuids::nil_generator gen;
-boost::uuids::uuid u = gen();
-assert(u.is_nil() == true);
-
-// or for convenience
-boost::uuids::uuid u = boost::uuids::nil_uuid();
-assert(u.is_nil() == true);
-</pre>
-
-<h4><a name="String Generator"</a>String Generator</h4>
-<p>The <tt>boost::uuids::string_generator</tt> class generates a <b>uuid</b> from a string.
-<pre>
-boost::uuids::string_generator gen;
-boost::uuids::uuid u1 = gen("{01234567-89ab-cdef-0123456789abcdef}");
-boost::uuids::uuid u2 = gen(L"01234567-89ab-cdef-0123456789abcdef");
-boost::uuids::uuid u3 = gen(std::string("0123456789abcdef0123456789abcdef"));
-boost::uuids::uuid u4 = gen(std::wstring(L"01234567-89ab-cdef-0123456789abcdef"));
-</pre>
-
-<h4><a name="Name Generator"</a>Name Generator</h4>
-<p>
-The <tt>boost::uuids::name_generator</tt> class generates a name based <b>uuid</b> from a
-namespace uuid and a name.
-<pre>
-boost::uuids::uuid dns_namespace_uuid; // initialize to {6ba7b810-9dad-11d1-80b4-00c04fd430c8}
-
-boost::uuids::name_generator gen(dns_namespace_uuid);
-boost::uuids::uuid u = gen("boost.org");
-</pre>
-
-<h4><a name="Random Generator"</a>Random Generator</h4>
+<h4><a name="Random Generator">Random Generator</a></h4>
 <p>
 The <tt>boost::uuids::basic_random_generator</tt> class generates a random number
 based uuid from a random number generator (one that conforms to the
@@ -475,11 +527,9 @@
 boost::uuids::uuid u = gen();
 </pre>
 
-<h3><a name="boost/uuid/uuid_io.hpp"</a>boost/uuid/uuid_io.hpp</h3>
-<h4><a name="Synopsis_io"</a>Synopsis</h4>
+<h3><a name="boost/uuid/uuid_io.hpp" href="./../../boost/uuid/uuid_io.hpp">boost/uuid/uuid_io.hpp</a></h3>
+<h4><a name="Synopsis_io">Synopsis</a></h4>
 <pre>
-#include &lt;boost/uuid/uuid_io.hpp&gt;
-
 namespace boost {
 namespace uuids {
 
@@ -492,7 +542,7 @@
 }} // namespace boost::uuids
 </pre>
 
-<h4><a name="Input and Output"></a>Input and Output</h4>
+<h4><a name="Input and Output">Input and Output</a></h4>
 <p>
 Input and output stream operators <tt>&lt;&lt;</tt> and <tt>&gt;&gt;</tt>
 are provided by including boost/uuid/uuid_io.hpp.
@@ -506,11 +556,9 @@
 ss &gt;&gt; u;
 </pre>
 
-<h3><a name="boost/uuid/uuid_serialize.hpp"</a>boost/uuid/uuid_serialize.hpp</h3>
-<h4><a name="Synopsis_serialize"</a>Synopsis</h4>
+<h3><a name="boost/uuid/uuid_serialize.hpp" href="./../../boost/uuid/uuid_serialize.hpp">boost/uuid/uuid_serialize.hpp</a></h3>
+<h4><a name="Synopsis_serialize">Synopsis</a></h4>
 <pre>
-#include &lt;boost/uuid/uuid_serialize.hpp&gt;
-
 namespace boost {
 namespace uuids {
 
@@ -519,7 +567,7 @@
 }} // namespace boost::uuids
 </pre>
 
-<h4><a name="Serialization"></a>Serialization</h4>
+<h4><a name="Serialization">Serialization</a></h4>
 <p>
 Serialization is accomplished with the <a href="http://www.boost.org/libs/serialization/doc/index.html">
 Boost Serialization</a> library. A <b>uuid</b> is serialized as a
@@ -528,7 +576,7 @@
 <p>
 Include boost/uuid/uuid_serialize.hpp to enable serialization for <b>uuid</b>s.
 
-<h2><a name="Design notes"></a>Design notes</h2>
+<h2><a name="Design notes">Design notes</a></h2>
 <p>
 The document, <a href="http://www.itu.int/ITU-T/studygroups/com17/oid/X.667-E.pdf">
 http://www.itu.int/ITU-T/studygroups/com17/oid/X.667-E.pdf>, was used to design
@@ -545,12 +593,12 @@
 <p>All functions are re-entrant. Classes are as thread-safe as an int. That is an
 instance can not be shared between threads without proper synchronization.
 
-<h2><a name="History and Acknowledgements"></a>History and Acknowledgements</h2>
+<h2><a name="History and Acknowledgements">History and Acknowledgements</a></h2>
 <p>
 A number of people on the
boost.org
 mailing list provided useful comments and greatly helped to shape the library.
 
-<p>Revised&nbsp; January 1, 2010</p>
+<p>Revised&nbsp; February 6, 2010</p>
 
 <hr>
 <p>© Copyright Andy Tompkins, 2006</p>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk