view m-toolbox/test/repo_tests/test_history.m @ 2:18e956c96a1b database-connection-manager

Add LTPDADatabaseConnectionManager implementation. Matlab code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sun, 04 Dec 2011 21:23:09 +0100
parents f0afece42f48
children
line wrap: on
line source

function test_history(varargin)

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

%% Submit a mfir

a1 = ao(plist('waveform', 'sine wave', 'f', 1, 'phi', 0, 'nsecs', 10, 'fs', 100));
a2 = ao(plist('waveform', 'sine wave', 'f', 1, 'phi', 0, 'nsecs', 10, 'fs', 100));
a3 = a1 + a2;

p = a3.hist;

sinfo.conn                   = conn;
sinfo.username               = username;
sinfo.experiment_title       = 'submit history';
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(p, sinfo);

%% Retrieve the object

q = ltpda_obj_retrieve(conn, cid);

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


%% Test

if p ~= q
  error('### history objects are not the same.')
end