view m-toolbox/test/repo_tests/test_param.m @ 47:dd93c9ba6624 database-connection-manager

Fix Java dialog
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

function test_param(varargin)

if nargin == 0
  [conn, username] = mysql_connect('localhost', 'ltpda_test');
else
  conn = varargin{1};
  username = varargin{2};
end

%% Submit a parameter
p1 = param('a', 'val');
p2 = param('b', 3);

sinfo.conn                   = conn;
sinfo.username               = username;
sinfo.experiment_title       = 'submit param';
sinfo.experiment_description = 'this is just a test of the whole thing';
sinfo.reference_ids          = '';
sinfo.additional_comments    = 'none';
sinfo.additional_authors     = 'no one';


[ids, cid] = ltpda_obj_submit(p1, p2, sinfo);

%% Retrieve the object

q = ltpda_obj_retrieve(conn, cid);

%% Close connection
if nargin == 0
  close(conn);
end


%% Test

if p1 ~= q{1}
  error('### param objects are not the same.')
end

if p2 ~= q{2}
  error('### param objects are not the same.')
end