From 73194d7d28409c1c53e19420cf1417729d71bc02 Mon Sep 17 00:00:00 2001 From: Kallfaktorn Date: Thu, 5 May 2011 02:46:21 +0200 Subject: [PATCH] Added eqcmini quickcheck library to lib/ --- lib/eqc/LicenceAgreement.html | 49 ++++ lib/eqc/LicenceAgreement.rtf | 1 + lib/eqc/README | 27 ++ lib/eqc/doc/edoc-info | 2 + lib/eqc/doc/eqc.html | 385 +++++++++++++++++++++++++++ lib/eqc/doc/eqc_gen.html | 342 ++++++++++++++++++++++++ lib/eqc/doc/eqc_symbolic.html | 156 +++++++++++ lib/eqc/doc/erlang.png | Bin 0 -> 2109 bytes lib/eqc/doc/index.html | 17 ++ lib/eqc/doc/modules-frame.html | 14 + lib/eqc/doc/overview-summary.html | 53 ++++ lib/eqc/doc/overview.edoc | 39 +++ lib/eqc/doc/packages-frame.html | 11 + lib/eqc/doc/stylesheet.css | 55 ++++ lib/eqc/ebin/eqc.app | 7 + lib/eqc/examples/generators_eqc.erl | 227 ++++++++++++++++ lib/eqc/examples/ip_checksum.erl | 40 +++ lib/eqc/examples/ip_checksum_eqc.erl | 218 +++++++++++++++ lib/eqc/examples/lists_eqc.erl | 223 ++++++++++++++++ lib/eqc/examples/sets_eqc.erl | 146 ++++++++++ lib/eqc/include/eqc.hrl | 63 +++++ 21 files changed, 2075 insertions(+) create mode 100644 lib/eqc/LicenceAgreement.html create mode 100644 lib/eqc/LicenceAgreement.rtf create mode 100644 lib/eqc/README create mode 100644 lib/eqc/doc/edoc-info create mode 100644 lib/eqc/doc/eqc.html create mode 100644 lib/eqc/doc/eqc_gen.html create mode 100644 lib/eqc/doc/eqc_symbolic.html create mode 100644 lib/eqc/doc/erlang.png create mode 100644 lib/eqc/doc/index.html create mode 100644 lib/eqc/doc/modules-frame.html create mode 100644 lib/eqc/doc/overview-summary.html create mode 100644 lib/eqc/doc/overview.edoc create mode 100644 lib/eqc/doc/packages-frame.html create mode 100644 lib/eqc/doc/stylesheet.css create mode 100644 lib/eqc/ebin/eqc.app create mode 100644 lib/eqc/examples/generators_eqc.erl create mode 100644 lib/eqc/examples/ip_checksum.erl create mode 100644 lib/eqc/examples/ip_checksum_eqc.erl create mode 100644 lib/eqc/examples/lists_eqc.erl create mode 100644 lib/eqc/examples/sets_eqc.erl create mode 100644 lib/eqc/include/eqc.hrl diff --git a/lib/eqc/LicenceAgreement.html b/lib/eqc/LicenceAgreement.html new file mode 100644 index 0000000..6e2704a --- /dev/null +++ b/lib/eqc/LicenceAgreement.html @@ -0,0 +1,49 @@ + + + + + + + + + + + + + +

QuickCheck Mini

+

End User License Agreement

+


+

This end user license agreement ("eula") is a legal agreement between you and quviq. Read it carefully before using the software. It provides a license to use the software and contains warranty information and liability disclaimers. By installing, copying, or otherwise using the software, you agree to be bound by the terms of this agreement. If you do not agree to the terms of this agreement, do not install or use the software.

+


+


+

1 LICENSE GRANTS

+


+

• Quviq – Quviq AB grants you the non-exclusive right to use Quviq’s software program, QuickCheck Mini (the "SOFTWARE").

+


+

2 LICENSE RESTRICTIONS

+


+

• Distribution. You may freely distribute copies of the SOFTWARE to third parties or point them to the download location at www.quviq.com.

+

• Prohibition on Reverse Engineering, Decompilation, and Disassembly. You may not reverse engineer, decompile, or disassemble the SOFTWARE.

+

• Reservation of Rights. Quviq retains all rights not expressly granted.

+

 

+

3 DISCLAIMER OF WARRANTY AND LIABILITY

+


+

Limited warranty. The SOFTWARE is provided "as is", without warranty of any kind. To the maximum extent permitted by applicable law, Quviq hereby disclaim all warranties, either expressed or implied, including, but not limited to, the implied warranties of merchantability, fitness for a particular purpose, title, and non-infringement, with regard to the SOFTWARE, and the provision of or failure to provide support services. This limited warranty gives you specific legal rights. You may have others, which vary from state/jurisdiction to state/jurisdiction. 

+


+

Limitation of liability. To the maximum extent permitted by applicable law, in no event shall Quviq or its suppliers be liable for any special, incidental, indirect, or consequential damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use the SOFTWARE or the provision of or failure to provide support services, even if quviq has been advised of the possibility of such damages. In any case, Quviq’s entire liability under any provision of this eula shall be limited to the amount actually paid by you for the SOFTWARE.

+


+


