diff --git a/test/Jamfile b/test/Jamfile index 0d84cf9..a7580cf 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -13,5 +13,6 @@ DEPENDS all : circular_buffer ; test-suite "circular_buffer" : [ run base_test.cpp ] [ run space_optimized_test.cpp ] + [ run iterator_test.cpp ] ; } diff --git a/test/base_test.cpp b/test/base_test.cpp index e95749a..66a4b1f 100644 --- a/test/base_test.cpp +++ b/test/base_test.cpp @@ -482,7 +482,7 @@ void exception_safety_test() { } // test main -test_suite* init_unit_test_suite(int argc, char * argv[]) { +test_suite* init_unit_test_suite(int argc, char* argv[]) { test_suite* tests = BOOST_TEST_SUITE("Unit tests for the circular_buffer."); add_common_tests(tests); diff --git a/test/common.cpp b/test/common.cpp index 31921e2..03e2b40 100644 --- a/test/common.cpp +++ b/test/common.cpp @@ -6,13 +6,6 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include -#include - -using namespace boost; -using namespace std; -using unit_test_framework::test_suite; - void generic_test(CB_CONTAINER& cb) { vector v; diff --git a/test/iterator_test.cpp b/test/iterator_test.cpp new file mode 100644 index 0000000..d6416c2 --- /dev/null +++ b/test/iterator_test.cpp @@ -0,0 +1,31 @@ +// Test of the iterator of the circular buffer. +// Note: This test concentrates on interator validity only. Other iterator +// tests are included in the base_test.cpp. + +// Copyright (c) 2003-2005 Jan Gaspar + +// Use, modification, and distribution is subject to 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) + +#define BOOST_CB_DISABLE_DEBUG + +#include "test.hpp" + +// TODO +void validity_test() { + + circular_buffer_space_optimized cb; + + BOOST_CHECK(cb.capacity() == cb.max_size()); +} + +// test main +test_suite* init_unit_test_suite(int argc, char* argv[]) { + + test_suite* tests = BOOST_TEST_SUITE("Unit tests for the iterator of the circular_buffer."); + + tests->add(BOOST_TEST_CASE(&validity_test)); + + return tests; +} diff --git a/test/space_optimized_test.cpp b/test/space_optimized_test.cpp index a68e436..e5dac10 100644 --- a/test/space_optimized_test.cpp +++ b/test/space_optimized_test.cpp @@ -61,7 +61,7 @@ void min_capacity_test() { } // test main -test_suite* init_unit_test_suite(int argc, char * argv[]) { +test_suite* init_unit_test_suite(int argc, char* argv[]) { test_suite* tests = BOOST_TEST_SUITE("Unit tests for the circular_buffer_space_optimized."); add_common_tests(tests); diff --git a/test/test.hpp b/test/test.hpp index ba25c1c..43049f0 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -14,8 +14,10 @@ #endif #include "../../../boost/circular_buffer.hpp" +#include #include #include +#include #include #if !defined(BOOST_NO_EXCEPTIONS) #include @@ -160,4 +162,8 @@ inline ptrdiff_t* distance_type(const InputIteratorSimulator&) { return 0; } #endif // #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) +using namespace std; +using namespace boost; +using boost::unit_test::test_suite; + #endif // #if !defined(BOOST_CIRCULAR_BUFFER_TEST_HPP)