Mercurial > hg > ltpda
comparison m-toolbox/classes/tests/@ut_result/ut_result.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % UT_RESULT encapsulates the result of running a single ltpda unit test. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: UT_RESULT encapsulates the result of running a single | |
5 % ltpda unit test. | |
6 % | |
7 % SUPER CLASSES: handle | |
8 % | |
9 % | |
10 % VERSION: $Id: ut_result.m,v 1.3 2011/05/24 19:04:16 ingo Exp $ | |
11 % | |
12 % | |
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
14 classdef ut_result < handle | |
15 | |
16 properties | |
17 | |
18 message = ''; | |
19 started = 0; | |
20 stopped = 0; | |
21 | |
22 testClass = ''; | |
23 testMethod = ''; | |
24 testDescription = ''; | |
25 | |
26 passed = false; | |
27 | |
28 end | |
29 | |
30 properties (Dependent = true) | |
31 runtime; | |
32 end | |
33 | |
34 | |
35 methods | |
36 function result = ut_result(utp, method) | |
37 result.started = now; | |
38 result.testMethod = method; | |
39 % Special case if 'utp' is a string | |
40 if ischar(utp) | |
41 result.testClass = utp; | |
42 result.testDescription = 'not available'; | |
43 else | |
44 result.testClass = class(utp); | |
45 result.testDescription = feval('help', [class(utp) '/' method]); | |
46 end | |
47 end | |
48 | |
49 function finish(result) | |
50 result.stopped = now; | |
51 end | |
52 | |
53 function val = get.runtime(result) | |
54 val = 86400*(result.stopped - result.started); | |
55 end | |
56 | |
57 end | |
58 | |
59 methods (Static) | |
60 | |
61 function str = formatException(Me) | |
62 str = [strrep(Me.message, sprintf('\n'), ' ') ' - ' Me.stack(1).name ' - line ' num2str(Me.stack(1).line)]; | |
63 end | |
64 | |
65 end | |
66 | |
67 end |