+ + diff --git a/lib/eqc/LicenceAgreement.rtf b/lib/eqc/LicenceAgreement.rtf new file mode 100644 index 0000000..763c06e --- /dev/null +++ b/lib/eqc/LicenceAgreement.rtf @@ -0,0 +1 @@ +{\rtf1\adeflang1025\ansi\ansicpg10000\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\upr{\fonttbl{\f0\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f4\fbidi \fnil\fcharset0\fprq2{\*\panose 02000500000000000000}Times;} {\f23\fbidi \fnil\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\f24\fbidi \fnil\fcharset0\fprq2{\*\panose 02000503060000020004}Optima;}{\f25\fbidi \fnil\fcharset0\fprq2 Lucida Grande;} {\flomajor\f31500\fbidi \fnil\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\fdbmajor\f31501\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\fhimajor\f31502\fbidi \fnil\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbimajor\f31503\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\flominor\f31504\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\fhiminor\f31506\fbidi \fnil\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbiminor\f31507\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} }{\*\ud{\fonttbl{\f0\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f4\fbidi \fnil\fcharset0\fprq2{\*\panose 02000500000000000000}Times;}{\f23\fbidi \fnil\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} {\f24\fbidi \fnil\fcharset0\fprq2{\*\panose 02000503060000020004}Optima;}{\f25\fbidi \fnil\fcharset0\fprq2 Lucida Grande;}{\flomajor\f31500\fbidi \fnil\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} {\fdbmajor\f31501\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \fnil\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} {\fbimajor\f31503\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} {\fdbminor\f31505\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fnil\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} {\fbiminor\f31507\fbidi \fnil\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}}}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0; \red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red240\green145\blue0;} {\*\defchp \f31506\fs24 }{\*\defpap \ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1033 \ltrch\fcs0 \f31506\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\s1\ql \li0\ri0\widctlpar\tqr\tx9026\wrapdefault\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1033 \ltrch\fcs0 \b\f24\fs32\cf17\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon18 \snext0 \sautoupd \slink17 heading 1;}{\s2\ql \li0\ri0\sb200\sl276\slmult1 \keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel1\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ab\af31503\afs26\alang1033 \ltrch\fcs0 \b\fs26\cf17\lang1033\langfe1033\loch\f24\hich\af24\dbch\af31501\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \sautoupd \slink16 heading 2;}{\s3\ql \li0\ri0\sb200\sl276\slmult1\keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel2\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ab\af31503\afs24\alang1033 \ltrch\fcs0 \b\fs24\cf17\lang1033\langfe1033\loch\f24\hich\af24\dbch\af31501\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \sautoupd \slink15 heading 3;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1033 \ltrch\fcs0 \f31506\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af31503 \ltrch\fcs0 \b\cf17\loch\f24\hich\af24\dbch\af31501 \sbasedon10 \slink3 \slocked Heading 3 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\af31503 \ltrch\fcs0 \b\fs26\cf17\loch\f24\hich\af24\dbch\af31501 \sbasedon10 \slink2 \slocked Heading 2 Char;}{\*\cs17 \additive \rtlch\fcs1 \af0\alang1033 \ltrch\fcs0 \b\f24\fs32\cf17\lang1033\langfe0\langnp1033 \sbasedon10 \slink1 \slocked Heading 1 Char;}{\s18\ql \li0\ri0\widctlpar \tqc\tx4320\tqr\tx8640\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1033 \ltrch\fcs0 \f31506\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext18 \slink19 \ssemihidden header;}{\* \cs19 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \sbasedon10 \slink18 \slocked \ssemihidden Header Char;}{\s20\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\lisb1\lisa1 \rtlch\fcs1 \af0\afs20\alang1033 \ltrch\fcs0 \f4\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext20 \styrsid6106910 Normal (Web);}{\*\cs21 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \sbasedon10 \styrsid6106910 apple-converted-space;}}{\*\pgptbl {\pgp\ipgp0\itap0\li0\ri0\sb0\sa0}} {\*\rsidtbl \rsid6106910}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef0\mlMargin0\mrMargin0\mwrapRight0\mintLim0\mnaryLim0}{\info{\author Thomas Arts}{\operator Thomas Arts}{\creatim\yr2010\mo6\dy8\hr14\min55} {\revtim\yr2010\mo6\dy8\hr15\min8}{\version1}{\edmins10}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company Quviq AB}{\nofcharsws0}{\vern33033}{\*\saveprevpict}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}} \paperw11900\paperh16840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect \ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen \expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace360\dgvspace360\dghorigin1800\dgvorigin1440\dghshow0\dgvshow0 \jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct \asianbrkrule\rsidroot6106910\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\afelev\utinl\hwelev\notvatxbx \nouicompat \fet0{\*\wgrffmtfilter 013f}\nofeaturethrottle1\ilfomacatclnup0\stylesortmethod0\ltrpar \sectd \ltrsect\linex0\headery708\footery708\colsx708\endnhere\sectdefaultcl\sectrsid6106910\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3 \pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}} {\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ltrpar \s20\ql \li280\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin280\itap0\pararsid6106910 \rtlch\fcs1 \af0\afs20\alang1033 \ltrch\fcs0 \f4\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs34\insrsid6106910 QuickCheck Mini}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs34\insrsid6106910 \par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs34\insrsid6106910 End User License Agreement}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs34\insrsid6106910 \par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par }\pard \ltrpar\s20\qj \li280\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin280\itap0\pararsid6106910 {\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 This end user license agreement ("eula") is a legal agreement between you and quviq. Read it carefully before using the software. It provides a license to use the software and contains warranty information and li ability disclaimers. By installing, copying, or otherwise using the software, you agree to be bound by the terms of this agreement. If you do not agree to the terms of this agreement, do not install or use the software.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par }\pard \ltrpar\s20\ql \fi-280\li560\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin560\itap0\pararsid6106910 {\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par \par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 1\~LICENSE GRANTS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par \par }\pard \ltrpar\s20\ql \fi-300\li860\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin860\itap0\pararsid6106910 {\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 \bullet \~Quviq}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \endash Quviq AB grants you the non-exclusive right to use }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 Quviq\rquote s}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 software program, QuickCheck Mini (the } {\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 "SOFTWARE"}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 ). \par }\pard \ltrpar\s20\ql \fi-280\li560\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin560\itap0\pararsid6106910 {\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 2\~LICENSE RESTRICTIONS}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par \par }\pard \ltrpar\s20\ql \fi-300\li860\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin860\itap0\pararsid6106910 {\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 \bullet \~Distribution.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 You may freely distribute copies of the }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 SOFTWARE}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 to third parties or point them to the download location at ww w.quviq.com. \par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 \bullet Prohibition on Reverse Engineering, Decompilation, and Disassembly.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 You may not reverse engineer, decompile, or disassemble the }{ \rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 SOFTWARE. \par \bullet \~Reservation of Rights. Quviq }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 retains all rights not expressly granted.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910\charrsid6106910 \par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par }\pard \ltrpar\s20\ql \fi-280\li560\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin560\itap0\pararsid6106910 {\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 3\~DISCLAIMER OF WARRANTY AND LIABILITY}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par \par }\pard \ltrpar\s20\qj \fi-280\li560\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin560\itap0\pararsid6106910 {\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 Limited warranty.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 The }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 SOFTWARE}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 is provided "as is", without warranty of any kind. To the maximum extent permitted by applicable law, }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 Quviq}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 hereby disclaim all warranties, either expressed or implied, including, but not limited to, the implied w arranties of merchantability, fitness for a particular purpose, title, and non-infringement, with regard to the }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 SOFTWARE}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 , and the provision of or failure to provide support services. This limited warranty gives you specific legal rights. You may have others, which vary from state/jurisdiction to state/jurisdiction.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \cs21\f25\fs22\insrsid6106910 \~}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par \par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 Limitation of liability.}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 To the maximum extent permitted by applicable law, in no event shall }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 Quviq}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 or its suppliers be liable for any special, incidental, indirect, or consequential damages wh atsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use the }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 SOFTWARE}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 or the provision of or failure to provide support services, even if }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 quviq}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 has been advised of the possibility of such damages. In any case, }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 Quviq\rquote s}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 entire liability under any provision of this eula shall be limited to the amount actually paid by you for the }{\rtlch\fcs1 \af0 \ltrch\fcs0 \b\f25\fs22\insrsid6106910 SOFTWARE}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 . \par }\pard \ltrpar\s20\ql \fi-280\li560\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin560\itap0\pararsid6106910 {\rtlch\fcs1 \af0 \ltrch\fcs0 \f25\fs22\insrsid6106910 \par }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs24\alang1033 \ltrch\fcs0 \f31506\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid6106910 \par }{\*\themedata 504b0304140006000800000021001b898e1bfe0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cf6ac3300cc6ef83bd83f17524 4e77186324e961ed6efb73e81e40384a6296c8c6564bfbf653d216c62885c12e0659d2f7fd2495cbfd38a81dc6e43c557a91175a2159df38ea2afdb979c91eb5 4a0cd4c0e0092b7dc0a497f5ed4db939044c4aba2955ba670e4fc624dbe30829f7014932ad8f23b084b13301ec177468ee8be2c1584f8cc4194f1aba2e57d8c2 7660b5decbf79144dab57a3ed64d5695861006678105d44c595397ef021e5d83ea0322bfc128558605017fbe8bfcbad68e9a5fc0996f5b67b1f1763b0a663e4b defdc5f31548868dffe37c123b035c5856c4215dd9d685094fe7c8a573de68ea5d48670733dfb6fe060000ffff0300504b030414000600080000002100a5d6a7 e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4fc7 060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b63095120f 88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462a1 a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f7468656d 652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b4b 0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b47 57e8d3f729e245eb2b260a0238fd010000ffff0300504b0304140006000800000021009d5c8bbe10070000871d0000160000007468656d652f7468656d652f74 68656d65312e786d6cec594f6f1b4514bf23f11d467b6f13274e9a4475aad8b109b469a3d82dea71bc3bf64e33bbb39a1927f10db547242444411ca8c48d0302 2ab51297f269024550a47e05deccecae77e271e39400153487d63bfb7b6fdefbbd3ff367af5e3b4e183a2442529e3682dae5c5009134e4114d878de076af7369 2d4052e134c28ca7a4118c890cae6dbefbce55bca162921004f2a9dcc08d20562adb585890210c63799967248577032e12ace0510c1722818f406fc216961617 5717124cd300a53801b5b706031a12d4d32a83cd42799bc163aaa41e0899e86ad5c49130d8e8a0a611722c5b4ca043cc1a01cc13f1a31e39560162582a78d108 16cd5fb0b07975016fe4424ccd90adc875cc5f2e970b44074b664e31ec9793d63af5f52bdba57e03606a1ad76eb75bed5aa9cf00701882a7d696aace7a67add6 2c745640f6e7b4eed6e2ca62ddc557f42f4fd9bcde6c3657d6735bac5203b23feb53f8b5c5d5fad6928337208b5f99c2d79b5badd6aa8337208b5f9dc277aeac afd65dbc01c58ca60753681dd04e27d75e42069ced78e16b005f5bcce113146443995d7a8a014fd5ac5c4bf03d2e3a00d04086154d911a67648043c8e21666b4 2fa89e006f105c796387423935a4e742321434538de0830c43454cf4bd7cf6ddcb674fd0c9fda727f77f3c79f0e0e4fe0f569123b583d36155eac5379ffef1e8 23f4fb93af5f3cfcdc8f9755fc2fdf7ffcf34f9ff981503e13739e7ff1f8d7a78f9f7ff9c96fdf3ef4c0b704ee57e13d9a10896e9223b4cf1370ccb0e25a4efa e27c12bd18d3aac4563a9438c57a168ffeb68a1df4cd3166d8836b1297c13b02da870ff8dee89e637037162395c7dbf1ec7a9c38c05dce59930b2f0bd7f55c15 9a7ba374e89f5c8caab87d8c0f7d73b770eac4b73dcaa06f529fca564c1c33f7184e151e929428a4dff103423c7cdda5d4e1759786824b3e50e82e454d4cbd94 f468dfc9a689d00e4d202e639f81106f879bdd3ba8c999cfeb6d72e822a12a30f318df23cca1f13d3c5238f1a9ece1845509bf8155ec33b23b166115d7960a22 3d248ca37644a4f4c9dc12e06f25e8d7a175f8c3becbc6898b148a1ef874dec09c5791dbfca015e324f361bb348dabd8f7e501a428467b5cf9e0bbdcad10fd0c 71c0e9cc70dfa1c409f7d9dde0361d3a264d1244bf19091d4b68d54e074e68faaa769c4037ceddb9b8760c0df0f9578f3c99f5a636e22d20c157093ba7daef2c dce9a6dbe222a26f7ecfddc6a3748f409a4f2f3c6f5beedb961bfce75beeac7a9eb7d14e7a2bb45dbdbdb19b62b3454e66ee900794b1ae1a3372439a4db28475 22eac0a09633a743529e98b2187ee67dddc10d0536324870f521557137c6196cb06b81563294b9eaa144199770b033c35edd1a0f9b74658f852bfac060fb81c4 6a97477678590f17e782528d596d86e6f0594cb4ac15cc3bd9f2955c29b8fd3a93d5b45173cf5633a69956e7cc56ba0c319c760d064b3661038260db022cafc2 f95c4f0d0713cc48a479b76b6f11161385bf2744b9d7d6911847c486c819aeb05933b12b52c85c10404a7942773e364bd680b4b38d3069313b7fe624b9503021 5997dda96a6269b5b6588a8e1ac1facad24a80429c3582011c49e1679241d0a4deb26136847b9d50099bb567d6a229d289c7ebfeacaac12dc38c8271ca381352 6d6319db189a5779a858aa67b2f62fadd475b25d8c0336515fc38ae53548917fcd0a08b51b5a3218905055835d19d1dcd9c7bc13f29122a21b4747a8cf46621f 43f88153ed4f4425dc2c9882d60f700da6d936afdcde9a779aeae593c1d971ccb218e7dd525fa3141567e1a6de4a1bcc53c53cf0cd6bbb71eefcaee88abf2857 aa69fc3f73452f0770d05f8e740442b8851518e97a6d045ca8984317ca621a7604acfba67740b6c0552abc06f2e12ed8fc2fc8a1fedfd69cd561ca1ace6b6a9f 0e91a0b09ca85810b2076dc964df19ca6af9d26355b25c91c9a88ab932b366f7c921613ddd0357750f0e500ca96eba49de060cee74feb9cf7905f5877a8f52ad 37a787944ba7ad817f7ae3628b199c3ab597d0f95bf05f9ae859fdacbc112fd6c8aa23fac56497542faac259fcd6d7f3a95ed3847916e0ca5a6b3bd694c74b2b 857110c5698f61b0dccf64705d83f43fb0fe511132fb61412fa83dbe0fbd15c17702cb1f82acbea4bb1a64906e90f6571ff63d76d026935665a9cd773e9ab562 b1bee08d6a39ef29b2b565f3c4fb9c64979b28773aa7162f92ec9c61876b3b36936a88ece91285a141710e3181315fa4aa1f8d78ff1e047a1baee747cc7e4692 193c993ac8f684c9ae3e8fc6f94f26ed826bb34e9f613492a5fb648068745c9c3f4a266c09d94f19c516d9a0b5984eb45270d97768700573bc16b5ab6529bc74 b67029616686965d0a9b1b329f02f89095376e7db403bc6db2d66b5d5c05532cfd2b94cd61bc9f32efc9675ecaec41f195817a0dcad4f1ab29cb9902f2a6130f 3e450a0c4793aee9bfb0e8d84c3729bbf927000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f746865 6d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f2451ec ed0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198720e 274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528a2c6 cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d00140006000800000021001b898e1bfe0000001c02000013000000000000000000000000000000 00005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b000000000000000000000000002f 0100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000180200007468656d 652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021009d5c8bbe10070000871d0000160000000000000000000000 0000d50200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b0100002700000000000000 000000000000190a00007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000140b00000000} {\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d 617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} {\*\latentstyles\lsdstimax276\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority0 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority0 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; \lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; \lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; \lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading; \lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List; \lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1; \lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2; \lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3; \lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4; \lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5; \lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6; \lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference; \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography; \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010001000200000010000000584d4c2e5341585265616465722e3500000000000000000000060000 d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff5200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000500ffffffffffffffffffffffffec69d9888b8b3d4c859eaf6cd158be0f0000000000000000000000007982 49bc0b07cb01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000100010000000000}} \ No newline at end of file diff --git a/lib/eqc/README b/lib/eqc/README new file mode 100644 index 0000000..d3d4d75 --- /dev/null +++ b/lib/eqc/README @@ -0,0 +1,27 @@ +QuickCheck Mini + +This is a fully functional stripped down version of Quviq QuickCheck. + +QuickCheck Mini is free of charge and the latest version can be +downloaded from Quviq's homepage. The Mini version of QuickCheck is +intended to support individuals and open source projects in obtaining +a better code quality without having to invest in the full version of +QuickCheck. + +QuickCheck Mini is installed by copying the complete directory +eqc-.... into the Erlang library directory or by pointing to it by +using the code:add_patha/1 function in the Erlang distribution. + +Examples are provided to illustrate how it works. + +You can subscribe to quickcheck-questions@quviq.com by sending +"Subscribe" in the subject line. This is a community email list around +the use of QuickCheck. + +Please note that although QuickCheck Mini does not require a licence +check with the Quviq licence server, it does check for a new version +each time it is started, and will notify you if one is available. No +other information is included in the request, and QuickCheck Mini will +start regardless of whether or not the version check succeeds, but +(because there is a short time-out) will start slightly more quickly +when it succeeds. diff --git a/lib/eqc/doc/edoc-info b/lib/eqc/doc/edoc-info new file mode 100644 index 0000000..063aae8 --- /dev/null +++ b/lib/eqc/doc/edoc-info @@ -0,0 +1,2 @@ +{packages,[]}. +{modules,[eqc,eqc_gen,eqc_symbolic]}. diff --git a/lib/eqc/doc/eqc.html b/lib/eqc/doc/eqc.html new file mode 100644 index 0000000..4b01957 --- /dev/null +++ b/lib/eqc/doc/eqc.html @@ -0,0 +1,385 @@ + + + +Module eqc + + + + +
+ +

Module eqc

+This module defines functions for writing and testing QuickCheck properties. + +

Version: 1.0.1

+ +

Description

This module defines functions for writing and testing QuickCheck properties. + Much of the interface is provided via macros (defined in eqc.hrl). + These are documented below: +

?FORALL(X,Gen,Prop)

+ Property that holds if Prop holds for all values X that + can be generated by Gen. For example, +
+ prop_reverse() ->
+   ?FORALL(Xs,list(int()),
+      lists:reverse(lists:reverse(Xs)) == Xs).
+ 
+ Generators are defined using the module eqc_gen. +

?IMPLIES(Pre,Prop)

+ Property that holds if Prop holds whenever the precondition + Pre is true. The precondition must be a boolean, but Prop + can be any QuickCheck property. An implication is tested by discarding test + cases which do not satisfy the precondition. This can make testing slow, + since many more test cases may need to be generated to find 100 which + satisfy the precondition. In the worst case, QuickCheck may not be able + to find enough test cases that do satisfy the precondition, in which case + the number actually found is reported. Some preconditions may also skew + the test data badly--for example, a precondition that a list is sorted + skews the test data towards short lists, since random longer lists are + extremely unlikely to be sorted just by chance. ?IMPLIES works + well for preconditions which are true with a high probability, but if the + precondition is unlikely to hold, then it is better to write a custom + generator which generates test cases where the precondition is true. +

?WHENFAIL(Action,Prop)

+ Property that is equivalent to Prop, but performs Action + (for its side effects) when Prop fails. This can be used to +print additional information when a test case fails.

+ + + + +

Data Types

+ +

counterexample()

+

abstract datatype: counterexample()

+

