Thread: [Mockpp-commits] mockpp/mockpp/docs/en Makefile.am,1.29,1.30 customize.xsl.in,1.1,1.2 dev_advanced_j
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-09-23 20:53:22
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22270/mockpp/docs/en Modified Files: Makefile.am customize.xsl.in dev_advanced_jmock.docbook index.docbook Log Message: update for current features Index: customize.xsl.in =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/customize.xsl.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- customize.xsl.in 27 May 2005 08:15:53 -0000 1.1 +++ customize.xsl.in 23 Sep 2005 20:53:09 -0000 1.2 @@ -35,6 +35,7 @@ <xsl:param name="chapter.autolabel" select="1"/> <xsl:param name="appendix.autolabel" select="1"/> <xsl:param name="section.autolabel" select="1"/> +<!-- xsl:param name="section.autolabel.max.depth" select="4"/ --> <xsl:param name="section.label.includes.component.label" select="1"/> <xsl:param name="callout.graphics.number.limit" select="'15'"/> <xsl:param name="use.id.as.filename" select="'1'"/> Index: index.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/index.docbook,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- index.docbook 29 Jul 2005 08:02:06 -0000 1.30 +++ index.docbook 23 Sep 2005 20:53:09 -0000 1.31 @@ -11,7 +11,7 @@ <!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.09.00</releaseinfo>' > + <!ENTITY release_info '<releaseinfo>1.09.04</releaseinfo>' > <!ENTITY chap_bookinfo SYSTEM 'bookinfo.docbook' > <!ENTITY chap_intro SYSTEM 'intro.docbook' > Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/Makefile.am,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- Makefile.am 17 Sep 2005 15:18:09 -0000 1.29 +++ Makefile.am 23 Sep 2005 20:53:09 -0000 1.30 @@ -33,8 +33,10 @@ ln -s ../../examples/tutorial/html tutorial -test -L api-doc && rm api-doc ln -s ../../docs/api/html api-doc - -rm -rf ./var mkdir -pv var + -rm -rf ./var/*.html + -rm -rf ./var/common + -rm -rf ./var/images cp -R $(srcdir)/common var cp -R $(srcdir)/images var xsltproc -o var/ $(srcdir)/customize-chunked.xsl $(srcdir)/index.docbook @@ -44,8 +46,10 @@ ln -s ../../examples/tutorial/html tutorial -test -L api-doc && rm api-doc ln -s ../../docs/api/html api-doc - -rm -rf ./var mkdir -pv var + -rm -rf ./var/*.html + -rm -rf ./var/common + -rm -rf ./var/images cp -R $(srcdir)/common var cp -R $(srcdir)/images var xsltproc -o var/ $(srcdir)/customize-flat.xsl $(srcdir)/index.docbook @@ -55,12 +59,12 @@ ################################################################ pdf-files: - -rm -rf ./var mkdir -pv var + -rm -rf ./var/*.fo cp -R $(srcdir)/common var cp -R $(srcdir)/images var xsltproc --output var/mockpp.fo /usr/share/xml/docbook/stylesheet/nwalsh/current/fo/docbook.xsl $(srcdir)/index.docbook - fop var/mockpp.fo var/mockpp.pdf && mv var/mockpp.pdf $(top_builddir)/mockpp-$(VERSION)-handbook.pdf + fop var/mockpp.fo var/mockpp.pdf && cp var/mockpp.pdf $(top_builddir)/mockpp-$(VERSION)-handbook.pdf svg-files: xsltproc --output var/mockpp.fo /usr/share/xml/docbook/stylesheet/nwalsh/current/fo/docbook.xsl $(srcdir)/index.docbook Index: dev_advanced_jmock.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_advanced_jmock.docbook,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- dev_advanced_jmock.docbook 24 Jul 2005 12:54:37 -0000 1.9 +++ dev_advanced_jmock.docbook 23 Sep 2005 20:53:09 -0000 1.10 @@ -78,7 +78,7 @@ <title>Stubs And Expectations</title> <para>Chainable mock objects provide <emphasis>stubbed</emphasis> and -<emphasis>excpected</emphasis> methods. An expected method must occur as +<emphasis>expected</emphasis> methods. An expected method must occur as specified, otherwise the object will fail when verified. A stubbed method without specifiction may be invoked unlimited times or not at all but the test still passes.</para> @@ -158,10 +158,11 @@ <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>eq()</methodname> negates another contraint</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> @@ -170,6 +171,15 @@ <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 +<filename>constraint</filename> directory to get an idea how this can be done.</para> + +<para>Use method <methodname>with()</methodname> to pass the constraints. Obviously this +method has the same number of parameters as your mocked method.</para> + +<sect4 id="outbound-constraint"> +<title>Outbound Values</title> + <para id="outbound">There is one special constraint which is not actually a real constraint. <classname>OutBound</classname> does not check for incoming parameter values but passes values back by a reference. This enables mocked methods like the following: @@ -184,12 +194,58 @@ </programlisting> </para> +</sect4> -<para>Creating your own constraints is quite easy. Look at the files in the -<filename>constraint</filename> directory to get an idea how this can be done.</para> +<sect4 id="comparing-constraint"> +<title>Constraints for Comparison</title> -<para>Use method <methodname>with()</methodname> to pass the constraints. Obviously this -method has the same number of parameters as your mocked method.</para> +<para>&mockpp; contains two conststraint classes to compare objects. +<classname>IsEqual</classname> is probably appropriate for most cases. It takes +an object and stores it's value for later comparison.</para> + +<para><classname>IsSame</classname> on the other hand is intended to check +for identical values. This usually means to compare the pointer values +of two objects. There is a template function +<function>isSameComparison</function> which implements this default behaviour. +If you need a differing implementation for a certain class you can provide +a specialized template.</para> + +<para> +<note> +<title>Potential backwards compatibility break</title> +<para>&mockpp; up to version 1.9.3 implementated +<classname>IsEqual</classname> and <classname>IsSame</classname> +in exactly the same manner. +Unfortunately this may now lead to dangling pointers and crashes if +existing code referes to temporary objects.</para> + +<para>The following fragment shows the problem. When constructing +the object a temporary string is created and this pointer is +passed to the constructor of <classname>IsEqual</classname>. +After this statement the string object is destroyed and this pointer becomes +invalid. + +<programlisting> + + mockpp::IsSame<std::string> same ("string"); + +</programlisting> + +To avoid this problem you have to create a variable which must exist +until the test completes. + +<programlisting> + + std::string str ("string"); + mockpp::IsSame<std::string> same (str); + +</programlisting> + +</para> +</note> + +</para> +</sect4> </sect3> |