clear all;

%% Char param
xmlfile = 'char.xml';
p = param('a', 'val');
save(p, xmlfile)
q = param(xmlfile);
if p ~= q
  error('param char test failed')
end


%% Numeric param
xmlfile = 'numeric.xml';
p = param('a', 2);
save(p, xmlfile)
q = param(xmlfile);
if p ~= q
  error('param numeric test failed')
end


%% Specwin param
xmlfile = 'specwin.xml';
p = param('a', specwin('Hanning', 20));
save(p, xmlfile)
q = param(xmlfile);
if p ~= q
  error('param specwin test failed')
end

%% Time param
xmlfile = 'time.xml';
p = param('a', time());
save(p, xmlfile)
q = param(xmlfile);
if p ~= q
  error('param time test failed')
end

%% MIIR param
xmlfile = 'miir.xml';
pl_mii = plist('type', 'bandpass', 'fs', 1000, 'fc', [50 100], 'order', 3);
p = param('a', miir(pl_mii));
save(p, xmlfile)
q = param(xmlfile);
if p ~= q(1)
  error('param miir test failed')
end


%% MFIR param
xmlfile = 'mfir.xml';
pl_mir = plist('type', 'lowpass', 'Win', specwin('Kaiser', 10, 150), 'fs', 100, 'fc', 20);
p = param('a', mfir(pl_mir));
save(p, xmlfile)
q = param(xmlfile);
if p ~= q(1)
  error('param mfir test failed')
end

%% pole param
xmlfile = 'pole.xml';
p = param('a', pz(1));
save(p, xmlfile)
q = param(xmlfile);
if p ~= q
  error('param pole test failed')
end

%% zero param
xmlfile = 'zero.xml';
p = param('a', pz(1,10));
save(p, xmlfile)
q = param(xmlfile);
if p ~= q
  error('param zero test failed')
end

%% pzmodel param
xmlfile = 'pzmodel.xml';
pzm = pzmodel(1, [pz(1) pz(2,10)], pz(4.3));
p = param('a', pzm);
save(p, xmlfile);
q = param(xmlfile);
if p ~= q
  error('param pzmodel test failed')
end
