function swan_io_spectrum_write_test
%SWAN_IO_SPECTRUM_WRITE_TEST   tets for swan_io_spectrum_write
%
%See also: swan_io_spectrum_write

MTestCategory.DataAccess;

%% load

   D.frequency      = [0.001 0.06 0.07 0.08 0.1 0.11 0.13 0.14 0.15 0.19 0.21 0.23 0.25 0.3];
   D.frequency_type = 'a';
   D.VaDens         = [0.0806112 0.0808989 0.0996818 0.186312 0.429708 0.51593 0.671394 0.749714 0.800373 0.522904 0.506111 0.470004 0.428028 0.296816 ];
   D.CDIR           = zeros(size(D.frequency));
   D.DSPRDEGR       = zeros(size(D.frequency));
   D.x              = 15060;
   D.y              = 61303;

% D = swan_io_spectrum('swan_io_spectrum_write_test0.sp1');

%% test inverse

   swan_io_spectrum_write([mfilename('fullpath'),'swan_io_spectrum_write_test1.sp1'],D);    

%% test scalar/vector input

   swan_io_spectrum_write([mfilename('fullpath'),'swan_io_spectrum_write_test2_11.sp1'],... 
          'x',D.x,...
          'y',D.y,...
      'afreq',D.frequency,...
     'VaDens',D.VaDens,...
       'CDIR',D.CDIR,...
   'DSPRDEGR',D.DSPRDEGR);
   
   swan_io_spectrum_write([mfilename('fullpath'),'swan_io_spectrum_write_test2_10.sp1'],... 
          'x',D.x,...
          'y',D.y,...
      'afreq',D.frequency,...
     'VaDens',D.VaDens,...
       'CDIR',D.CDIR,...
   'DSPRDEGR',0);
   
   swan_io_spectrum_write([mfilename('fullpath'),'swan_io_spectrum_write_test2_01.sp1'],...
          'x',D.x,...
          'y',D.y,...
      'afreq',D.frequency,...
     'VaDens',D.VaDens,...
       'CDIR',0,...
   'DSPRDEGR',D.DSPRDEGR);
   
   swan_io_spectrum_write([mfilename('fullpath'),'swan_io_spectrum_write_test2_00.sp1'],...
          'x',D.x,...
          'y',D.y,...
      'afreq',D.frequency,...
     'VaDens',D.VaDens,...
       'CDIR',0,...
   'DSPRDEGR',0);