A counter-example to a QuickCheck property, which can be obtained + using counterexample/0 or counterexample/1, and used to repeat a test, + or test a different property in the same case. Counterexamples are represented by the values + bound by ?FORALL--for the counterexample to make sense independently, it's important that + these were generated without side-effects.

+ +

print_method()

+

print_method() = (list(term())) -> any()

+

A function for + printing statistics, which is passed a list of samples and is + expected to print statistical information about them. Print methods + are used by collect/3 and aggregate/3.

+ +

property()

+

abstract datatype: property()

+

QuickCheck properties, which can either be boolean + expressions, or constructed using the functions in this module. + QuickCheck properties are tested using quickcheck/1.

+ +

Function Index

+ + + + + + + + + + + + + + + + + + + + + + + + + +
aggregate/2A property logically equivalent to Prop, but which collects a list of values in + each test, and displays the distribution of these values once + testing is complete.
aggregate/3Like aggregate/2, but allows the user to specify how + the collected values should be printed.
backtrace/0Displays a stack backtrace from the last exception QuickCheck caught.
check/2Tests the property in the case given.
classify/3Property which is logically equivalent to Prop, but also + classifies test cases and displays the distribution of test case classes + when testing is complete.
collect/2Equivalent to aggregate([S], Prop). +
collect/3Equivalent to aggregate(PrintMethod, [S], Prop). +
counterexample/0Returns the last counter-example found.
counterexample/1Tests the property in the same way as quickcheck/1, but if + a test fails, then the failing test case is returned as a counterexample.
counterexamples/0Returns a list of the counterexamples found by the last call + of eqc:module, paired with the name of the property that failed.
current_counterexample/0Returns the most recent + counterexample found by QuickCheck.
equals/2A property which holds if X and Y are equal...
fails/1A property which succeeds when its argument fails.
measure/3Collects the values of X while testing Prop, and if all tests + pass, displays statistics such as the minimum, average, and maximum + values, identified by the name Name.
module/1Tests all the properties exported from a module, given the module name.
numtests/2Property which is logically equivalent to Prop, but is + tested N times rather than 100.
on_output/2Supplies an output function to be used instead of io:format + when QuickCheck generates output.
on_test/2Attaches a function to a property which is called every time a + test passes or fails.
quickcheck/1Tests the property in 100 random cases, printing a counter-example + if one is found.
recheck/1Tests the property with the same random number seed as + the last failing call of quickcheck/1.
start/0Equivalent to start(true). +
start/1Starts the QuickCheck server.
stop/0Stops the QuickCheck server.
version/0
with_title/1A printing method for collected data, which displays a title + before + the percentages of each value in the data.
+ +

Function Details

+ +

aggregate/2

+
+

aggregate(L::list(term()), Prop::property()) -> property()

+

A property logically equivalent to Prop, but which collects a list of values in + each test, and displays the distribution of these values once + testing is complete. A typical use would be to aggregate the list of command names generated + by eqc_statem:commands/1, in order to see how often each individual + command appeared in generated tests: +

aggregate(command_names(Cmds), ...) 
+

+ See also aggregate/3. +

+ +

aggregate/3

+
+

aggregate(PrintMethod::(list(term())) -> any(), L::list(term()), Prop::property()) -> property()

+

Like aggregate/2, but allows the user to specify how + the collected values should be printed. The PrintMethod parameter + is called with a sorted list of the collected data as an argument, + and is expected to print some statistics. A predefined printing + methods is provided to add a title to the statistics: +

aggregate(with_title(T),L,Prop)
. This is useful when a property contains + several calls to aggregate or collect.

+ +

backtrace/0

+
+

backtrace() -> ok

+

Displays a stack backtrace from the last exception QuickCheck caught. Note that + this is only possible if the exception is raised in the process in which the test + case starts. If a test case fails because of an exception in another, linked, + process, then no backtrace is available. Calls to functions in the implementation + of QuickCheck itself are not included in the backtrace. +

If you really need to see a backtrace from a linked process, then you can do so by + catching + the exception yourself in that process, using erlang:get_stacktrace() to obtain the + backtrace, and printing it yourself.

+ +

check/2

+
+

check(P::property(), Values::counterexample()) -> bool()

+

Tests the property in the case given. Counterexamples are generated by testing a + property using counterexample/1 or counterexample/0, and contain a list + of the values bound by ?FORALL. A property tested by check should begin with the same + sequence of ?FORALL s as the property from which the counterexample was generated, otherwise + the results will be unpredictable. In particular, there is no check that the values + in the counterexample could actually have been generated by the ?FORALL s in the property under + test. +

check/2 can be used without a QuickCheck licence, allowing anyone to run + tests that a licenced user has generated.

+ +

classify/3

+
+

classify(B::bool(), S::term(), Prop::property()) -> property()

+

Property which is logically equivalent to Prop, but also + classifies test cases and displays the distribution of test case classes + when testing is complete. If the boolean is true then the current test case is + labelled with the term S, + and, after testing is complete, QuickCheck prints out the percentage of + test cases carrying each label. This can be used to check that the space + of possible test cases has been covered reasonably well. For example, + classifying test cases according to the length of a list enables one to + see whether unreasonably many lists were short. Classifying + test cases is a way to discover skewed distributions, such as can arise + from using ?IMPLIES. It is good practice to check the distribution + of test data using classify or collect/2, at least while + properties are being developed. +

+ Each test case can be labelled with any number of labels: QuickCheck then + displays the percentage of each label in the generated + test data. +

+

+ Calls of classify or collect can be nested, in which case each call + generates its own table of distributions. +

+ +

collect/2

+
+

collect(S::term(), Prop::property()) -> property()

+

Equivalent to aggregate([S], Prop).

+ + +

collect/3

+
+

collect(PrintMethod::(list(term())) -> any(), S::term(), Prop::property()) -> property()

+

Equivalent to aggregate(PrintMethod, [S], Prop).

+ + +

counterexample/0

+
+

counterexample() -> undefined | counterexample()

+

Returns the last counter-example found. See counterexample/1.

+ +

counterexample/1

+
+

counterexample(P::property()) -> true | counterexample()

+

Tests the property in the same way as quickcheck/1, but if + a test fails, then the failing test case is returned as a counterexample.

+ +

counterexamples/0

+
+

counterexamples() -> list({atom(), counterexample()})

+

Returns a list of the counterexamples found by the last call + of eqc:module, paired with the name of the property that failed.

+ +

current_counterexample/0

+
+

current_counterexample() -> counterexample()

+

Returns the most recent + counterexample found by QuickCheck. This can be used while + QuickCheck is shrinking a failed test case to follow progress, or if + shrinking must be interrupted, to recover the last failed test case + that QuickCheck had found. The counterexample is fetched from a file + in the current directory.

+ +

equals/2

+
+

equals(X::any(), Y::any()) -> property()

+

A property which holds if X and Y are equal... and displays + their values when a test fails.

+ +

fails/1

+
+

fails(P::property()) -> property()

+

A property which succeeds when its argument fails. + Sometimes it is useful to write down properties which do not hold + (even though one might expect them to). This can help prevent misconceptions. + fails(P) is tested in the same way as P, but + fails only if P succeeds 100 times. Thus + fails(P) declares that QuickCheck should be able to find + a counter-example to property P.

+ +

measure/3

+
+

measure(Name::atom() | string(), X::number() | list(number()), Prop::property()) -> property()

+

Collects the values of X while testing Prop, and if all tests + pass, displays statistics such as the minimum, average, and maximum + values, identified by the name Name. X can also be a list of values, + in which case all of them are included in the measurements.

+ +

module/1

+
+

module(Mod::atom()) -> list(atom())

+

Tests all the properties exported from a module, given the module name. + Any function with arity zero whose name begins with "prop_" is treated as a + property. The result is a list of the names of the properties that + failed. See also module/2.

+ +

numtests/2

+
+

numtests(N::int(), Prop::property()) -> property()

+

Property which is logically equivalent to Prop, but is + tested N times rather than 100. If numtests appears more than once + in a property, then the outermost use takes precedence.

+ +

on_output/2

+
+

on_output(Fun::(string(), list(term())) -> any(), Prop::property()) -> property()

+

Supplies an output function to be used instead of io:format + when QuickCheck generates output. All output generated by + QuickCheck is passed to Fun, in the form of a format + string and a list of terms--the same arguments expected by + io:format. By supplying a function which does nothing, + QuickCheck can be run silently. By supplying a function which + writes to a file, all QuickCheck output can be saved. +

Note that output generated by user code is not passed to + this output function. For example, calls to io:format in the + property, or in the code under test, will generate output in the + shell as usual. This applies even to calls inside a + ?WHENFAIL. If you want to redirect such output also, then + you need to modify your own code appropriately.

+

The reason that Fun is passed a format string and + arguments, rather than an already formatted string, is to make it + easier to extract information from the output without parsing + it. However, there is no guarantee that different versions of + QuickCheck will use the same format strings and term lists--you use + this information at your own risk, in other words.

+ +

on_test/2

+
+

on_test(Fun::(counterexample(), bool()) -> any(), Prop::property()) -> property()

+

Attaches a function to a property which is called every time a + test passes or fails. The arguments are the test case (a list of + values), and a boolean indicating whether or not the test + passed. Tests which are skipped (because of an + ?IMPLIES(false,...)) are not included.

+ +

quickcheck/1

+
+

quickcheck(P::property()) -> bool()

+

Tests the property in 100 random cases, printing a counter-example + if one is found. Initially small test cases are generated, then the + size increases as testing progresses (see eqc_gen, ?SIZED, + eqc_gen:resize/2 for the way size affects test data generation). + The result is true if all tests succeeded (or if one failed, + and failure was expected). On success, quickcheck analyses + the distribution of test case labels. On failure, quickcheck + tries to simplify the counter-example found as far as possible (see + shrinking, described in eqc_gen).

+ +

recheck/1

+
+

recheck(Prop::property()) -> bool()

+

Tests the property with the same random number seed as + the last failing call of quickcheck/1. If the property is + the same as in that last call, then the same test case will be + generated. Note that recheck repeats the test and its + shrinking. This can be used to adjust the shrinking strategy in + the property, then reshrink the same counterexample, perhaps to a + better result. If you just + want to repeat the shrunk test, then use +

eqc:check(Prop,eqc:counterexample())
instead. +

Note: the type and behaviour of recheck changed in version 1.19.

+ +

start/0

+
+

start() -> any()

+

Equivalent to start(true).

+ + +

start/1

+
+

start(Force::bool()) -> pid()

+

Starts the QuickCheck server. If it is already running on this +node, nothing is done.

+ + Each user can run only one instance of the QuickCheck server at a + time. If the server is already running on another Erlang node, it + will be terminated automatically if Force is + true. If another instance is running, and Force is + false, then the new instance will not start.

+ +

stop/0

+
+

stop() -> any()

+

Stops the QuickCheck server. + QuickCheck properties are tested in the QuickCheck server process, which is + spawned automatically when quickcheck is first called. Usually there is no + need to stop the QuickCheck server explicitly, but if a need does arise + then this function can be used. For example, if the shell process crashes + and is restarted, then the QuickCheck server should be stopped and restarted + too, since otherwise the server will crash when it attempts to write to the + console.

+ +

version/0

+
+

version() -> any()

+
+ +

with_title/1

+
+

with_title(Title::atom() | string()) -> print_method()

+

A printing method for collected data, which displays a title + before + the percentages of each value in the data. It is intended to be + passed to collect/3 or aggregate/3.

+
+ + +

Generated by EDoc, Jun 13 2010, 13:15:30.

+ + diff --git a/lib/eqc/doc/eqc_gen.html b/lib/eqc/doc/eqc_gen.html new file mode 100644 index 0000000..adaa713 --- /dev/null +++ b/lib/eqc/doc/eqc_gen.html @@ -0,0 +1,342 @@ + + + +Module eqc_gen + + + + +
+ +

Module eqc_gen

+ + This module implements QuickCheck generators. + +

Version: 1.0.1

+ +

Description

+ This module implements QuickCheck generators. + QuickCheck generators are used to generate random test data for + QuickCheck properties. A generator specifies three things at the same + time: + + QuickCheck permits constants to be used as generators for their own value, + and also permits tuples, records, and lists containing generators to be + used as generators for values of the same form. For example, +
 {int(),bool()} 
+ is a generator that generates random pairs of integers and booleans. +

+ Many of the functions in this module are usually used via macros, defined + in eqc.hrl. These macros are listed here. +

?LET(Pat,G1,G2)

+ Generates a value from G1, + binds it to Pat, then generates a value from G2 + (which may refer to the variables bound in Pat). +

The + result is shrunk by first shrinking the value generated by + G1 while the test still fails, then shrinking the value + generated by G2. It is thus better to write + ?LET({X,Y},{G1,G2},G3) than + ?LET(X,G1,?LET(Y,G2,G3)) (provided G2 does + not depend on X), since in the first case shrinking can + shrink G1 a bit, shrink G2, then shrink + G1 some more, while in the second case G1 + cannot be shrunk further once shrinking G2 has begun.

+

?SIZED(Size,G)

+ Binds the variable Size to the current size parameter for + generation. G may use Size in any way to control the + size of generated data. However, as Size increases, + the set of possible values that G can generate should also + increase. Size is always a natural number, and increases during + QuickCheck testing from a small value up to about 40. See also + resize/2 and pick/2. +

?SUCHTHAT(X,G,P)

+ Generates values X from G such that the condition P is true. + Should only be used if the probability that P holds is reasonably high for values + generated by G--otherwise generation may be slow, and the + distribution of generated values may be skewed. For example, +
?SUCHTHAT(Xs,list(int()),lists:sort(Xs)==Xs)
+ generates predominantly very short lists, since the probability that a random longer list + will just happen to be sorted is very low. If no value is found within 100 attempts, + then ?SUCHTHAT exits. + + +

?LETSHRINK(Pat,G1,G2)

+ This behaves in the same way as ?LET(Pat,G1,G2), except + that G1 must generate a list of values, and each one of these + values is added as a possible shrinking of the result. This is intended for + use in generating tree-like structures. For example, +
+ ?LETSHRINK([L,R],[tree(),tree()],{branch,L,R})
+ generates a tree node {branch,L,R}, which can shrink to either + L or R. +

?LAZY(G)

+ A generator equivalent to its argument, but which is always cheap to construct. To be used, + for example, in recursive generators to avoid building a huge generator, only a small part + of which will be used. +

+

Data Types

+ +

box()

+

abstract datatype: box(A)

+

Boxes are not supported in this version of QuickCheck.

+ +

gen()

+

abstract datatype: gen(A)

+

A QuickCheck generator for values of type A. + QuickCheck generators are first-class + values, and can be used repeatedly to generate many different values.

+ +

proplist()

+

proplist() = list({atom(), term()})

+

A property list associating values with names. + See the standard module proplists.

+ +

Function Index

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
binary/0Generates a binary of random size.
binary/1Generates a binary of a given size in bytes.
bitstring/0Generates a list of bits in a bitstring.
bitstring/1Generates a bitstring of a given size in bits.
bool/0Generates a random boolean.
char/0Generates a random character.
choose/2Generates a number in the range M to N.
default/2Adds a default value to a generator, to be chosen half the time.
elements/1Generates an element of the list argument.
eval/1Evaluates terms of the form {call,Module,Function,Args} anywhere in its + argument, replacing them by the result of the corresponding function call.
eval/2Like eval/1, but also replaces symbolic variables, that is, + terms of the form {var,V}, by their corresponding values in the + property list.
frequency/1Makes a weighted choice between the generators in its argument, such that the + probability of choosing each generator is proportional to the weight paired with it.
function0/1Generates a function of no arguments with result generated by G.
function1/1Generates a function of one argument with result generated by G.
int/0Generates a small integer (with absolute value bounded by the generation size).
is_generator/1Returns true if the argument is a QuickCheck generator.
largeint/0Generates an integer from a large range.
list/1Generates a list of elements generated by its argument.
nat/0Generates a small natural number (bounded by the generation size).
non_empty/1Make sure that the generated value is not empty.
noshrink/1Generates the same values as G, but these values are never + shrunk.
oneof/1Generates a value using a randomly chosen element of the list of generators.
orderedlist/1Generates an ordered list of elements generated by G.
real/0Generates a real number.
resize/2Binds the generation size parameter to Size within G.
return/1Constructs a generator that always generates the value + X.
sample/1Prints 11 values randomly generated by G, for sizes ranging + from 10 to 20.
sampleshrink/1Prints a value generated by G, followed by one way of shrinking it.
shuffle/1Shuffles a list and shrinks to the unshuffled list.
vector/2Generates a list of the given length, with elements generated by G.
+ +

Function Details

+ +

binary/0

+
+

binary() -> gen(binary())

+

Generates a binary of random size. The binary shrinks both in + size as well as in content. If you consider the + binary as a representation of a number, then each shrinking step + will result in a smaller-or-equal number.

+ +

binary/1

+
+

binary(NrBytes::int()) -> gen(binary())

+

Generates a binary of a given size in bytes. When shrinking, + the size is unchanged, but content shrinks like binary/0.

+ +

bitstring/0

+
+

bitstring() -> gen(bitstring())

+

Generates a list of bits in a bitstring. For Erlang release R12B and + later. + The bitstring shrinks both in + size as well as in content. If you consider the + bitstring as a representation of a number, then each shrinking step + will result in a smaller-or-equal number.

+ +

bitstring/1

+
+

bitstring(NrBits::int()) -> gen(bitstring())

+

Generates a bitstring of a given size in bits. For Erlang + release R12B and later. When shrinking, + the size is unchanged, but content shrinks like bitstring/0.

+ +

bool/0

+
+

bool() -> gen(bool())

+

Generates a random boolean. Shrinks to false.

+ +

char/0

+
+

char() -> gen(char())

+

Generates a random character. Shrinks to a, b or c.

+ +

choose/2

+
+

choose(M, N::integer()) -> gen(integer())

+

Generates a number in the range M to N. + The result shrinks towards smaller absolute values.

+ +

default/2

+
+

default(Default::A, G::gen(A)) -> gen(A)

+

Adds a default value to a generator, to be chosen half the time. Any + other value shrinks to the default.

+ +

elements/1

+
+

elements(Xs::list(A)) -> gen(A)

+

Generates an element of the list argument. Shrinking chooses an earlier element.

+ +

eval/1

+
+

eval(Term::term()) -> term()

+

Evaluates terms of the form {call,Module,Function,Args} anywhere in its + argument, replacing them by the result of the corresponding function call. + This is useful when, for example, test data is of an abstract datatype, and + we want to know how it was generated, rather than its representation--it is + much clearer to see that a test failed for sets:new() (that is + {call,sets,new,[]}), for example, + than for its representation. + We write ?FORALL(X,TGen,...eval(X)...), where TGen + generates terms containing calls, so that test cases are displayed in this + form, but the actual test data is the result of evaluating the calls.

+ +

eval/2

+
+

eval(Env::proplist(), T::term()) -> term()

+

Like eval/1, but also replaces symbolic variables, that is, + terms of the form {var,V}, by their corresponding values in the + property list. This should be a list of pairs of atoms and values. For example, + eval([{x,3}],{var,x}) evaluates to 3.

+ +

frequency/1

+
+

frequency(FGs::list({integer(), gen(A)})) -> gen(A)

+

Makes a weighted choice between the generators in its argument, such that the + probability of choosing each generator is proportional to the weight paired with it. + The + weights should be non-negative integers and sum to a positive value. A generator + with a weight of zero will not be chosen.

+ +

function0/1

+
+

function0(G::gen(A)) -> gen(() -> A)

+

Generates a function of no arguments with result generated by G.

+ +

function1/1

+
+

function1(G::gen(A)) -> gen((term()) -> A)

+

Generates a function of one argument with result generated by G. + The generated function is pure--will always return the same result for the same argument-- + and the result depends randomly on the argument.

+ +

int/0

+
+

int() -> gen(integer())

+

Generates a small integer (with absolute value bounded by the generation size).

+ +

is_generator/1

+
+

is_generator(X::any()) -> bool()

+

Returns true if the argument is a QuickCheck generator.

+ +

largeint/0

+
+

largeint() -> any()

+

Generates an integer from a large range.

+ +

list/1

+
+

list(G::gen(A)) -> gen(list(A))

+

Generates a list of elements generated by its argument. Shrinking drops elements + from the list. The length of the list varies up to one third of the generation size parameter.

+ +

nat/0

+
+

nat() -> gen(integer())

+

Generates a small natural number (bounded by the generation size).

+ +

non_empty/1

+
+

non_empty(G::gen(A)) -> gen(A)

+

Make sure that the generated value is not empty. + For example when creating a list of integers, but the list should always + contain at least one element non_empty(list(int())).

+ +

noshrink/1

+
+

noshrink(G::gen(A)) -> gen(A)

+

Generates the same values as G, but these values are never + shrunk.

+ +

oneof/1

+
+

oneof(Gs::list(gen(A))) -> gen(A)

+

Generates a value using a randomly chosen element of the list of generators.

+ +

orderedlist/1

+
+

orderedlist(G::gen(A)) -> gen(list(A))

+

Generates an ordered list of elements generated by G.

+ +

real/0

+
+

real() -> gen(float())

+

Generates a real number.

+ +

resize/2

+
+

resize(Size::integer(), G::gen(A)) -> gen(A)

+

Binds the generation size parameter to Size within G. + Size should never be negative.

+ +

return/1

+
+

return(X::A) -> gen(A)

+

Constructs a generator that always generates the value + X. Most values can also be used as generators for + themselves, making return unnecessary, but + return(X) may be more efficient than using X as a + generator, since when return(X) is used then QuickCheck + does not traverse X searching for values to be intepreted + specially.

+ +

sample/1

+
+

sample(G::gen(A)) -> ok

+

Prints 11 values randomly generated by G, for sizes ranging + from 10 to 20.

+ +

sampleshrink/1

+
+

sampleshrink(G::gen(A)) -> ok

+

Prints a value generated by G, followed by one way of shrinking it. + Each following line displays a list of values that the first value on the + previous line can be shrunk to in one step. Thus the output traces the leftmost path + through the shrinking tree.

+ +

shuffle/1

+
+

shuffle(List::list(A)) -> gen(list(A))

+

Shuffles a list and shrinks to the unshuffled list.

+ +

vector/2

+
+

vector(K::integer(), G::gen(A)) -> gen(list(A))

+

Generates a list of the given length, with elements generated by G.

+
+ + +

Generated by EDoc, Jun 13 2010, 13:15:30.

+ + diff --git a/lib/eqc/doc/eqc_symbolic.html b/lib/eqc/doc/eqc_symbolic.html new file mode 100644 index 0000000..d53a39c --- /dev/null +++ b/lib/eqc/doc/eqc_symbolic.html @@ -0,0 +1,156 @@ + + + +Module eqc_symbolic + + + + +
+ +

Module eqc_symbolic

+ +This module implements QuickCheck generators and utility functions for +symbolic calls. + +

Version: 1.0.1

+ +

Description

+This module implements QuickCheck generators and utility functions for +symbolic calls.

+ +

In test case generation it is often an advantage to postpone calling +functions in the subject under test. In a test one is interested in +the actual function that is called as well as its evaluated result. +If one would evaluate the result already at generation time, then the actual +call is not visible in the QuickCheck counter example shown in a +failing test.

+ +

For example, when testing a data structure like the OTP library sets.erl, +one may need more information than just the value to detect what goes +wrong with the following property:

