view m-toolbox/classes/tests/@ut_result/ut_result.m @ 32:e22b091498e4
database-connection-manager
Update makeToolbox
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % UT_RESULT encapsulates the result of running a single ltpda unit test.
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: UT_RESULT encapsulates the result of running a single
+ − % ltpda unit test.
+ − %
+ − % SUPER CLASSES: handle
+ − %
+ − %
+ − % VERSION: $Id: ut_result.m,v 1.3 2011/05/24 19:04:16 ingo Exp $
+ − %
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − classdef ut_result < handle
+ −
+ − properties
+ −
+ − message = '';
+ − started = 0;
+ − stopped = 0;
+ −
+ − testClass = '';
+ − testMethod = '';
+ − testDescription = '';
+ −
+ − passed = false;
+ −
+ − end
+ −
+ − properties (Dependent = true)
+ − runtime;
+ − end
+ −
+ −
+ − methods
+ − function result = ut_result(utp, method)
+ − result.started = now;
+ − result.testMethod = method;
+ − % Special case if 'utp' is a string
+ − if ischar(utp)
+ − result.testClass = utp;
+ − result.testDescription = 'not available';
+ − else
+ − result.testClass = class(utp);
+ − result.testDescription = feval('help', [class(utp) '/' method]);
+ − end
+ − end
+ −
+ − function finish(result)
+ − result.stopped = now;
+ − end
+ −
+ − function val = get.runtime(result)
+ − val = 86400*(result.stopped - result.started);
+ − end
+ −
+ − end
+ −
+ − methods (Static)
+ −
+ − function str = formatException(Me)
+ − str = [strrep(Me.message, sprintf('\n'), ' ') ' - ' Me.stack(1).name ' - line ' num2str(Me.stack(1).line)];
+ − end
+ −
+ − end
+ −
+ − end