mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Preview of clang-format changes and CI
This commit is contained in:
parent
bfd1701fcb
commit
805e3b02bf
98 changed files with 6339 additions and 11357 deletions
|
|
@ -7,40 +7,36 @@
|
|||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_AUTO_TEST_MAIN
|
||||
#include <boost/test/auto_unit_test.hpp>
|
||||
#include <turtle/mock.hpp>
|
||||
#include "calculator.hpp"
|
||||
#include "mock_view.hpp"
|
||||
#include <turtle/mock.hpp>
|
||||
#include <boost/test/auto_unit_test.hpp>
|
||||
|
||||
namespace simple
|
||||
{
|
||||
namespace simple {
|
||||
//[ simple_calculator
|
||||
class calculator
|
||||
{
|
||||
public:
|
||||
int add( int a, int b );
|
||||
int add(int a, int b);
|
||||
};
|
||||
//]
|
||||
|
||||
//[ simple_zero_plus_zero_is_zero
|
||||
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||
BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero)
|
||||
{
|
||||
calculator c;
|
||||
BOOST_CHECK_EQUAL( 0, c.add( 0, 0 ) );
|
||||
BOOST_CHECK_EQUAL(0, c.add(0, 0));
|
||||
}
|
||||
//]
|
||||
}
|
||||
} // namespace simple
|
||||
|
||||
namespace without_mock_object
|
||||
{
|
||||
namespace without_mock_object {
|
||||
//[ my_view
|
||||
class my_view : public view
|
||||
{
|
||||
public:
|
||||
my_view()
|
||||
: called( false )
|
||||
{}
|
||||
virtual void display( int result )
|
||||
my_view() : called(false) {}
|
||||
virtual void display(int result)
|
||||
{
|
||||
called = true;
|
||||
value = result;
|
||||
|
|
@ -51,26 +47,26 @@ public:
|
|||
//]
|
||||
|
||||
//[ zero_plus_zero_is_zero_without_mock_object
|
||||
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||
BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero)
|
||||
{
|
||||
my_view v;
|
||||
calculator c( v );
|
||||
c.add( 0, 0 );
|
||||
BOOST_REQUIRE( v.called );
|
||||
BOOST_CHECK_EQUAL( 0, v.value );
|
||||
calculator c(v);
|
||||
c.add(0, 0);
|
||||
BOOST_REQUIRE(v.called);
|
||||
BOOST_CHECK_EQUAL(0, v.value);
|
||||
}
|
||||
//]
|
||||
}
|
||||
} // namespace without_mock_object
|
||||
|
||||
namespace with_mock_object
|
||||
{
|
||||
namespace with_mock_object {
|
||||
//[ zero_plus_zero_is_zero_with_mock_object
|
||||
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||
BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero)
|
||||
{
|
||||
mock_view v;
|
||||
calculator c( v );
|
||||
MOCK_EXPECT( v.display ).once().with( 0 ); // expect the 'display' method to be called once (and only once) with a parameter value equal to 0
|
||||
c.add( 0, 0 );
|
||||
calculator c(v);
|
||||
MOCK_EXPECT(v.display).once().with(
|
||||
0); // expect the 'display' method to be called once (and only once) with a parameter value equal to 0
|
||||
c.add(0, 0);
|
||||
}
|
||||
//]
|
||||
}
|
||||
} // namespace with_mock_object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue