comparison testing/utp_1.1/generic_utps/utp_60.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents
children
comparison
equal deleted inserted replaced
43:bc767aaa99a8 44:409a22968d5e
1
2 % <TestDescription>
3 %
4 % Tests that the constructor method doesn't apply history to the read
5 % MAT-file constructor.
6 %
7 % </TestDescription>
8 function result = utp_60(cl, obj1, ple1)
9
10 % <SyntaxDescription>
11 %
12 % Tests that the constructor method doesn't apply history to the read
13 % MAT-file constructor.
14 %
15 % </SyntaxDescription>
16
17 msg = '';
18 try
19 % <SyntaxCode>
20 filename = 'obj.mat';
21 ss = feval(cl, obj1);
22 save(ss, filename);
23
24 out = feval(cl, filename);
25 mout = rebuild(out);
26 % </SyntaxCode>
27 stest = true;
28 catch err
29 msg = err.message;
30 disp(err.message)
31 stest = false;
32 end
33
34 % <AlgoDescription>
35 %
36 % 1) Check that the history is the same as the history of the saved
37 % object. Because save and load shouldn't add a history step.
38 % 2) Check that the 'rebuild' method produces the same object as 'out'.
39 %
40 % </AlgoDescription>
41
42 atest = true;
43 if stest
44 % <AlgoCode>
45 % Check that the saved and loaded objects are the same
46 if ~eq(out, ss)
47 msg = ['The saved and loaded objects are not equal: ' lastwarn];
48 atest = false;
49 end
50 % Check the rebuilt object
51 if ~eq(mout, out, ple1)
52 msg = ['The original and rebuilt objects are not equal: ' lastwarn];
53 atest = false;
54 end
55 % </AlgoCode>
56 delete(filename);
57 else
58 atest = false;
59 end
60
61 % Return a result structure
62 dd = dbstack;
63 mfilename = dd(2).file(1:end-2);
64 result = utp_prepare_result(atest, stest, dbstack, mfilename, msg);
65 end % END UTP_08
66
67