|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62774 - trunk/libs/test/example
From: steven_at_[hidden]
Date: 2010-06-10 17:56:36
Author: steven_watanabe
Date: 2010-06-10 17:56:35 EDT (Thu, 10 Jun 2010)
New Revision: 62774
URL: http://svn.boost.org/trac/boost/changeset/62774
Log:
Rename examples. Fixes #4161
Added:
trunk/libs/test/example/test_example1.cpp
- copied unchanged from r62736, /trunk/libs/test/example/est_example1.cpp
trunk/libs/test/example/test_example2.cpp
- copied unchanged from r62736, /trunk/libs/test/example/est_example2.cpp
Removed:
trunk/libs/test/example/est_example1.cpp
trunk/libs/test/example/est_example2.cpp
Deleted: trunk/libs/test/example/est_example1.cpp
==============================================================================
--- trunk/libs/test/example/est_example1.cpp 2010-06-10 17:56:35 EDT (Thu, 10 Jun 2010)
+++ (empty file)
@@ -1,56 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2010.
-// 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)
-
-// See http://www.boost.org/libs/test for the library home page.
-
-// Boost.Test
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include <boost/test/mock_object.hpp>
-using namespace boost::itest;
-
-// Boost
-#include <boost/bind.hpp>
-
-//____________________________________________________________________________//
-
-// Here is the function we are going to use to see all execution path variants
-
-template<typename Employee,typename Ostr>
-typename Employee::string_type
-validate_and_return_salary( Employee const& e, Ostr& os )
-{
- if( e.Title() == "CEO" || e.Salary() > 100000 )
- os << e.First() << " " << e.Last() << " is overpaid";
-
- return e.First() + " " + e.Last();
-}
-
-//____________________________________________________________________________//
-
-// Mock object we are going to use for this test
-
-struct EmpMock : mock_object<> {
- typedef mock_object<> mo_type;
- typedef mo_type string_type;
-
- string_type const& Title() const { BOOST_ITEST_MOCK_FUNC( EmpMock::Title ); }
- string_type const& First() const { BOOST_ITEST_MOCK_FUNC( EmpMock::First ); }
- string_type const& Last() const { BOOST_ITEST_MOCK_FUNC( EmpMock::Last ); }
-
- mo_type const& Salary() const { BOOST_ITEST_MOCK_FUNC( EmpMock::Salary ); }
-};
-
-//____________________________________________________________________________//
-
-BOOST_TEST_EXCEPTION_SAFETY( test_all_exec_path )
-{
- validate_and_return_salary( EmpMock(), mock_object<>::prototype() );
-}
-
-//____________________________________________________________________________//
-
-// EOF
Deleted: trunk/libs/test/example/est_example2.cpp
==============================================================================
--- trunk/libs/test/example/est_example2.cpp 2010-06-10 17:56:35 EDT (Thu, 10 Jun 2010)
+++ (empty file)
@@ -1,80 +0,0 @@
-// (C) Copyright Gennadiy Rozental 2005-2010.
-// 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)
-
-// See http://www.boost.org/libs/test for the library home page.
-
-// Boost.Test
-#define BOOST_TEST_MAIN
-#include <boost/test/unit_test.hpp>
-#include <boost/test/exception_safety.hpp>
-#include <boost/test/mock_object.hpp>
-using namespace boost::itest;
-
-// Boost
-#include <boost/bind.hpp>
-
-//____________________________________________________________________________//
-
-// Here is an example of simple (incorrect) stack implementation
-
-template<class T>
-class stack {
-public:
- explicit stack( int init_capacity = 10 )
- : m_capacity( init_capacity )
- , m_size( 0 )
- , m_v( BOOST_ITEST_NEW(T)[m_capacity] )
- {
- BOOST_ITEST_SCOPE( stack::stack );
- }
- ~stack()
- {
- delete[] m_v;
- }
-
- void push( T const& element )
- {
- BOOST_ITEST_SCOPE( stack::push );
-
- if( m_size == m_capacity ) {
- m_capacity *= 2;
- T* new_buffer = BOOST_ITEST_NEW( T )[m_capacity];
- for( unsigned i = 0; i < m_size; i++ ) {
- new_buffer[i] = m_v[i];
- }
- delete [] m_v;
- m_v = new_buffer;
- }
- m_v[m_size++] = element;
- }
- unsigned size() { return m_size; }
-
-private:
- unsigned m_capacity;
- unsigned m_size;
- T* m_v;
-};
-
-//____________________________________________________________________________//
-
-BOOST_TEST_EXCEPTION_SAFETY( test_stack_push )
-{
- stack<mock_object<> > st( 2 );
-
- for( unsigned i = 0; i < 3; ++i ) {
- try {
- st.push( mock_object<>::prototype() );
- }
- catch( ... ) {
- // this invariant checks that in case of failed push number of elements doesn't change
- BOOST_CHECK_EQUAL( i, st.size() );
- throw;
- }
- }
-}
-
-//____________________________________________________________________________//
-
-// EOF
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