+ +
+ prop_sets() ->
+  ?FORALL({S1,S2},{set(),set()},
+          begin
+              L1 = sets:to_list(S1),
+              L2 = sets:to_list(S2),
+              sets:intersection(S1,S2) ==
+                  sets:from_list(L1--(L1--L2))
+          end).
+ 
+ + which will fail with for example the following counter example: +
+  Failed! After 132 tests.
+  Shrinking.......(7 times)
+  {{set,2,16,16,8,80,48,
+        {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
+        {{[],[],[],[],[],[],[],[],[],[],[],[-15,33],[],[],[],[]}}},
+   {set,3,16,16,8,80,48,
+        {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
+        {{[0],[],[],[],[],[],[],[],[],[],[],[33,-15],[],[],[],[]}}}}
+  false
+ 
+ + We would really need to understand the internal representation of sets in order to understand which + sets we have generated and even if we know that, we have no clue which operations were used to + create those sets. + This is were symbolic representations help a lot. We would create a recursive generator that + creates symbolic sets and use the following property instead: +
+  prop_sets() ->
+    ?FORALL({SymbS1,SymbS2},{set(),set()},
+            begin
+              S1 = eval(SymbS1),
+              S2 = eval(SymbS2),
+              L1 = sets:to_list(S1),
+              L2 = sets:to_list(S2),
+              sets:intersection(S1,S2) ==
+                 sets:from_list(L1--(L1--L2))
+            end).
+ 
+  This would then result in a more readable error message:
+  Shrinking..........(10 times)
+  {{call,sets,from_list,[[6,-10]]},{call,sets,from_list,[[0,-10,6]]}}
+  false
+ 
+ + Symbolic representation of function calls provides us with + +

Function Index

+ + + + + + +
defined/1Checks whether a term can be evaluated without raising an exception.
eval/1Evaluates terms of the form {call,Module,Function,Args} anywhere in its + argument, replacing them by the result of the corresponding function call.
eval/2Like eval/1, but also replaces symbolic variables, that is, + terms of the form {var,V}, by their corresponding values in the + property list.
pretty_print/1Pretty printing of symbolic terms.
pretty_print/2Pretty printing of symbolic terms within given environment.
well_defined/1Generates a well defined symbolic value.
+ +

Function Details

+ +

defined/1

+
+

defined(E::term()) -> bool()

+

Checks whether a term can be evaluated without raising an exception. + Some symbolic terms may raise an exception when evaluating, e.g., division by zero would + raise an exception, thus eval({call,erlang,'div',[1,0]}) raises an exception as well.

+ +

eval/1

+
+

eval(Term::term()) -> term()

+

Evaluates terms of the form {call,Module,Function,Args} anywhere in its + argument, replacing them by the result of the corresponding function call. + This is useful when, for example, test data is of an abstract datatype, and + we want to know how it was generated, rather than its representation--it is + much clearer to see that a test failed for sets:new() (that is + {call,sets,new,[]}), for example, + than for its representation. + We write ?FORALL(X,TGen,...eval(X)...), where TGen + generates terms containing calls, so that test cases are displayed in this + form, but the actual test data is the result of evaluating the calls.

+ +

eval/2

+
+

eval(Env::proplist(), T::term()) -> term()

+

Like eval/1, but also replaces symbolic variables, that is, + terms of the form {var,V}, by their corresponding values in the + property list. This should be a list of pairs of atoms and values. For example, + eval([{x,3}],{var,x}) evaluates to 3.

+ +

pretty_print/1

+
+

pretty_print(Symb::term()) -> string()

+

Pretty printing of symbolic terms. + A symbolic value like {call,sets,union,[{call,sets,new,[]},{call,sets,from_list,[[1,2]]}]} + is transformed to the string \"sets:union(sets:new(),from_list([1,2]))\".

+ +

pretty_print/2

+
+

pretty_print(Env::proplist(), Symb::term()) -> string()

+

Pretty printing of symbolic terms within given environment. + Like pretty_print/1, but also replaces symbolic variables, that is, + terms of the form {var,V}, by their corresponding values in the + property list. This should be a list of pairs of atoms and values. For example, + eval([{x,3}],{var,x}) is pretty printed to \"3\".

+ +

well_defined/1

+
+

well_defined(G::gen(A)) -> A

+

Generates a well defined symbolic value. + A value is well defined if evaluating it does not raise an exception.

+
+ + +

Generated by EDoc, Jun 13 2010, 13:15:30.

+ + diff --git a/lib/eqc/doc/erlang.png b/lib/eqc/doc/erlang.png new file mode 100644 index 0000000000000000000000000000000000000000..987a618e2403af895bfaf8c2f929e3a4f3746659 GIT binary patch literal 2109 zcmV-D2*US?P)rez_nr%N ze)-p~%6|a|LA_bA=l=$|3jjqS$tjbGG?@TN0w$Azq7Z{YeQxKcpLO55vno1^u23DP&V=i9-KAAsU*ECy^#OtaDC!lVSo!+|-%T+LhTHP^Oqwx8m)b4r3V28JmV&6M#iG)&0;P`j>XGfomEIEK6wPkhI{{K?3#uAGq$!`N_F)TNX zAvuspF?^;c9h%CPWyTDc_03%r4N8+Yzzo_VSfa!zo_7F6D?<+-+KkHwXiWQR=Mr(9|K@{{xEjfDvAbS9uNCP&{)NNCoC?XA$aRe>R8-> z5N<#S_)$d|EYpJfPC?{`$Y~f4yjH&dxHXIGG8wiaLBD6usC87cg+dd&3WLJd4_TcmEeAOz8R>ikgW(9821 z{34Se09Y?KoG<_Y;DDSoyTk>fUN0YO5)3^Za{&s1JbidC9}56{px+f|K_0;YuL5h} z_9J3y%7ucwM)E4K#=Cn7tCjjRkKjnQuiFcM6{17Jt#5F}7z8~RYqW24xV?kAU6xQN zh+h4|SmO1;TdsVOaOeD*kKf}6I7=6ZNig_rtqV?Ov1HrU(P%Hi#6npSe>%qGaNK1w zW$v+r`r0>#p~AN^8b)#7Yesu(ys(>3SCYb4sF9%A9=kMHrLmzk}E&WPG~Jx z9!r{qo5M184t;<7I`t1AsNjv912EeKkHKtOSl%wbcjFh7L6|G?Q+{?radOvuEW$>1 zoc+c&F+u$^0f}1_2dN&lS#I#p3e&+|YGHlMzRC)%&8TnGt+p*;Oz z`0=D=n|qcN+f@07;QjB@ktLhZ`+qz;(xYDli^Pex&&wwU2V4N-a3b@veqHg2cvCRb zoi=ZerLk!4t5!s3?|ARuWx_4-VCgl|TY2qa@$Dr~5QdiT8?$oPpZhaF5UOZ&x=+I9 zt((`6wBPM((BS{;2lmSB;o%z{>=mg*1k2oLjI=+zcf5$4BIZmkOrjrE z*VY(<@FO?zBVDc+Q~Lh;LnlYodZ$J3tmWJBN4j~wVOWelzexhft2nY6A3PZAcm!q} z931CL#1Ki6;HM{agTbKF>3(R-yuF1&Apn3Nh@PGvv)K$mkVqu*^z@vaFgQ3kFfg!s z^=f26@{Ny=_w@7x1qHF$bEk5X$)wR}0s{l>V!TCGM=R5Ei1Ll8u7Z*N0G1CPgB zyLPP|0H{-FRUDJv`Ea=9fX zC63D4+FBlumz$eAJv~j5q*|@^_xC?_>XiL0K@bH61$;i=&CLx(QGb8`8#iu{BnjJW zHUvSgUcK7T&~W(h;koN8t5vB~Ha0dgnane1&RA#87dVcaOpEMM)6>)E&YiPZEXBpe zlarHk89g;+G#U#E3hL_W002xT6UTApOeR%UR_5g7q^73!_4PG2Hi|@|ii(Pfi3vIY z0ES^?Mx1IOizO0?e0_a!9483k`PtCk-rm~Unwpw=?b@~O?(WdgP^bMMAYlLg{dIM9 zOy}OcxVTs%k(@q#n$PF+`TXkYYA%;cr_*5ofWcr$PEL-Ai772Db)3`L*|~G)&eqn} zq@*OrbXim`UAiO`3XdK=%H#1=D%HHV>FMbqAtCAM=@!e}C6Cc))ai5zg~H3rYjkup zD=RBMKR+`wv!kN}1^{3fR#a3}RaLcP#}20|H!^bT)~%G3lp{xu!0_{Wr2hW?>({UQ z`T1F`)|D$)*3{IP&1UDKhLn_)sMYHH{QRkzV=$M?#W2idGFh!wf*`b7ZGC-xVPT=c zV1Vs&!otFoN~M>VQ$G_G6}5No-m0pqwzjr;?W@INu~;m#k*%qz(P%VUt#;3zJ^lUt zU0q%G?%kVzvF7cqQmLw|tA~e&XIqun*x2Ug=9-!s48ty7ycil9Di(|7aybkD7#y?%lgQ z9`Ewy%eDpgxlvJ3Cr+GTFc>(F+cg;(8TPc>y?b|jeEgLwR}LLIBoqp1+1c4_HrvO? z$J5g@G&D3gIC$2ITrQ7`iwh4AfA;K|OePZu1oriTVVG1Zl}e@S)~)mK@UU1cI-Ty| z!Gj8gg2UmUD2ibif*{e+(R4bU#bU|j@{Joe^7(uSf+8X!q*7@_M1;L=AqbM3oXp{H nT3T9A6wS=c+_!HZolgHhw9g$%O4Wbp00000NkvXXu0mjf3HKBY literal 0 HcmV?d00001 diff --git a/lib/eqc/doc/index.html b/lib/eqc/doc/index.html new file mode 100644 index 0000000..047b9dc --- /dev/null +++ b/lib/eqc/doc/index.html @@ -0,0 +1,17 @@ + + + +Overview + + + + + + +<h2>This page uses frames</h2> +<p>Your browser does not accept frames. +<br>You should go to the <a href="overview-summary.html">non-frame version</a> instead. +</p> + + + \ No newline at end of file diff --git a/lib/eqc/doc/modules-frame.html b/lib/eqc/doc/modules-frame.html new file mode 100644 index 0000000..f6cea3f --- /dev/null +++ b/lib/eqc/doc/modules-frame.html @@ -0,0 +1,14 @@ + + + +Overview + + + +

Modules

+ + + +
eqc
eqc_gen
eqc_symbolic
+ + \ No newline at end of file diff --git a/lib/eqc/doc/overview-summary.html b/lib/eqc/doc/overview-summary.html new file mode 100644 index 0000000..4d02c2e --- /dev/null +++ b/lib/eqc/doc/overview-summary.html @@ -0,0 +1,53 @@ + + + +QuickCheck Mini + + + + +

QuickCheck Mini

+

Copyright © Quviq AB, 2006-2010.

+

Version: 1.0.1

+

+QuickCheck is a specification-based testing tool for Erlang. QuickCheck Mini is +a powerful, but restricted version of QuickCheck. It is released free of charge for +anyone interested in learning more about QuickCheck as well as for open source +developers that want to ship their code with simple QuickCheck properties.

+ +

In order to learn more about QuickCheck, please visit http://www.quviq.com/. +There is also a mailing list discussing QuickCheck issues, which you can subscribe to by sending an email to quickcheck-questions@quviq.com with subject "Subscribe".

+ + +

QuickCheck

+ +Programs +are tested by writing properties in the source code, such as +
+prop_reverse() ->
+  ?FORALL(Xs,list(int()),
+    lists:reverse(lists:reverse(Xs)) == Xs).
+
+Properties are tested by calling +
+eqc:quickcheck(prop_reverse())
+

+which generates 100 random test cases and checks that the property +returns true in every case.

+ +

+Functions for writing properties are found in module eqc, +while functions for writing test data generators (such as +list(int()) above) are found in module eqc_gen. Parts +of the interface are provided via macros, which are defined in +eqc.hrl--this file should be included in every module which +uses QuickCheck. This header file also imports much of the QuickCheck +API, so it can be used without explicit module names. +

+ + +
+ +

Generated by EDoc, Jun 13 2010, 13:15:30.

+ + diff --git a/lib/eqc/doc/overview.edoc b/lib/eqc/doc/overview.edoc new file mode 100644 index 0000000..109e9c7 --- /dev/null +++ b/lib/eqc/doc/overview.edoc @@ -0,0 +1,39 @@ +@title QuickCheck Mini +@version {@version} +@copyright Quviq AB, 2006-2010. +@doc +QuickCheck is a specification-based testing tool for Erlang. QuickCheck Mini is +a powerful, but restricted version of QuickCheck. It is released free of charge for +anyone interested in learning more about QuickCheck as well as for open source +developers that want to ship their code with simple QuickCheck properties. + +In order to learn more about QuickCheck, please visit http://www.quviq.com/. +There is also a mailing list discussing QuickCheck issues, which you can subscribe to by sending an email to quickcheck-questions@quviq.com with subject "Subscribe". + + +

QuickCheck

+ +Programs +are tested by writing properties in the source code, such as +
+prop_reverse() ->
+  ?FORALL(Xs,list(int()),
+    lists:reverse(lists:reverse(Xs)) == Xs).
+
+Properties are tested by calling +
+eqc:quickcheck(prop_reverse())
+
+which generates 100 random test cases and checks that the property +returns true in every case. + +

+Functions for writing properties are found in module {@link eqc}, +while functions for writing test data generators (such as +list(int()) above) are found in module {@link eqc_gen}. Parts +of the interface are provided via macros, which are defined in +eqc.hrl--this file should be included in every module which +uses QuickCheck. This header file also imports much of the QuickCheck +API, so it can be used without explicit module names. +

+ diff --git a/lib/eqc/doc/packages-frame.html b/lib/eqc/doc/packages-frame.html new file mode 100644 index 0000000..4193cbe --- /dev/null +++ b/lib/eqc/doc/packages-frame.html @@ -0,0 +1,11 @@ + + + +Overview + + + +

Packages

+
+ + \ No newline at end of file diff --git a/lib/eqc/doc/stylesheet.css b/lib/eqc/doc/stylesheet.css new file mode 100644 index 0000000..e426a90 --- /dev/null +++ b/lib/eqc/doc/stylesheet.css @@ -0,0 +1,55 @@ +/* standard EDoc style sheet */ +body { + font-family: Verdana, Arial, Helvetica, sans-serif; + margin-left: .25in; + margin-right: .2in; + margin-top: 0.2in; + margin-bottom: 0.2in; + color: #000000; + background-color: #ffffff; +} +h1,h2 { + margin-left: -0.2in; +} +div.navbar { + background-color: #add8e6; + padding: 0.2em; +} +h2.indextitle { + padding: 0.4em; + background-color: #add8e6; +} +h3.function,h3.typedecl { + background-color: #add8e6; + padding-left: 1em; +} +div.spec { + margin-left: 2em; + background-color: #eeeeee; +} +a.module,a.package { + text-decoration:none +} +a.module:hover,a.package:hover { + background-color: #eeeeee; +} +ul.definitions { + list-style-type: none; +} +ul.index { + list-style-type: none; + background-color: #eeeeee; +} + +/* + * Minor style tweaks + */ +ul { + list-style-type: square; +} +table { + border-collapse: collapse; +} +td { + padding: 3 +} diff --git a/lib/eqc/ebin/eqc.app b/lib/eqc/ebin/eqc.app new file mode 100644 index 0000000..a1c5aa5 --- /dev/null +++ b/lib/eqc/ebin/eqc.app @@ -0,0 +1,7 @@ +{application,eqc, + [{mod,{eqc,[]}}, + {description,"Quviq QuickCheck Mini"}, + {vsn,"1.0.1"}, + {modules,[eqc,eqc_gen,eqc_symbolic,eqc_warn]}, + {applications,[kernel,stdlib,inets]}]}. + diff --git a/lib/eqc/examples/generators_eqc.erl b/lib/eqc/examples/generators_eqc.erl new file mode 100644 index 0000000..07659b2 --- /dev/null +++ b/lib/eqc/examples/generators_eqc.erl @@ -0,0 +1,227 @@ +%% This file tests that generators produce the right kind of data. It +%% also illustrates how to write a QuickSpec specification of a +%% datatype (such as the generator datatype). + +-module(generators_eqc). +-include_lib("eqc/include/eqc.hrl"). + +-compile(export_all). + +%% Generate most combinations of generator functions, as a symbolic +%% generator--for example: +%% {call,oneof,[{{call,bitstring,14},{call,elements,[15]}}]} + +%% We control the size of the symbolic generator, by limiting the +%% nesting depth. + +generator() -> + ?SIZED(N,generator(N)). + +generator(0) -> + % base case: no nested generators. + oneof([constant(), + binary,{call,binary,nat()}, + bitstring,{call,bitstring,nat()}, + bool,char, + ?SUCHTHAT({call,choose,Lo,Hi}, + {call,choose,int(),int()}, + Lo= + % recursive case: reduce the size of nested compound generators. + N1 = N div 4, + ?LAZY(oneof([generator(0),compound_generator(N1)])). + +constant() -> + oneof([int(),atom()]). + +atom() -> + elements([a,b,c,d]). + +term() -> + ?LET(G,generator(),generated_by(G)). + +compound_generator(N) -> + Smaller = generator(N), + oneof([?LETSHRINK([Sm],[Smaller],?LET(Def,term(),{call,default,Sm,Def})), + ?LETSHRINK(Gs,non_empty_list(Smaller), + {call,frequency,[{positive(),G} || G <- Gs]}), + ?LETSHRINK([Sm],[Smaller],{call,list,Sm}), + ?LETSHRINK([Sm],[Smaller],{call,orderedlist,Sm}), + ?LETSHRINK([Sm],[?SUCHTHAT(Sm,Smaller,not often_empty(Sm))], + {call,non_empty,Sm}), + ?LETSHRINK([Sm],[Smaller],{call,noshrink,Sm}), + ?LETSHRINK(Gs,non_empty_list(Smaller), + {call,oneof,Gs}), + ?LETSHRINK([Sm],[Smaller],{call,resize,choose(0,N),Sm}), + ?LETSHRINK(L,list(constant()),{call,shuffle,L}), + ?LETSHRINK(Gs,short_list(Smaller), + list_to_tuple(Gs)), + ?LETSHRINK([Sm],[Smaller],{call,vector,choose(0,4),Sm})]). + +%% To keep the size of generators under control, it is not enough to +%% restrict nesting depth. We also want lists of arguments to oneof, +%% frequency etc to be reasonably short. + +short_list(G) -> + ?SIZED(Size, + resize(Size div 3 + 1, + list(resize(Size,G)))). + +positive() -> + ?LET(N,nat(),N+1). + +non_empty_list(G) -> + non_empty(short_list(G)). + +%% When we generate {call,non_empty,G}, we need to know that G is +%% reasonably likely to produce a non-empty value... otherwise we may +%% loop when we try to use this generator! + +often_empty([]) -> + true; +often_empty(<<>>) -> + true; +often_empty({call,vector,N,G}) -> + N==0; +often_empty({call,binary,N}) -> + N==0; +often_empty({call,bitstring,N}) -> + N==0; +often_empty({call,noshrink,G}) -> + often_empty(G); +often_empty({call,oneof,Gs}) -> + % conservative + lists:any(fun often_empty/1,Gs); +often_empty({call,frequency,WGs}) -> + % conservative + lists:any(fun often_empty/1, [G || {_,G} <- WGs]); +often_empty({call,default,G,V}) -> + often_empty(G) andalso often_empty(V); +often_empty({call,resize,N,G}) -> + N<4 orelse often_empty(G); +often_empty({call,shuffle,L}) -> + L==[]; +often_empty(_) -> + false. + +%% The values generated by a symbolic generator. + +generated_by(A) when is_atom(A) -> + case erlang:function_exported(eqc_gen,A,0) of + true -> + eqc_gen:A(); + false -> + A + end; +generated_by(T) when is_tuple(T), size(T)>0 -> + case tuple_to_list(T) of + [call,F|Args] -> + erlang:apply(eqc_gen,F,[generated_by(G) || G <- Args]); + Gs -> + list_to_tuple([generated_by(G) || G <- Gs]) + end; +generated_by([H|T]) -> + [generated_by(H)|generated_by(T)]; +generated_by(X) -> + X. + +%% Check that a generated value corresponds to its generator. + +is(binary,B) -> + is_binary(B); +is({call,binary,N},B) -> + is_binary(B) andalso size(B)==N; +is(bitstring,B) -> + is_bitstring(B); +is({call,bitstring,N},B) -> + is_bitstring(B) andalso size(B) == N div 8; +is(bool,B) -> + B==true orelse B==false; +is(char,C) -> + is_integer(C) andalso 0= + is_integer(N) andalso Lo =< N andalso N =< Hi; +is({call,default,G,D},X) -> + is(G,X) orelse X==D; +is({call,elements,L},X) -> + lists:member(X,L); +is({call,frequency,WGs},X) -> + lists:any(fun({_,G})->is(G,X) end,WGs); +is(int,N) -> + is_integer(N) andalso abs(N) =< 100; +is(largeint,N) -> + is_integer(N); +is(nat,N) -> + is_integer(N) andalso N>=0; +is(real,N) -> + is_float(N); +is({call,list,G},L) -> + is_list(L) andalso + lists:all(fun(X)->is(G,X) end,L); +is({call,orderedlist,G},L) -> + is_list(L) andalso + lists:all(fun(X)->is(G,X) end,L) andalso + lists:sort(L) == L; +is({call,non_empty,G},X) -> + is(G,X) andalso X/=[] andalso X/=<<>>; +is({call,noshrink,G},X) -> + is(G,X); +is({call,oneof,Gs},X) -> + lists:any(fun(G) -> is(G,X) end,Gs); +is({call,resize,_,G},X) -> + is(G,X); +is({call,shuffle,L},X) -> + is_list(X) andalso lists:sort(X) == lists:sort(L); +is({call,vector,N,G},V) -> + is_list(V) andalso length(V)==N andalso + lists:all(fun(X)->is(G,X) end,V); +is(GT,T) when is_tuple(GT) -> + is_tuple(T) andalso size(T)==size(GT) andalso + lists:all(fun({G,X})->is(G,X) end, + lists:zip(tuple_to_list(GT), + tuple_to_list(T))); +is(Const,X) when is_atom(Const); is_integer(Const) -> + Const == X. + +%% The properties. + +%% Generate symbolic generators, and report on the distribution of +%% generator functions used. +prop_generator() -> + ?FORALL(G,generator(), + aggregate(generator_types(G),true)). + +generator_types(G) when is_tuple(G) -> + case tuple_to_list(G) of + [call,frequency,WArgs] -> + [T || {_,G1} <- WArgs, T <- generator_types(G1)]; + [call,F|Args] -> + [F|[T || A <- Args, + T <- generator_types(A)]]; + L -> + [T || X <- L, + T <- generator_types(X)] + end; +generator_types(N) when is_integer(N) -> + [integer_constant]; +generator_types(X) when is_float(X) -> + [float_constant]; +generator_types(B) when is_binary(B) -> + [binary]; +generator_types(B) when is_bitstring(B) -> + [bitstring]; +generator_types(L) when is_list(L) -> + [list|[T || X <- L, T <- generator_types(X)]]; +generator_types(X) -> + [X]. + +%% For each kind of generator, use it to generate a value, and check +%% that the value matches the generator. This tests the generators +%% (and our generator-generators!) pretty thoroughly. + +prop_correct_types() -> + ?FORALL(G,generator(), + ?FORALL(X,generated_by(G),is(G,X))). + diff --git a/lib/eqc/examples/ip_checksum.erl b/lib/eqc/examples/ip_checksum.erl new file mode 100644 index 0000000..ab76940 --- /dev/null +++ b/lib/eqc/examples/ip_checksum.erl @@ -0,0 +1,40 @@ +%%% File : ip_checksum.erl +%%% Author : Ulf Norell , +%%% Thomas Arts +%%% Description : Implementation of IP checksums. +%%% Created : 7 Jun 2010 by Ulf Norell +-module(ip_checksum). + +-export([checksum/1, checksum/2, sum/2, pad/2, add/2, negate/1]). + +checksum(Bin) -> + checksum(Bin, 16). + +checksum(Bin, N) -> + negate(sum(pad(Bin, N), N)). + +% Sum a binary of N bit words in ones complement representation. +sum(Bin, N) -> + lists:foldl(fun(A, B) -> add(A, B) end, <<0:N>>, + [ <> || <> <= Bin ]). + +% Add two numbers in ones complement representation. +add(A, B) -> + N = bit_size(A), + <> = A, + <> = B, + Carry = (X + Y) div (1 bsl N), + <<(X + Y + Carry):N>>. + +%% invert all bits... as simple as that. +negate(BitString) -> + << <<(1-Bit):1>> || <> <= BitString >>. + +pad(Binary, Bits) -> + PaddingLength = + case bit_size(Binary) rem Bits of + 0 -> 0; + N -> Bits - N + end, + <>. + diff --git a/lib/eqc/examples/ip_checksum_eqc.erl b/lib/eqc/examples/ip_checksum_eqc.erl new file mode 100644 index 0000000..a600c02 --- /dev/null +++ b/lib/eqc/examples/ip_checksum_eqc.erl @@ -0,0 +1,218 @@ +%%% File : ip_checksum_eqc.erl +%%% Author : Ulf Norell , +%%% Thomas Arts +%%% Description : QuickCheck properties for ip_checksum.erl +%%% Created : 7 Jun 2010 by Ulf Norell +-module(ip_checksum_eqc). + +-include_lib("eqc/include/eqc.hrl"). + +-compile(export_all). + +% == Testing IP checksum implementations == + +% In RFC 1071 efficient algorithms are discussed for computing the internet +% checksum, also known as IP checksum. Whenever you implement efficient +% algorithms, an error may sneak through. + +% This article is meant to be used as test driven development specification for +% anyone that wants to implement one of the algorithms of RFC 1071 or even a new +% one to compute the IP checksum. The article can also be read as an example of +% specifying something without revealing its implementation details; a good +% example of using QuickCheck specifications. + +% Whether you write your code in Erlang, C or Java, we assume that you can build +% an interface to a module called ip_checksum.erl in which Erlang functions +% either are the functions under test or call the functions under test. + +% === IP Checksum === + +% The IP checksum is the 16 bit one's complement of the one's complement sum of +% all 16 bit words in the header. + +% Ones complement is a way of representing negative numbers (see +% [http://en.wikipedia.org/wiki/Signed_number_representations#Ones.27_complement +% WikiPedia] for more details). + +% The IP checksum uses 16 bit words. In 16 bits you can represent the numbers 0 +% to 65535. The idea with ones complement is to use half the numbers in this +% interval for representing negative numbers. Thus, 0 up to 32767 are the +% positive numbers and 65535 is -0, or an alternative representation of zero. +% The number 65534 is -1 etc. Until 32768 which is -32767. Hence the interval +% -32767 up to 32767 can be represented. + +% In the remainder of this article we will present properties for functions that +% you probably would like to test. The properties are always parametrized by the +% word size. + +% === Utility functions === + +% First we define some functions that will come in handy. + +% The maximum number that can be represented in ''N'' bits. In the ones +% complement interpretation this will be the negative zero. +max_int(N) -> + (1 bsl N) - 1. + +negative_zero(N) -> + max_int(N). + +% === Ones complement === + +% The first function we might want to check is the ones' complement of a word, +% which in ones' complement representation corresponds to the negation. We +% assume we have a function '''ip_checksum:negate/1''' implemented that takes a +% bit string as input and computes its ones' complement. + +% Looking at the specification of ones' complement representation above we can +% see that adding the ones' complement representation of a number and the +% representation of its negation results in the representation of -0. For +% instance, the representation of -2 is 65533 and the representation of 2 is 2. +% Adding these we get 65535 which is the representation of -0. We use this +% property to test the implementation of the '''negate/2''' function. + +prop_negate(N) -> + ?FORALL(I, choose(0, max_int(N)), + begin + <> = ip_checksum:negate(<>), + equals(negative_zero(N), I + CI) + end). + +% The property above is parameterized by the word size N. We'll want to test +% our properties for a range of different word sizes, so we define a general +% function to transform a parameterized property to a property choosing random +% word sizes. + +random_word_size(Prop) -> + ?FORALL(N, choose(1, 64), Prop(N)). + +prop_negate() -> + random_word_size(fun prop_negate/1). + +% === Padding === + +% It is not clear from the specification presented above, but if you need to +% compute the checksum of a list of bytes in base 16, then there should be an +% even number of bytes. Likewise, if we would like to do ones complement in 32 +% bits base, we would need to extend a sequence of bytes such that it is +% divisible by 4. + +% Extending a bit string such that it is divisible by the base is called padding. +% We assume that you implemented a padding function that added the necessary +% bits, given a bit string. We assume this function to be implemented as +% '''ip_checksum:pad/1''' taking a bit string as argument and returning a new +% bit string which is an extended version with as many zero bits as needed. + +prop_padding() -> + random_word_size(fun prop_padding/1). + +prop_padding(N) -> + ?FORALL(BitString, bitstring(), + begin + Bits = bit_size(BitString), + <> = ip_checksum:pad(BitString,N), + Zeros = bit_size(Padded), + % If this property fails we need to know what the pad function actually + % returned in order to understand what went wrong. This is what the + % ?WHENFAIL macro is for. + ?WHENFAIL(io:format("B = ~w\nPadded = ~w\nZeros = ~w\n", + [B, Padded, Zeros]), + ((Bits + Zeros) rem N) == 0 andalso % the new length is divisible by N + B == BitString andalso % we don't change the bit string + <<0:Zeros>> == Padded andalso % we pad with zeros + Zeros < N % we don't pad more than we have to + ) + end). + +% Confident that the padding function works we can write a generator for +% correctly padded bit strings. +padded_bitstring(N) -> + ?LET(Bits, bitstring(), ip_checksum:pad(Bits, N)). + +% An alternative definition of this generator would not use the padding +% function, but rather first generate the length of the bit string and then +% pass that to the bit string generator (see below). The advantage of the former +% definition is that it behaves better when shrinking. The version below will +% regenerate the bit string everytime the length is getting shorter. +padded_bitstring_2(N) -> + ?LET(Len, nat(), bitstring(N * Len)). + +% === Ones complement sum === + +% The ones complement sum is computed by adding a number of words in ones +% complement representation. We assume this function to be implemented as +% '''ip_checksum:sum/2''' which takes a bit string as first argument and a +% word size as second argument. We assume that padding is done outside the +% sum function and only test that the function works for bit strings of +% which the length is divisible by the given word size. + +% Because of our test driven development method, we have already tested the +% '''negate/1''' function and therefore trust this function in our property. +% Remember that adding the representations of a number and its negation yields +% -0. This is in fact also true if we use one's complement addition rather than +% simply adding the representations (which is not the same thing). So if we +% concatenate a bit string with the negation of its sum, the sum of the +% resulting bit string should be -0 if our implementation of '''sum/2''' is +% correct. By testing the sum function in this way we don't have to worry about +% specifying the intricacies of ones' complement arithmetic (except for the +% fact that X + (-X) = -0). + +prop_sum() -> + random_word_size(fun prop_sum/1). + +prop_sum(N) -> + ?FORALL(Bin, padded_bitstring(N), + begin + Sum = ip_checksum:sum(Bin, N), + CSum = ip_checksum:negate(Sum), + equals(ip_checksum:sum(<>, N), + <<(negative_zero(N)):N>>) + end). + +% === Checksum === + +% After computing ones' complement sum, one has to take the ones' complement of +% the result to compute the checksum. Of course, we have all ingredients in +% house to do so, but in case you implement both functions as one you would +% like to test the final result '''ip_checksum:checksum/2''' with a bit string +% and word size as arguments. + +% We first test that the '''checksum/2''' function takes care of padding, by +% checking that padding the bitstring before passing it to '''checksum/2''' +% doesn't change the result. + +prop_checksum_pad() -> + random_word_size(fun prop_checksum_pad/1). + +prop_checksum_pad(N) -> + ?FORALL(Bits, bitstring(), + equals(ip_checksum:checksum(Bits, N), + ip_checksum:checksum(ip_checksum:pad(Bits, N), N))). + +% We can test the '''checksum/2''' function in the same way as we tested +% '''sum/2''' above. Taking a bit string and prepending its checksum should +% result in a bit string whose checksum is zero. Here's why: +% +% % definition of checksum +% checksum(Bits) == -sum(Bits) +% +% checksum(checksum(Bits) ++ Bits) == {def. of checksum} +% -sum(-sum(Bits) ++ Bits) == {sum(Xs ++ Ys) == sum(Xs) + sum(Ys)} +% -(-sum(Bits) + sum(Bits)) == {adding -X and X} +% -(-0) == +% 0 +% +% Note that due to padding, the property doesn't hold if we append the checksum +% rather than prepending it. + +prop_checksum() -> + random_word_size(fun prop_checksum/1). + +prop_checksum(N) -> + ?FORALL(Bin, bitstring(), + begin + Sum = ip_checksum:checksum(Bin, N), + equals(ip_checksum:checksum(<>, N), + <<0:N>>) + end). + diff --git a/lib/eqc/examples/lists_eqc.erl b/lib/eqc/examples/lists_eqc.erl new file mode 100644 index 0000000..4203fa7 --- /dev/null +++ b/lib/eqc/examples/lists_eqc.erl @@ -0,0 +1,223 @@ +%%% File : lists_eqc.erl +%%% Author : Thomas Arts +%%% Ulf Norell +%%% Description : QuickCheck tests for some functions from the lists library. +%%% Created : 23 Mar 2010 by Thomas Arts + +-module(lists_eqc). + +-include_lib("eqc/include/eqc.hrl"). + +-compile(export_all). + +% === Testing lists:delete/2 === + +% The lists:delete/2 function removes an element from a list. Here's a property +% we might want for this function: after you've removed an element from a list +% it's not there anymore. The corresponding QuickCheck property is: + +prop_delete_0() -> + ?FORALL({X, Xs}, {int(), list(int())}, + not lists:member(X, lists:delete(X, Xs))). + +% Checking this property for 100 random values and lists it might actually +% pass. +test_delete_0() -> + quickcheck(prop_delete_0()). + +% However, rerunning the property a few more times will reveal a problem: +test_delete_0_more() -> + quickcheck(numtests(2000,prop_delete_0())). + +% We get output looking like this: +% 74> lists_eqc:test_delete_0_more(). +% ............................................................................ +% ............................................................................ +% ............................................................................ +% ............................................................................ +% ....................................................Failed! After 377 tests. +% {7,[-6,1,23,24,7,7]} +% Shrinking..(2 times) +% {7,[7,7]} +% false +% There is a problem with our specification. lists:delete/2 only removes the +% first occurrence of the element, something our specification fails to take +% into account. + +% Before fixing the problem in the specification, it's worth thinking about why +% we needed so many tests to find the bug. In order to find the bug we need to +% generate a value and a list such that the value appears twice in the list. +% What's the probability of that? To answer that question we can write a new +% property: + +prop_member_probability() -> + ?FORALL({X, Xs}, {int(), list(int())}, + collect(lists:member(X, Xs), true)). + +% This property always succeeds, but for every test case it records whether the +% generated value appears (even once) in the list. Running the property a large +% number of times reveals that the probability that a random value appears in a +% random list is around 8%. No wonder it's hard to find a test case where it +% appears at least twice! + +% To make it easier to find a failing case, we can change our property to only +% look at cases where the value appears at least once in the list. To do this +% we use the ?IMPLIES macro. + +prop_delete_1() -> + ?FORALL({X, Xs}, {int(), list(int())}, + ?IMPLIES(lists:member(X, Xs), + not lists:member(X, lists:delete(X, Xs)))). + +% Now the output will look something like this: +% 102> eqc:quickcheck(lists_eqc:prop_delete_1()). +% xxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxx. +% .xxxxxxxxxxxxxx.xx.xxxxxxx.xxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx.xxx.xxxxxxxxxxxxx +% xxxxxxxxx.xxxxxxxxxxx.xxxxx.xxxxxxxxxxxxxxxxxxxxxx.xx.xxxxxxxxxxxx.xxxxxxxxx +% xxxxxxxxxxxxxxxxxxxxxxxxx..xxxxx.xxxx.xxxxxxxxx.xxxxxFailed! After 22 tests. +% {1,[31,35,35,34,-21,-13,7,1,2,1,-35,2]} +% Shrinking.....(5 times) +% {1,[1,1]} +% false +% The 'x's represent test cases that were discarded because they didn't satisfy +% the condition of the ?IMPLIES. + +% Now that we have a property that fails reliably we can use it to document our +% misconception about the behaviour of lists:delete/2. The fails/1 function +% takes a property that is expected to fail and fails it doesn't. + +prop_delete_2() -> + fails( + ?FORALL({X, Xs}, {int(), list(int())}, + ?IMPLIES(lists:member(X, Xs), + not lists:member(X, lists:delete(X, Xs))))). + +% Let's fix the specification. One possibility would be to count the number of +% occurrences of the value we're removing before and after calling +% lists:delete/2, but we can write a more precise specification quite elegantly: + +prop_delete_3() -> + ?FORALL({Xs, X, Ys}, {list(int()), int(), list(int())}, + ?IMPLIES(not lists:member(X, Xs), + equals(lists:delete(X, Xs ++ [X] ++ Ys), + Xs ++ Ys))). + +% The equals function compares its arguments for equality and, if they're not +% equal, prints the arguments. This lets us see what lists:delete actually +% returned in the case we get a failing test case. Try removing the ?IMPLIES +% and run the property to see what it looks like. + +% === Testing lists:seq/3 === + +% The lists:seq/2 function has recently changed in Erlang. The new +% specification allows lists:seq(1,0) and returns [] in that case. Copying the +% specification from the manual still reveals an error +% eqc:quickcheck(lists_eqc:prop_seq0()) due to the fact that a special case is +% overlooked. The fix is in prop_seq(). + +% This is the property according to the documentation. This property fails with +% a badarith exception on the test case {0, 0, 0}. The problem is that the +% specification of the length is not correct for increment 0. +prop_seq0() -> + ?FORALL({From,To,Incr},{int(),int(),int()}, + case catch lists:seq(From,To,Incr) of + {'EXIT',_} -> + (To < From-Incr andalso Incr > 0) orelse + (To > From-Incr andalso Incr < 0) orelse + (Incr==0 andalso From /= To); + List -> + is_list(List) andalso + length(List) == (To-From+Incr) div Incr + end). + +% This is the property as it holds. +prop_seq() -> + ?FORALL({From,To,Incr},{int(),int(),int()}, + case catch lists:seq(From,To,Incr) of + {'EXIT',_} -> + (To < From-Incr andalso Incr > 0) orelse + (To > From-Incr andalso Incr < 0) orelse + (Incr==0 andalso From /= To); + List when Incr /= 0 -> + is_list(List) andalso + length(List) == (To-From+Incr) div Incr; + List when Incr == 0 -> + length(List) == 1 + end). + +% This is probably how one would like seq to behave. +prop_seq_wish(Seq) -> + ?FORALL({From,To,Incr},{int(),int(),int()}, + case catch Seq(From,To,Incr) of + [] -> Incr > 0 andalso From > To orelse + Incr < 0 andalso From < To; + [_] when Incr == 0 -> From == To; + List when Incr /= 0 andalso is_list(List) -> + length(List) == (To-From+Incr) div Incr; + {'EXIT', _} -> + Incr == 0 andalso From /= To; + _ -> + false + end). + +prop_seq_wish() -> + prop_seq_wish(fun lists:seq/3). + +% Here is a reference implementation satisfying prop_seq_wish. +seq(From, To, 0) when From /= To -> + exit("seq: increment 0"); +seq(From, From, _Incr) -> + [From]; +seq(From, To, Incr) when From > To andalso Incr > 0 -> + []; +seq(From, To, Incr) when From < To andalso Incr < 0 -> + []; +seq(From, To, Incr) -> + [From | seq(From + Incr, To, Incr)]. + +prop_seq_wish_granted() -> + prop_seq_wish(fun seq/3). + +% The previous properties only specifies the length of the result of +% lists:seq/3. We also want to make sure that it contains the right elements. +% In particular, if lists:seq(From, To, Incr) returns a non-empty list, the +% first element of the list should be From, and the difference between adjacent +% elements should be Incr. We've already tested that the list has the right +% number of elements so we don't have to worry about when the list ends. + +% First some helper functions: + +% We're only interested in non-empty results of seq/3. +is_cons([_|_]) -> true; +is_cons(_) -> false. + +% We want to look at the difference between adjacent elements. +diff_adjacent([X,Y|Xs]) -> + [Y - X|diff_adjacent([Y|Xs])]; +diff_adjacent(_) -> + []. + +% We use ?IMPLIES to ignore the cases when lists:seq does not return a +% non-empty list. To make sure we still get interesting test cases we collect +% the lengths of the results and the increments we've chosen. +prop_seq_elements() -> + ?FORALL({From, To, Incr}, {int(), int(), int()}, + begin + Seq = (catch lists:seq(From, To, Incr)), + ?IMPLIES(is_cons(Seq), + begin + Adj = diff_adjacent(Seq), + ?WHENFAIL(io:format("Seq = ~w\nAdj = ~w", [Seq, Adj]), + % When you have several collects in the same property you can give them + % names using collect/3 and with_title/1 to distinguish them. + % We divide the actual numbers by 5 to reduce the number of different + % values collected. + collect(with_title(lengths), length(Seq) div 5, + collect(with_title(incr), Incr div 5, + hd(Seq) == From andalso + lists:all(fun(D) -> D == Incr end, Adj) + )) + ) + end) + end). + diff --git a/lib/eqc/examples/sets_eqc.erl b/lib/eqc/examples/sets_eqc.erl new file mode 100644 index 0000000..48ee035 --- /dev/null +++ b/lib/eqc/examples/sets_eqc.erl @@ -0,0 +1,146 @@ +%%% File : sets_eqc.erl +%%% Author : Thomas Arts +%%% Description : QuickCheck properties for sets.erl +%%% Based on "Testing Data Structures with QuickCheck" +%%% Created : 24 Mar 2010 by Thomas Arts + +-module(sets_eqc). + +-include_lib("eqc/include/eqc.hrl"). + +-compile(export_all). + +%% Create a generator for the opaque type "set". The generator will generate +%% symbolic calls which when evaluated computes a set. Each symbolic call has +%% the form {call, Module, Function, Arguments} and are evaluated using the +%% function eval/1. + +%% To avoid generating infinite symbolic representations we pass the size +%% parameter to the generator and use it to make sure we stop eventually. + +set(G) -> + ?SIZED(Size,well_defined(set(Size,G))). + +set(0,G) -> + oneof([{call,sets,new,[]}, + {call,sets,from_list,[list(G)]}]); +set(N,G) -> + frequency( + [{5,set(0,G)}, + {3, ?LAZY(?LETSHRINK([Set],[set(N-1,G)], + {call,sets,add_element,[G, Set]}))}, + {1, ?LAZY(?LETSHRINK([Set],[set(N-1,G)], + {call,sets,del_element,[G, Set]}))}, + {1, ?LAZY(?LETSHRINK([Set1,Set2],[set(N div 2,G),set(N div 2,G)], + {call,sets,union,[Set1, Set2]}))}, + {1, ?LAZY(?LETSHRINK(Sets,list(set(N div 3,G)), + {call,sets,union,[Sets]}))}, + {1, ?LAZY(?LETSHRINK([Set1,Set2],[set(N div 2,G),set(N div 2,G)], + {call,sets,intersection,[Set1, Set2]}))}, + {1, ?LAZY(?LETSHRINK(Sets,?LET(L,nat(),vector(L+1,set(N div (L+1),G))), + {call,sets,intersection,[Sets]}))}, + {1, ?LAZY(?LETSHRINK([Set1,Set2],[set(N div 2,G),set(N div 2,G)], + {call,sets,subtract,[Set1, Set2]}))}, + {1, ?LAZY(?LETSHRINK([Set],[set(N div 2,G)], + {call,sets,filter,[function1(bool()), Set]}))}]). + +%% The next step is to define a model interpretation, i.e. a simplified, +%% obviously correct implementation of the data type. In this case we use +%% usorted lists. + +model(S) -> + lists:sort(sets:to_list(S)). + +%% Define the set operations on the model. + +madd_element(E,S) -> + lists:usort([E|S]). + +mdel_element(E,S) -> + S -- [E]. + +msize(S) -> + length(S). + +mis_element(E,S) -> + lists:member(E,S). + +munion(Ss) -> + lists:usort(lists:append(Ss)). + +mintersection(Sets) -> + [ E || E <- lists:usort(lists:append(Sets)), + lists:all(fun(Set) -> lists:member(E,Set) end, Sets)]. + +mis_disjoint(S1,S2) -> + mintersection([S1,S2]) == []. + +mfilter(Pred,S) -> + [ E || E <- S, Pred(E)]. + +%% Define one property for each operation. We parameterize the properties on +%% the generator for the elements. To make it easy to run the properties we +%% also define special versions that use integers. + +%% Each property have the same basic form: we check that a given operation +%% on sets has the same behaviour as the corresponding model operation. + +prop_create() -> prop_create(int()). +prop_create(G) -> + ?FORALL(Set,set(G), + sets:is_set(eval(Set))). + +prop_add_element() -> prop_add_element(int()). +prop_add_element(G) -> + ?FORALL({E,Set},{G,set(G)}, + model(sets:add_element(E,eval(Set))) == madd_element(E,model(eval(Set)))). + +prop_del_element() -> prop_del_element(int()). +prop_del_element(G) -> + ?FORALL({E,Set},{G,set(G)}, + model(sets:del_element(E,eval(Set))) == mdel_element(E,model(eval(Set)))). + + +prop_union2() -> prop_union2(int()). +prop_union2(G) -> + ?FORALL({Set1,Set2},{set(G),set(G)}, + model(sets:union(eval(Set1),eval(Set2))) == munion([model(eval(Set1)),model(eval(Set2))])). + +prop_union() -> prop_union(int()). +prop_union(G) -> + ?FORALL(Sets,list(set(G)), + model(sets:union(eval(Sets))) == munion([model(Set) || Set<-eval(Sets)])). + +prop_intersection2() -> prop_intersection2(int()). +prop_intersection2(G) -> + ?FORALL({Set1,Set2},{set(G),set(G)}, + model(sets:intersection(eval(Set1),eval(Set2))) == + mintersection([model(eval(Set1)),model(eval(Set2))])). + + +prop_intersection() -> prop_intersection(int()). +prop_intersection(G) -> + ?FORALL(Sets,eqc_gen:non_empty(list(set(G))), + model(sets:intersection(eval(Sets))) == mintersection([model(Set) || Set<-eval(Sets)])). + +prop_size() -> prop_size(int()). +prop_size(G) -> + ?FORALL(Set,set(G), + sets:size(eval(Set)) == msize(model(eval(Set)))). + +prop_is_element() -> prop_is_element(int()). +prop_is_element(G) -> + ?FORALL({E,Set},{G,set(G)}, + sets:is_element(E,eval(Set)) == mis_element(E,model(eval(Set)))). + +prop_is_disjoint() -> prop_is_disjoint(int()). +prop_is_disjoint(G) -> + ?FORALL({Set1,Set2},{set(G),set(G)}, + sets:is_disjoint(eval(Set1),eval(Set2)) == mis_disjoint(model(eval(Set1)),model(eval(Set2)))). + +prop_filter() -> prop_filter(int()). +prop_filter(G) -> + ?FORALL({Pred,Set},{function1(bool()),set(G)}, + model(sets:filter(Pred,eval(Set))) == mfilter(Pred,model(eval(Set)))). + + diff --git a/lib/eqc/include/eqc.hrl b/lib/eqc/include/eqc.hrl new file mode 100644 index 0000000..36c1bd0 --- /dev/null +++ b/lib/eqc/include/eqc.hrl @@ -0,0 +1,63 @@ +% Generated file--see release:make() +% eqc_macros.hrl +-define(DELAY(X),fun()->X end). +-define(FORCE(X),(X)()). +-define(LET(X,E,E2),eqc_gen:bind(E,fun(X)->E2 end)). +-define(SIZED(S,G),eqc_gen:sized(fun(S)->G end)). +-define(SUCHTHAT(X,G,P),eqc_gen:suchthat(G,fun(X)->P end)). +-define(SUCHTHATMAYBE(X,G,P),eqc_gen:suchthatmaybe(G,fun(X)->P end)). +-define(SHRINK(G,Gs),eqc_gen:shrinkwith(G,?DELAY(Gs))). +-define(LETSHRINK(Es,Gs,E), eqc_gen:letshrink(Gs,fun(Es) -> E end)). +-define(LAZY(G),eqc_gen:lazy(?DELAY(G))). +-define(IMPLIES(Pre,Prop),eqc:implies(Pre,??Pre,?DELAY(Prop))). +-define(FORALL(X,Gen,Prop),eqc:forall(Gen,fun(X)->Prop end)). +-define(WHENFAIL(Action,Prop),eqc:whenfail(fun(_) -> Action end,?LAZY(Prop))). +-define(TRAPEXIT(E),eqc:trapexit(?DELAY(E))). +-define(TIMEOUT(Limit,Prop),eqc:timeout(Limit,?LAZY(Prop))). +-define(ALWAYS(N,P),eqc:always(N,?DELAY(P))). +-define(SOMETIMES(N,P),eqc:sometimes(N,?DELAY(P))). +% eqc_imports.hrl +-import(eqc_gen, + [pick/1,pick/2, + includeif/2,return/1,applygen/2, + noshrink/1,shrinkings/1,shrinking_path/2, + timeout/2, + resize/2, + parameter/1, parameter/2, with_parameter/3, with_parameters/2, + choose/2, + shuffle/1, + sample/1, sampleshrink/1, + oneof/1, frequency/1, + non_empty/1, + elements/1, growingelements/1, list/1, shrink_list/1, vector/2, + function0/1, function1/1, function2/1, function3/1, function4/1, + bool/0, maybe/1, char/0, int/0, shrink_int/3, nat/0, largeint/0, + real/0, orderedlist/1, + binary/0, binary/1, bitstring/0, bitstring/1, + default/2, weighted_default/2, + seal/1,open/1,peek/1, + fault/2, fault_rate/3, more_faulty/2, less_faulty/2, no_faults/1, + prop_shrinks_without_duplicates/1, shrink_without_duplicates/1, + is_generator/1]). + +-import(eqc_symbolic, + [eval/1,eval/2,defined/1,well_defined/1,pretty_print/1,pretty_print/2]). + +-import(eqc,[equals/2, + fails/1, + conjunction/1, + collect/2,collect/3,classify/3,aggregate/2,aggregate/3,measure/3, + %distribution/0, + with_title/1, + %print_distribution/1, + numtests/2, + on_output/2, + on_test/2, + quickcheck/1, + counterexample/0,counterexample/1, + current_counterexample/0, + module/1, + check/2, + recheck/1]). + +-compile({parse_transform,eqc_warn}).