Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.220.947 Times

Doctest - embed testable examples in your function's help comments 1.0

  Date Added: September 08, 2013  |  Visits: 363

Doctest - embed testable examples in your function's help comments

Report Broken Link
Printer Friendly Version


Product Homepage
Download (39 downloads)



Unit testing is great, but it can seem like overkill to make a whole new file for every test you want to run. Doctest allows you to embed tests in the documentation of your function (or class or method), so that they're in the same file as the code they test. They can also be valuable demonstrations of how to call your code.Say you have a function that adds 3 to any numbers you give it. Let's add a doctest:function sum = add3(value)% adds 3 to a number%% add3(value)% returns (value + 3)%% Examples:%% >> add3(7)%% ans =%% 10%% >> add3([2 4])%% ans =%% 5 7if ~ isnumeric(value) error('add3(value) requires value to be a number');endsum = value + 3;Put that in "add3.m".Now we can run "doctest add3", and we'll get this:TAP version 131..3ok 1 - "add3(7)"ok 2 - "add3([2 4])"This tells you that your examples work correctly. Now, if you accidentally change the function so that it adds 10^30 instead of 3, the next time you run your tests you'll quickly find the problem. Yay testing!Other features --- wildcard support for output that *should* change --- test functions, classes, and methods --- handles exceptions, see if you correctly catch an error --- uses a standard output format ( http://testanything.org/ ) --- easy to write examples, just cut+paste from command windowThis function is inspired by the Python doctest module: http://docs.python.org/library/doctest.htmlThe newest version can always be obtained at http://bitbucket.org/tgs/doctest-for-matlab/src , where there is also a bug tracker if you have any issues. Contributions are also welcome!

Requirements: No special requirements
Platforms: Matlab
Keyword: Catch Change Classes Error Exceptions Features Format Functions Handles Methods Output Problem Quickly Standard Support Testingother Wildcard You039ll
Users rating: 0/10

License: Freeware Size: 20.48 KB
USER REVIEWS
More Reviews or Write Review


DOCTEST - EMBED TESTABLE EXAMPLES IN YOUR FUNCTION'S HELP COMMENTS RELATED
Programming  -  django-form-scaffold 1.0
django-form-scaffold is a package of helper functions for generating Django template code with markup from Django form instances. It solves the problem of generating, over and over again, markup for a full form which is effectively a...
10.24 KB  
Business  -  SSuite Office - Address Book Pro 1.1
This addressbook has all the features and functions you need to keep in contact. SSuite Office - Address Book Pro has all the features and functions you need to keep in contact. Features: · Insert / Edit all your favourite contacts ·...
819 KB  
Utilities  -  IconLogic Timer 1.0
We use this timer during our online training classes. The timer features a very simple interface where you can quickly set the time, an Away message and Welcome back message. The timer is an Adobe AIR application, meaning it will install and run...
40.96 KB  
Scientific Calculators  -  TTCalc 0.8.1
TTCalc is an open source mathematical calculator. It features arithmetical functions, trigonometric functions, inverse trigonometric functions, hyperbolic functions, inverse hyperbolic functions, logical operators, logarithms, functions for...
616.92 KB  
Libraries  -  MIDI::Opus 0.81
MIDI::Opus are functions and methods for MIDI opuses. SYNOPSIS use MIDI; # uses MIDI::Opus et al foreach $one (@ARGV) { my $opus = MIDI::Opus->new({ from_file => $one, no_parse => 1 }); print "$one has ", scalar( $opus->tracks ) " tracksn";...
62.46 KB  
Multi-Purpose Audio Players  -  MegaMind TagEditor 2.1.0
MegaMind TagEditor is a highly developed ID3 tag editing tool loaded with features and functions. The program offers a complex tagging engine, a good-looking interface but also lots of additional features. MegaMind TagEditor is an essential...
2.49 MB  
Programming  -  The Nice Programming Language 1.0
New object-oriented programming language based on Java, with the following advanced features: parametric types, anonymous functions, multi-methods, tuples, optional parameters.Nice also detects more errors during compilation (null pointers, casts).
1.29 MB  
Text Management  -  Input_demo 1.0
This script demonstrates some keyboard input functions and screen output "magic" that some people may be interested (such as for an ASCII game). It is meant as a very simple demonstration only, and does not contain any error checking whatsoever....
 
Web Browser Tools  -  Clustybar 1.2.7
Clustybar is an extension which offers several features to help you find information more quickly and easily..
29.7 KB  
Development Editors  -  PyQt4 for Linux 4. 8. 2003
PyQt is a set of Python bindings for Nokia's Qt application framework and runs on all platforms supported by Qt including Windows, MacOS/X and Linux. There are two sets of bindings: PyQt v4 supports Qt v4; and the older PyQt v3 supports Qt v3 and...
11.2 MB  
NEW DOWNLOADS IN SCRIPTS, DEVELOPMENT TOOLS
Scripts  -  Free Ecommerce website creator 1.2
Free Ecommerce website creator is a free PHP shop creating script. This allows you to put a online shop on your own website. Create your own free ecommerce website for Your Business. Create an online shop using easyGUI online shop creator. The...
1.44 KB  
Scripts  -  MochiGames PHP Script ZDR 1.00
MochiGames PHP Script ZDR is web site, ready for use, for flash games. These flash games are downloaded automatically by "MochiGames PHP Script ZDR" from MochiGames media. The use of the games is free, you can use your own Mochi Publisher ID and...
368.54 KB  
Scripts  -  Php Chat 2.0
Add a free php site, single sign-on and multiple skins, 100% free 1. Server Modes: The chat server has paid mode and free mode. If the free chat mode, a free chat room will be assigned to your website with your domain as the room name. 2....
938.87 KB  
Scripts  -  Nibbleblog 3.0.1
Nibbleblog it's a powerful engine for creation and manipulation of BLOG's completely free. Very simple to install and configure (Only 1 step). The database used is based on XML files and this way it is not necessary to use MySQL or similar DBMS....
371.09 KB  
Scripts  -  PHP File Manager | CloudOsys 2.9b8
CloudOsys is a PHP file manager, a tool that allows your visitors upload files such as media content directly to your website. Your visitors will upload files directly to your website, where they can share and comment on them. Through cloud...
1.41 MB  
Development Tools  -  Aml2CHM 3.50
Those who use the popular Aml Pages text editor might be looking out for a way of generating help files from their text and notes. Aml2CHM is a plug-in that was developed to offer people a quick and efficient way of converting Aml Pages documents...
549.99 KB  
Development Tools  -  VMP Viewer 1.0
This is a very rudimentary tool to visualize the VMP files generated by BrainVoyager. Useful to share files with people who do not have BV.
10 KB  
Development Tools  -  7-Zip for Script 4.42
7-Zip is a file archiver with a high compression ratio.Features:- High compression ratio in new 7z format with LZMA compression- Supported formats:- Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR- Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM,...
624.64 KB  
Development Tools  -  PHP Docbook Displayer for Scripts 1.0b
PHP Docbook Displayer provides XSL and CSS stylesheets, and PHP scripts, to generate easily and dynamically websites from Docbook files.It aims at simplifying to the max the web publication process : simply drop the docbook file under the site root !
102.4 KB  
Development Tools  -  WP Translate 1.0
This simple language translation plugin allows your users to quickly translate your webpages, through a widget on your blog.You have the option to select the title of the Widget, which will be displayed above the language translation form. Users...
10 KB