[Mockpp-commits] mockpp/mockpp/docs/en appendix.docbook,1.12,1.13 credits.docbook,1.3,1.4 dev_advanc
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-12-02 17:28:45
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8261/mockpp/docs/en Modified Files: appendix.docbook credits.docbook dev_advanced_easymock.docbook dev_advanced_intro.docbook dev_advanced_jmock.docbook dev_basic.docbook dev_embedded.docbook faq.docbook index.docbook Log Message: fix typos Index: appendix.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/appendix.docbook,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- appendix.docbook 28 Nov 2005 19:03:09 -0000 1.12 +++ appendix.docbook 2 Dec 2005 17:28:36 -0000 1.13 @@ -19,8 +19,9 @@ <para> In order to fully benefit from &mockpp;, you need -<ulink url="http://cppunit.sf.net">CppUnit</ulink>, a framework for unit tests -with C++.</para> +<ulink url="http://cppunit.sf.net">&cppunit;</ulink>, a framework for unit tests +with C++. Any other framework should work for development as well but &cppunit; +is used for the internal unittests.</para> </sect1> @@ -84,6 +85,14 @@ </listitem> </varlistentry> + <varlistentry> + <term>--enable-builtin-stl</term> + <listitem>By default &mockpp; is compiled with the C++ Standard Template Libray that + comes with your compiler. Unfortunately the current implementations consume + rather much resources. For that reason a built-in minimalistic STL can be used. + </listitem> + </varlistentry> + </variablelist> @@ -157,8 +166,8 @@ <sect2 id="installing-cygwin"> <title>Installing on systems using Cygwin</title> -<para>There have been reports about problemx to compile and link -with cppunit on Windows system under Cygwin. A solution might be to be to link +<para>There have been reports about problems to compile and link +with &cppunit; on Windows system under &cygwin;. A solution might be to be to link statically. First compile &cppunit; (and possibly force installation with -k): </para> Index: dev_embedded.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_embedded.docbook,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dev_embedded.docbook 1 Dec 2005 18:15:08 -0000 1.1 +++ dev_embedded.docbook 2 Dec 2005 17:28:36 -0000 1.2 @@ -1,4 +1,4 @@ -<sect1 id="devel-embedded"> +<sect1 id="embedded-systems"> <title>Embedded Systems</title> Index: dev_advanced_jmock.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_advanced_jmock.docbook,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- dev_advanced_jmock.docbook 20 Nov 2005 10:02:25 -0000 1.16 +++ dev_advanced_jmock.docbook 2 Dec 2005 17:28:36 -0000 1.17 @@ -45,7 +45,7 @@ </programlisting> -You need not provide each of these methods, only what you actually need. If you don't intend +You need not provide all of these methods, only what you actually need. If you don't intend to return a special value: omit <methodname>will()</methodname> and the default return value will be used.</para> @@ -100,12 +100,12 @@ wrapper functions instead:</para> <itemizedlist> - <listitem><methodname>once()</methodname>: exactly one single invocation</listitem> - <listitem><methodname>exactly()</methodname>: an exact invocation count</listitem> + <listitem><methodname>InvokeOnceMatcher</methodname> = <methodname>once()</methodname>: exactly one single invocation</listitem> + <listitem><methodname>InvokeCountMatcher</methodname> = <methodname>exactly()</methodname>: an exact invocation count</listitem> + <listitem><methodname>InvokeAtLeastMatcher</methodname> = <methodname>atLeast()</methodname>: a minimum invocation count</listitem> + <listitem><methodname>InvokeAtLeastOnceMatcher</methodname> = <methodname>atLeastOnce()</methodname>: invoke the method at least once</listitem> + <listitem><methodname>InvokeAtMostMatcher</methodname> = <methodname>atMost()</methodname>: a maximum invocation count</listitem> <listitem><methodname>never()</methodname>: never invoke this method</listitem> - <listitem><methodname>atLeast()</methodname>: a minimum invocation count</listitem> - <listitem><methodname>atLeastOnce()</methodname>: invoke the method at least once</listitem> - <listitem><methodname>atMost()</methodname>: a maximum invocation count</listitem> </itemizedlist> <para>After setting up the behaviour and actually invoking the mock object the matcher specifications @@ -152,22 +152,22 @@ previous invocation.</para> <para>The distribution already contains a set of classes for common -constraints. For convenience reasons and to enhance readability some of these -classes have a counterpart in the form of a method.The most important are:</para> +constraints. For convenience reasons and to enhance readability most of these +classes have a counterpart in the form of a method.The most important ones are:</para> <itemizedlist> - <listitem><classname>IsEqual</classname>/<methodname>eq()</methodname> tests equality</listitem> - <listitem><classname>IsSame</classname>/<methodname>same()</methodname> tests if two objects are the same</listitem> - <listitem><classname>IsCloseTo</classname>/<methodname>eq(a,b)</methodname> tests near equality</listitem> - <listitem><classname>IsGreaterThan</classname>/<methodname>gt()</methodname> is true for higher values a reference value</listitem> - <listitem><classname>IsLessThan</classname>/<methodname>lt()</methodname> is true for lower values than a reference value</listitem> - <listitem><classname>IsNot</classname>/<methodname>logic_not()</methodname> negates another contraint</listitem> - <listitem><classname>And</classname>/<methodname>logic_and()</methodname> provides a logical-and of two constraints</listitem> - <listitem><classname>Or</classname>/<methodname>logic_or()</methodname> provides a logical-or of two constraints</listitem> - <listitem><classname>IsAnything</classname>/<methodname>any()</methodname> is always true</listitem> - <listitem><classname>IsNothing</classname>/<methodname>nothing()</methodname> is never true</listitem> - <listitem><classname>StringContains</classname>/<methodname>stringContains()</methodname> checks for the occurence of a substring</listitem> - <listitem><classname>IsInstanceOf</classname>/<methodname>isA()</methodname> tests if an object is of a type</listitem> + <listitem><classname>IsEqual</classname> = <methodname>eq()</methodname> tests equality</listitem> + <listitem><classname>IsSame</classname> = <methodname>same()</methodname> tests if two objects are the same</listitem> + <listitem><classname>IsCloseTo</classname> = <methodname>eq(a,b)</methodname> tests near equality</listitem> + <listitem><classname>IsGreaterThan</classname> = <methodname>gt()</methodname> is true for higher values a reference value</listitem> + <listitem><classname>IsLessThan</classname> = <methodname>lt()</methodname> is true for lower values than a reference value</listitem> + <listitem><classname>IsNot</classname> = <methodname>logic_not()</methodname> negates another contraint</listitem> + <listitem><classname>And</classname> = <methodname>logic_and()</methodname> provides a logical-and of two constraints</listitem> + <listitem><classname>Or</classname> = <methodname>logic_or()</methodname> provides a logical-or of two constraints</listitem> + <listitem><classname>IsAnything</classname> = <methodname>any()</methodname> is always true</listitem> + <listitem><classname>IsNothing</classname> = <methodname>nothing()</methodname> is never true</listitem> + <listitem><classname>StringContains</classname> = <methodname>stringContains()</methodname> checks for the occurence of a substring</listitem> + <listitem><classname>IsInstanceOf</classname> = <methodname>isA()</methodname> tests if an object is of a type</listitem> </itemizedlist> <para>Creating your own constraints is quite easy. Look at the files in the @@ -208,7 +208,7 @@ <function>isSameComparison</function> which implements this default behaviour. If you need a differing implementation for a certain class you can provide a specialized template. This may happen if you are using a shared pointer and -don't want to compare the this helper but the shared object at the end of +don't want to compare the helper but the shared object at the end of the pointers.</para> <para>For a similar reason there is another templated function @@ -272,8 +272,8 @@ <sect3> <title>Return Values and Exceptions</title> -<para>Return values from methods and exceptions are treated similar as exceptions are -considered here not more than a special kind of return value. You may determine the return value +<para>Return values from methods and exceptions are treated similar. Exceptions are +considered not more than a special kind of return value. You may determine the return value based on the result of the parameters you passed with <methodname>expects()</methodname> and <methodname>with()</methodname> or you can optionally set a default action by passing it to <methodname>setDefaultStub()</methodname>. Index: faq.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/faq.docbook,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- faq.docbook 1 Aug 2005 18:21:12 -0000 1.9 +++ faq.docbook 2 Dec 2005 17:28:36 -0000 1.10 @@ -10,7 +10,8 @@ <qandaentry> <question> - <para>I have the following simple method but it does not compile.</para> + <para>I have the following simple method but it does not compile when + using the macros.</para> <para> <programlisting> @@ -42,7 +43,9 @@ <para>A similar problem arises when you need to pass values back by a parameter reference. In this case you can use <link linkend="outbound"><classname>OutBound</classname></link> - to return predefined values.</para> + to return predefined values. Please also understand that this problem + does not arise when using the mock method templates. In this case + you have to create the forwarding method anyway.</para> </answer> Index: index.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/index.docbook,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- index.docbook 1 Dec 2005 18:15:08 -0000 1.33 +++ index.docbook 2 Dec 2005 17:28:36 -0000 1.34 @@ -7,11 +7,12 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ <!ENTITY mockpp '<application>mockpp</application>' > - <!ENTITY cppunit '<application>cppunit</application>' > + <!ENTITY cppunit '<application>CppUnit</application>' > + <!ENTITY cygwin '<application>Cygwin</application>' > <!ENTITY copyyears '2002-2005' > <!ENTITY mockpp_email 'mockpp at ewald-arnold dot de' > <!ENTITY release_date '<pubdate>Published: <?dbtimestamp format="Y-m-d"?></pubdate>' > - <!ENTITY release_info '<releaseinfo>1.10.00</releaseinfo>' > + <!ENTITY release_info '<releaseinfo>1.11.00</releaseinfo>' > <!ENTITY chap_bookinfo SYSTEM 'bookinfo.docbook' > <!ENTITY chap_intro SYSTEM 'intro.docbook' > Index: dev_advanced_intro.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_advanced_intro.docbook,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- dev_advanced_intro.docbook 19 Nov 2005 19:14:29 -0000 1.8 +++ dev_advanced_intro.docbook 2 Dec 2005 17:28:36 -0000 1.9 @@ -72,8 +72,8 @@ <calloutlist> <callout arearefs="interface1-class-co" id="interface1-class" > - <para>Define an interface class which contains all the methods that must - simulate some real world behaviour. This interface class is also used + <para>Define an interface class which contains all the methods that + describe some real world behaviour. This interface class is also used to implement the real world class.</para> <para> The intention is to pass a real world object in the running application or a mock object while executing tests.</para> @@ -108,14 +108,14 @@ <sect3> <title>The Main Mock Object Classes</title> -<para>Since most of tasks concerning mock objects occur frequently and in a similar +<para>Since most of the tasks concerning mock objects occur frequently and in a similar manner there are some classes which support automated behaviour with different approaches. Depending on your personal taste or special problems you may choose the one or the other.</para> <itemizedlist> <listitem>The first possibility is modeled by a class called <classname>VisitableMockObject</classname>. It was named like this -because you set up part of it's behaviour by recording an execution path for the tests, +because you set up part of its behaviour by recording an execution path for the tests, thus by "visiting" the object. This approach is rather strict because the invocation order and parameter values must match exactly. Unfortunatley it is almost impossible to add new capabilities. @@ -174,7 +174,7 @@ <para>For both the Visitable and the Chainable types there are sets of templates for mock methods according to the number of parameters the method under test takes. But most of - the current compilers support a short hand version which selects the needed + the current compilers support a shorthand version which selects the needed template automatically.</para> <para>So the following lines are equivalent: @@ -230,14 +230,21 @@ <listitem>If you have overloaded methods you must use the extended macros as well. They extend the internal variables names which are derived form the method name. Otherwise there would be a conflict.</listitem> - <listitem>It may become necessary to implement <methodname>operator<<()</methodname> as + <listitem><para>It may become necessary to implement <methodname>operator<<()</methodname> as debug output is created this way. One approach is to provide a meaningful operator method. If this does not make much sense you may use a default template instead which simply outputs the raw classname. To avoid pontential conflicts this template must be enabled by setting the macro <token>MOCKPP_ENABLE_DEFAULT_FORMATTER</token> before including the first &mockpp; header - file.</listitem> + file.</para> + <para>It is also possible to re-use an existing + <methodname>operator<<(std::ostream & const T &val)</methodname>. + In this case you supply depending on the string type one of the macros + <token>MOCKPP_OWSTREAMABLE</token> + or <token>MOCKPP_OSTREAMABLE</token>. This implements a simple string translator function. + </para> + </listitem> </itemizedlist> </para> @@ -327,11 +334,15 @@ <para>After the last invocation to a mock object has occured you should always invoke <methodname>verify()</methodname> on the mock object to verify all pending expectations. Maybe there are some unused return objects or outstanding calls. If you use &cppunit; as -test framework you should the use <classname>VerifyingTestCase</classname> from &mockpp; +test framework you should use <classname>VerifyingTestCase</classname> from &mockpp; and register your mock objects on creation with it. In contrast to the standard <classname>TestCase</classname> from the &cppunit; package it invokes <methodname>verify()</methodname> on all mock objects after a test case passed. This way it is impossible to forget it.</para> +<para>Unfortunately this class is partially based on an error in reasoning and became +more complicated as originally thought. So it is less useful as expected. Decide +yourself if it is of any advantage in your application.</para> + </sect3> </sect2> Index: credits.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/credits.docbook,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- credits.docbook 20 Nov 2004 20:32:59 -0000 1.3 +++ credits.docbook 2 Dec 2005 17:28:36 -0000 1.4 @@ -8,10 +8,8 @@ <title>Credits and License</title> <para> -&mockpp; -</para> -<para> -Program copyright ©years; Ewald Arnold <email>&mockpp_email;</email> +Library &mockpp; +copyright ©years; Ewald Arnold <email>&mockpp_email;</email> </para> <para> @@ -33,4 +31,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</para> +<para>The files below the directory <filename>3party</filename> are copyright +of the respective owners. See the according files for details.</para> </chapter> Index: dev_advanced_easymock.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_advanced_easymock.docbook,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- dev_advanced_easymock.docbook 17 Nov 2005 21:08:52 -0000 1.9 +++ dev_advanced_easymock.docbook 2 Dec 2005 17:28:36 -0000 1.10 @@ -46,12 +46,12 @@ MyVisitableMockObject mvo("mvo"); - MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, access) access_ctr (&mvo); <co id="mock-controller-co" linkends="mock-controller" /> + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject, access) ctr (&mvo); <co id="mock-controller-co" linkends="mock-controller" /> - access_ctr.addThrowable(std::string("throw"), 2); <co id="mock-feed1-co" linkends="mock-feed1" /> - access_ctr.addResponseValue(1, 13); <co id="mock-feed2-co" linkends="mock-feed2" /> - access_ctr.addResponseValue(2, 37); - access_ctr.addResponseValue(3, lt(50u)); <co id="mock-gt-co" linkends="mock-gt" /> + ctr.addThrowable(std::string("throw"), 2); <co id="mock-feed1-co" linkends="mock-feed1" /> + ctr.addResponseValue(1, 13); <co id="mock-feed2-co" linkends="mock-feed2" /> + ctr.addResponseValue(2, 37); + ctr.addResponseValue(3, lt(50u)); <co id="mock-gt-co" linkends="mock-gt" /> mvo.access(1); <co id="mock-feed3-co" linkends="mock-feed3" /> mvo.access(13); @@ -83,12 +83,12 @@ </callout> <callout arearefs="mock-method-co" id="mock-method" > - <para>Similarly add another macro that implements the method with it's internal + <para>Similarly add another macro that implements the method with its internal variables and helper methods.</para> </callout> <callout arearefs="mock-controller-co" id="mock-controller" > - <para>Create a controller object for the method to set up it's + <para>Create a controller object for the method to set up its behaviour.</para> </callout> @@ -105,7 +105,7 @@ <callout arearefs="mock-gt-co" id="mock-gt" > <para>The former controller parameters where strict and demanded exact equality. By using <link linkend="parameter-constraint">constraint objects</link> it is possible - to use arbitrary tolerance. In the example the parameter must be greater than 50 + to use arbitrary tolerance. In the example the parameter must be less than 50 to return 3.</para> </callout> @@ -174,12 +174,12 @@ MyVisitableMockObject mvmo("mvmo"); - VisitableMockMethod1<int, unsigned> &access_ctr (mvmo.access_mocker); <co id="mockmeth-ref-co" linkends="mockmeth-ref" /> + VisitableMockMethod1<int, unsigned> &ctr (mvmo.access_mocker); <co id="mockmeth-ref-co" linkends="mockmeth-ref" /> - access_ctr.addThrowable(std::string("throw"), 2); - access_ctr.addResponseValue(1, 13); - access_ctr.addResponseValue(2, 37); - access_ctr.addResponseValue(3, eq(50u)); <co id="mockmeth-setup-co" linkends="mockmeth-setup" /> + ctr.addThrowable(std::string("throw"), 2); + ctr.addResponseValue(1, 13); + ctr.addResponseValue(2, 37); + ctr.addResponseValue(3, eq(50u)); <co id="mockmeth-setup-co" linkends="mockmeth-setup" /> mvmo.access(1); mvmo.access(13); @@ -214,7 +214,7 @@ <callout arearefs="mockmeth-var-co" id="mockmeth-var" > <para>Instantiate a mock method variable. Select the class according - to the parameters the method takes. There also a template without a trailing + to the parameters the method takes. There is also a template without a trailing number which handles an arbitrary parameter count.</para> </callout> Index: dev_basic.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_basic.docbook,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- dev_basic.docbook 24 Nov 2005 19:17:37 -0000 1.12 +++ dev_basic.docbook 2 Dec 2005 17:28:36 -0000 1.13 @@ -61,7 +61,12 @@ The most common application is the use of <classname>ExpectationValue</classname> which does an exact comparision. Your own data types should implement a meaningful <methodname>operator==()</methodname> to be usable with &mockpp;. -The following example creates an expectation value for <token>int</token> values. +Depending on your type <methodname>operator<()</methodname> +can replace the formar operator by supplying a template which does the following +computation: <code>!(x < y) && !(y < x)</code>.</para> + +<para>The following example creates an expectation value for <token>int</token> +values. <programlisting> @@ -151,7 +156,7 @@ <para> There are also cases where you have a number of values which must all occur but the -order is not relevant at all. t even does not matter if an actual value is added +order is not relevant at all. It even does not matter if an actual value is added more than once. For that purpose &mockpp; provides a set oriented data type. See the next example: @@ -268,10 +273,11 @@ If you want to track events which are related to each other you might use the two classes <classname>TrackingCounterMaster</classname> and <classname>TrackingCounterClient</classname>. The master contains -a shared conter value. Each time one of the clients is activated it gets the current value -from the master and stores it. The value inside the master is incremented at the same -time. This way you can roughly check the order in which the clients were accessed. -It is also possible to retrieve each counter value of a client and not only the last one. +a shared conter value. Each time one of the clients is activated it gets the +current value from the master and stores it. The value inside the master is +incremented at the same time. This way you can roughly check the order in which +the clients were accessed. It is also possible to retrieve each counter value +of a client and not only the last one. <programlisting> |