diff m-toolbox/classes/tests/database/@ltpda_fsdata_table/test_fsdata_fs.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/tests/database/@ltpda_fsdata_table/test_fsdata_fs.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,45 @@
+%
+% DESCRIPTION: Tests the 'fsdata' table of the database.
+%
+% CHECKS:      - Check that the 'fs' contains the correct fs from the test data.
+%
+% VERSION:     $Id: test_fsdata_fs.m,v 1.3 2011/05/25 16:25:31 ingo Exp $
+%
+function varargout = test_fsdata_fs(varargin)
+  
+  utp = varargin{1};
+  
+  if ~utp.testRunner.skipRepoTests()
+    
+    dbTable    = 'fsdata';
+    tableField = 'fs';
+    
+    % Check that the metadata was set with a submit PLIST
+    try
+      for nn = 1:numel(utp.objIds)
+        
+        val = getTableEntry(utp, dbTable, tableField, utp.objIds(nn));
+        
+        % Check that we get only one result for the query
+        assert(numel(val)==1)
+        
+        % Check that the entry in the table is the same as the fs of
+        % the test data
+        
+        % Special case if the frequence is NaN
+        if isnan(utp.testData(nn).fs)
+          assert(isempty(val{1}))
+        else
+          assert(isequalwithequalnans(val{1}, utp.testData(nn).fs))
+        end
+        
+      end
+    catch Me
+      throw(Me);
+    end
+    
+    varargout{1} = sprintf('Test the field ''%s'' of the database table ''%s'' with the database %s ', tableField, dbTable, utp.testRunner.repositoryPlist.find('database'));
+  else
+    varargout{1} = 'Skip database test';
+  end
+end