mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Changed layout to match boost
This commit is contained in:
parent
7a8ba352c6
commit
c950c24f52
122 changed files with 15469 additions and 15550 deletions
|
|
@ -1,41 +0,0 @@
|
|||
[/
|
||||
/ Copyright (c) 2014 Mathieu Champlon
|
||||
/
|
||||
/ 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)
|
||||
/]
|
||||
|
||||
[section Motivation]
|
||||
[import example/motivation.cpp]
|
||||
[import example/calculator.hpp]
|
||||
[import example/mock_view.hpp]
|
||||
[import example/view.hpp]
|
||||
|
||||
Consider a (very) simple calculator class :
|
||||
|
||||
[simple_calculator]
|
||||
|
||||
Obviously writing unit tests for such a class is trivial, one of them could be :
|
||||
|
||||
[simple_zero_plus_zero_is_zero]
|
||||
|
||||
What now if the calculator class looks more like this :
|
||||
|
||||
[view]
|
||||
[calculator]
|
||||
|
||||
Writing unit tests becomes a bit more tedious and requires some boiler-plate code, for instance :
|
||||
|
||||
[my_view]
|
||||
[zero_plus_zero_is_zero_without_mock_object]
|
||||
|
||||
Mock objects main purpose is to alleviate the user from the burden of writing all this boiler-plate code.
|
||||
|
||||
Here is how the last test can be rewritten using a mock object :
|
||||
|
||||
[mock_view]
|
||||
[zero_plus_zero_is_zero_with_mock_object]
|
||||
|
||||
and all the checks are automatically handled by the library.
|
||||
|
||||
[endsect]
|
||||
Loading…
Add table
Add a link
Reference in a new issue