comparison m-toolbox/test/repo_tests/test_time.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 function test_time(varargin)
2 % A test function to submit a time to the repository. The time is then
3 % retrieved and compared to the original one.
4 %
5 % Usage: test_time() - connects to Hannover repository
6 % test_time(conn) - connects to the repository specified by
7 % the database conn object.
8 %
9 % M Hewitson 24-02-08
10 %
11 % $Id: test_time.m,v 1.4 2008/02/24 10:17:54 hewitson Exp $
12 %
13
14 if nargin == 0
15 conn = mysql_connect('130.75.117.67', 'ltpda_test');
16 else
17 conn = varargin{1};
18 end
19
20 %% Submit a timeformat
21 p = time();
22
23 sinfo.conn = conn;
24 sinfo.experiment_title = 'submit time';
25 sinfo.experiment_description = 'this is just a test of the whole thing';
26 sinfo.analysis_description = 'just submitting';
27 sinfo.quantity = 'none';
28 sinfo.keywords = 'none';
29 sinfo.reference_ids = '1,2';
30 sinfo.additional_comments = 'none';
31 sinfo.additional_authors = 'no one';
32
33 [ids, cid] = ltpda_obj_submit(p, sinfo);
34
35 %% Retrieve the object
36
37 q = ltpda_obj_retrieve(conn, ids);
38
39 %% Close connection
40 if nargin == 0
41 close(conn);
42 end
43
44
45 %% Test
46
47 if p ~= q
48 error('### time objects are not the same.')
49 end