Mercurial > hg > ltpda
comparison m-toolbox/test/repo_tests/test_param.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_param(varargin) | |
2 | |
3 if nargin == 0 | |
4 [conn, username] = mysql_connect('localhost', 'ltpda_test'); | |
5 else | |
6 conn = varargin{1}; | |
7 username = varargin{2}; | |
8 end | |
9 | |
10 %% Submit a parameter | |
11 p1 = param('a', 'val'); | |
12 p2 = param('b', 3); | |
13 | |
14 sinfo.conn = conn; | |
15 sinfo.username = username; | |
16 sinfo.experiment_title = 'submit param'; | |
17 sinfo.experiment_description = 'this is just a test of the whole thing'; | |
18 sinfo.reference_ids = ''; | |
19 sinfo.additional_comments = 'none'; | |
20 sinfo.additional_authors = 'no one'; | |
21 | |
22 | |
23 [ids, cid] = ltpda_obj_submit(p1, p2, sinfo); | |
24 | |
25 %% Retrieve the object | |
26 | |
27 q = ltpda_obj_retrieve(conn, cid); | |
28 | |
29 %% Close connection | |
30 if nargin == 0 | |
31 close(conn); | |
32 end | |
33 | |
34 | |
35 %% Test | |
36 | |
37 if p1 ~= q{1} | |
38 error('### param objects are not the same.') | |
39 end | |
40 | |
41 if p2 ~= q{2} | |
42 error('### param objects are not the same.') | |
43 end |