|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60927 - in branches/release: boost/uuid libs/uuid libs/uuid/test status
From: atompkins_at_[hidden]
Date: 2010-03-29 23:15:46
Author: atompkins
Date: 2010-03-29 23:15:44 EDT (Mon, 29 Mar 2010)
New Revision: 60927
URL: http://svn.boost.org/trac/boost/changeset/60927
Log:
merged uuid from trunk
Added:
branches/release/boost/uuid/name_generator.hpp
- copied unchanged from r59617, /trunk/boost/uuid/name_generator.hpp
branches/release/boost/uuid/nil_generator.hpp
- copied unchanged from r59617, /trunk/boost/uuid/nil_generator.hpp
branches/release/boost/uuid/random_generator.hpp
- copied, changed from r59617, /trunk/boost/uuid/random_generator.hpp
branches/release/boost/uuid/string_generator.hpp
- copied unchanged from r59617, /trunk/boost/uuid/string_generator.hpp
branches/release/libs/uuid/test/compile_name_generator.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/compile_name_generator.cpp
branches/release/libs/uuid/test/compile_nil_generator.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/compile_nil_generator.cpp
branches/release/libs/uuid/test/compile_random_generator.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/compile_random_generator.cpp
branches/release/libs/uuid/test/compile_string_generator.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/compile_string_generator.cpp
branches/release/libs/uuid/test/compile_uuid.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/compile_uuid.cpp
branches/release/libs/uuid/test/compile_uuid_generators.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/compile_uuid_generators.cpp
branches/release/libs/uuid/test/compile_uuid_io.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/compile_uuid_io.cpp
branches/release/libs/uuid/test/compile_uuid_serialize.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/compile_uuid_serialize.cpp
branches/release/libs/uuid/test/lightweight_test_ex.hpp
- copied unchanged from r59617, /trunk/libs/uuid/test/lightweight_test_ex.hpp
branches/release/libs/uuid/test/test_name_generator.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/test_name_generator.cpp
branches/release/libs/uuid/test/test_nil_generator.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/test_nil_generator.cpp
branches/release/libs/uuid/test/test_random_generator.cpp
- copied, changed from r59617, /trunk/libs/uuid/test/test_random_generator.cpp
branches/release/libs/uuid/test/test_string_generator.cpp
- copied unchanged from r59617, /trunk/libs/uuid/test/test_string_generator.cpp
Removed:
branches/release/libs/uuid/test/compile_uuid_generators_h.cpp
branches/release/libs/uuid/test/compile_uuid_h.cpp
branches/release/libs/uuid/test/compile_uuid_io_h.cpp
branches/release/libs/uuid/test/compile_uuid_serialize_h.cpp
Properties modified:
branches/release/boost/uuid/ (props changed)
branches/release/libs/uuid/ (props changed)
Text files modified:
branches/release/boost/uuid/random_generator.hpp | 1
branches/release/boost/uuid/uuid_generators.hpp | 389 ---------------------------------------
branches/release/libs/uuid/test/Jamfile.v2 | 99 ++++-----
branches/release/libs/uuid/test/test_include1.cpp | 11
branches/release/libs/uuid/test/test_include2.cpp | 4
branches/release/libs/uuid/test/test_io.cpp | 48 ++--
branches/release/libs/uuid/test/test_random_generator.cpp | 11 +
branches/release/libs/uuid/test/test_serialization.cpp | 9
branches/release/libs/uuid/test/test_sha1.cpp | 66 +++++-
branches/release/libs/uuid/test/test_tagging.cpp | 24 +-
branches/release/libs/uuid/test/test_uuid.cpp | 97 +++++----
branches/release/libs/uuid/test/test_uuid_class.cpp | 16
branches/release/libs/uuid/test/test_wserialization.cpp | 7
branches/release/libs/uuid/uuid.html | 188 ++++++++++++-------
branches/release/status/explicit-failures-markup.xml | 50 +++++
15 files changed, 397 insertions(+), 623 deletions(-)
Copied: branches/release/boost/uuid/random_generator.hpp (from r59617, /trunk/boost/uuid/random_generator.hpp)
==============================================================================
--- /trunk/boost/uuid/random_generator.hpp (original)
+++ branches/release/boost/uuid/random_generator.hpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 2010)
@@ -87,6 +87,7 @@
for (uuid::iterator it=u.begin(); it!=u.end(); ++it, ++i) {
if (i==sizeof(unsigned long)) {
random_value = generator();
+ i = 0;
}
*it = ((random_value >> (i*8)) & 0xFF);
Modified: branches/release/boost/uuid/uuid_generators.hpp
==============================================================================
--- branches/release/boost/uuid/uuid_generators.hpp (original)
+++ branches/release/boost/uuid/uuid_generators.hpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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: branches/release/libs/uuid/test/Jamfile.v2
==============================================================================
--- branches/release/libs/uuid/test/Jamfile.v2 (original)
+++ branches/release/libs/uuid/test/Jamfile.v2 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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 ]
+ ;
+
Deleted: branches/release/libs/uuid/test/compile_uuid_generators_h.cpp
==============================================================================
--- branches/release/libs/uuid/test/compile_uuid_generators_h.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 2010)
+++ (empty file)
@@ -1,15 +0,0 @@
-// (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)
-
-// libs/uuid/test/compile_uuid_generators_h.cpp -------------------------------//
-
-// 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>
Deleted: branches/release/libs/uuid/test/compile_uuid_h.cpp
==============================================================================
--- branches/release/libs/uuid/test/compile_uuid_h.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 2010)
+++ (empty file)
@@ -1,15 +0,0 @@
-// (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)
-
-// libs/uuid/test/compile_uuid_h.cpp -------------------------------//
-
-// 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>
Deleted: branches/release/libs/uuid/test/compile_uuid_io_h.cpp
==============================================================================
--- branches/release/libs/uuid/test/compile_uuid_io_h.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 2010)
+++ (empty file)
@@ -1,15 +0,0 @@
-// (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)
-
-// libs/uuid/test/compile_uuid_io_h.cpp -------------------------------//
-
-// 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>
Deleted: branches/release/libs/uuid/test/compile_uuid_serialize_h.cpp
==============================================================================
--- branches/release/libs/uuid/test/compile_uuid_serialize_h.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 2010)
+++ (empty file)
@@ -1,15 +0,0 @@
-// (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)
-
-// libs/uuid/test/compile_uuid_serialize_h.cpp -------------------------------//
-
-// 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>
Modified: branches/release/libs/uuid/test/test_include1.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_include1.cpp (original)
+++ branches/release/libs/uuid/test/test_include1.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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: branches/release/libs/uuid/test/test_include2.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_include2.cpp (original)
+++ branches/release/libs/uuid/test/test_include2.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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: branches/release/libs/uuid/test/test_io.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_io.cpp (original)
+++ branches/release/libs/uuid/test/test_io.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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();
}
Copied: branches/release/libs/uuid/test/test_random_generator.cpp (from r59617, /trunk/libs/uuid/test/test_random_generator.cpp)
==============================================================================
--- /trunk/libs/uuid/test/test_random_generator.cpp (original)
+++ branches/release/libs/uuid/test/test_random_generator.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 2010)
@@ -56,6 +56,17 @@
// random device
//basic_random_generator<boost::random_device> uuid_gen5;
//check_random_generator(uuid_gen5);
+
+ // there was a bug in basic_random_generator where it did not
+ // produce very random numbers. This checks for that bug.
+ uuid u = random_generator()();
+ if ( (u.data[4] == u.data[12]) &&
+ (u.data[5] == u.data[9] && u.data[5] == u.data[13]) &&
+ (u.data[7] == u.data[11] && u.data[7] == u.data[15]) &&
+ (u.data[10] == u.data[14]) )
+ {
+ BOOST_ERROR("basic_random_generator is not producing random uuids");
+ }
return boost::report_errors();
}
Modified: branches/release/libs/uuid/test/test_serialization.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_serialization.cpp (original)
+++ branches/release/libs/uuid/test/test_serialization.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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: branches/release/libs/uuid/test/test_sha1.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_sha1.cpp (original)
+++ branches/release/libs/uuid/test/test_sha1.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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,6 +23,36 @@
} //namespace std
#endif
+void test_sha1_digest_equal_array(char const * file, int line, char const * function,
+ const unsigned int (&lhs)[5], const unsigned int (&rhs)[5])
+{
+ for (size_t i=0; i<5; i++) {
+ if ( lhs[i] != rhs[i]) {
+ std::cerr << file << "(" << line << "): sha1 digest [";
+ for (size_t l=0; l<5; l++) {
+ if (l != 0) {
+ std::cerr << " ";
+ }
+ std::cerr << std::hex << (int)lhs[l];
+ }
+
+ std::cerr << "] not equal [";
+ for (size_t r=0; r<5; r++) {
+ if (r != 0) {
+ std::cerr << " ";
+ }
+ std::cerr << std::hex << (int)rhs[r];
+ }
+ std::cerr << "] in function '" << function << "'" << std::endl;
+ ++boost::detail::test_errors();
+ return;
+ }
+ }
+}
+
+
+#define BOOST_TEST_SHA1_DEGEST(lhs, rhs) ( test_sha1_digest_equal_array(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, lhs, rhs) )
+
void test_sha1(char const*const message, unsigned int length, const unsigned int (&correct_digest)[5])
{
boost::uuids::detail::sha1 sha;
@@ -35,10 +61,10 @@
unsigned int digest[5];
sha.get_digest(digest);
- BOOST_CHECK_EQUAL_COLLECTIONS(digest, digest+5, correct_digest, correct_digest+5);
+ BOOST_TEST_SHA1_DEGEST(digest, correct_digest);
}
-BOOST_AUTO_TEST_CASE(test_quick)
+void test_quick()
{
struct test_case
{
@@ -64,7 +90,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
{
@@ -72,7 +98,7 @@
unsigned int digest[5];
};
test_case cases[] =
- { { "",
+ { { "",
{ 0xda39a3ee, 0x5e6b4b0d, 0x3255bfef, 0x95601890, 0xafd80709 } }
, { "a8",
{ 0x99f2aa95, 0xe36f95c2, 0xacb0eaf2, 0x3998f030, 0x638f3f15 } }
@@ -176,7 +202,7 @@
{ 0xb0732181, 0x568543ba, 0x85f2b6da, 0x602b4b06, 0x5d9931aa } }
, { "235ea9c2ba7af25400f2e98a47a291b0bccdaad63faa2475721fda5510cc7dad814bce8dabb611790a6abe56030b798b75c944",
{ 0x9c22674c, 0xf3222c3b, 0xa9216726, 0x94aafee4, 0xce67b96b } }
- , { "07e3e29fed63104b8410f323b975fd9fba53f636af8c4e68a53fb202ca35dd9ee07cb169ec5186292e44c27e5696a967f5e67709",
+ , { "07e3e29fed63104b8410f323b975fd9fba53f636af8c4e68a53fb202ca35dd9ee07cb169ec5186292e44c27e5696a967f5e67709",
{ 0xd128335f, 0x4cecca90, 0x66cdae08, 0x958ce656, 0xff0b4cfc } }
, { "65d2a1dd60a517eb27bfbf530cf6a5458f9d5f4730058bd9814379547f34241822bf67e6335a6d8b5ed06abf8841884c636a25733f",
{ 0x0b67c57a, 0xc578de88, 0xa2ae055c, 0xaeaec8bb, 0x9b0085a0 } }
@@ -212,18 +238,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) {
+ 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));
@@ -234,6 +260,14 @@
unsigned int digest[5];
sha.get_digest(digest);
- BOOST_CHECK_EQUAL_COLLECTIONS(digest, digest+5, tc.digest, tc.digest+5);
+ BOOST_TEST_SHA1_DEGEST(digest, tc.digest);
}
}
+
+int main(int, char*[])
+{
+ test_quick();
+ test_short_messages();
+
+ return boost::report_errors();
+}
Modified: branches/release/libs/uuid/test/test_tagging.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_tagging.cpp (original)
+++ branches/release/libs/uuid/test/test_tagging.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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: branches/release/libs/uuid/test/test_uuid.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_uuid.cpp (original)
+++ branches/release/libs/uuid/test/test_uuid.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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: branches/release/libs/uuid/test/test_uuid_class.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_uuid_class.cpp (original)
+++ branches/release/libs/uuid/test/test_uuid_class.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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: branches/release/libs/uuid/test/test_wserialization.cpp
==============================================================================
--- branches/release/libs/uuid/test/test_wserialization.cpp (original)
+++ branches/release/libs/uuid/test/test_wserialization.cpp 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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: branches/release/libs/uuid/uuid.html
==============================================================================
--- branches/release/libs/uuid/uuid.html (original)
+++ branches/release/libs/uuid/uuid.html 2010-03-29 23:15:44 EDT (Mon, 29 Mar 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 <boost/uuid/uuid.hpp>
-
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>=
</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 <boost/uuid/uuid_generators.hpp>
+<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 <boost/uuid/nil_generator.hpp>
+#include <boost/uuid/string_generator.hpp>
+#include <boost/uuid/name_generator.hpp>
+#include <boost/uuid/random_generator.hpp>
+</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<ch, char_traits, alloc> const& 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 <typename UniformRandomNumberGenerator>
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 <boost/uuid/uuid_io.hpp>
-
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><<</tt> and <tt>>></tt>
are provided by including boost/uuid/uuid_io.hpp.
@@ -506,11 +556,9 @@
ss >> 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 <boost/uuid/uuid_serialize.hpp>
-
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 January 1, 2010</p>
+<p>Revised February 6, 2010</p>
<hr>
<p>© Copyright Andy Tompkins, 2006</p>
Modified: branches/release/status/explicit-failures-markup.xml
==============================================================================
--- branches/release/status/explicit-failures-markup.xml (original)
+++ branches/release/status/explicit-failures-markup.xml 2010-03-29 23:15:44 EDT (Mon, 29 Mar 2010)
@@ -5970,6 +5970,56 @@
</library>
+ <!-- uuid -->
+ <library name="uuid">
+ <mark-expected-failures>
+ <test name="test_serialization"/>
+ <toolset name="cuda-2.2"/>
+ <toolset name="borland-cb2009"/>
+ <toolset name="borland-cb2010"/>
+ <toolset name="borland-5.9.3"/>
+ <toolset name="borland-6.1.3"/>
+ <toolset name="borland-6.2.1"/>
+ <note author="Andy Tompkins">
+ The test relies on Boost.Serialization which is not
+ supported on this toolset.
+ </note>
+ </mark-expected-failures>
+ <mark-expected-failures>
+ <test name="test_random_generator"/>
+ <test name="test_tagging"/>
+ <test name="test_uuid_class"/>
+ <toolset name="borland-cb2009"/>
+ <toolset name="borland-cb2010"/>
+ <toolset name="borland-5.9.3"/>
+ <toolset name="borland-6.1.3"/>
+ <toolset name="borland-6.2.1"/>
+ <note author="Andy Tompkins">
+ The test relies on Boost.Random which is not supported
+ on this toolset.
+ </note>
+ </mark-expected-failures>
+ <mark-expected-failures>
+ <test name="test_uuid"/>
+ <toolset name="borland-cb2009"/>
+ <toolset name="borland-cb2010"/>
+ <toolset name="borland-5.9.3"/>
+ <toolset name="borland-6.1.3"/>
+ <toolset name="borland-6.2.1"/>
+ <note author="Andy Tompkins" refid="28"/>
+ </mark-expected-failures>
+ <mark-expected-failures>
+ <test name="compile_random_generator"/>
+ <test name="compile_uuid_generators"/>
+ <test name="test_include1"/>
+ <toolset name="borland-6.2.1"/>
+ <note author="Andy Tompkins">
+ The test relies on Boost.Iterator (iterator_facade)
+ which is not supported on this toolset.
+ </note>
+ </mark-expected-failures>
+ </library>
+
<!-- variant -->
<library name="variant">
<mark-unusable>
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