Mercurial > hg > ltpda
comparison m-toolbox/classes/tests/database/@ltpda_objmeta_table/test_objmeta_quantity.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % | |
2 % DESCRIPTION: Tests that the metadata 'quantity' of a database | |
3 % works for a ltpda object. | |
4 % | |
5 % CHECKS: - Check that we get only one connection from the used | |
6 % repository PLIST | |
7 % - Check that the metadata was set with a submit PLIST | |
8 % - Check that the metadata was set with a submit structure | |
9 % | |
10 % VERSION: $Id: test_objmeta_quantity.m,v 1.2 2011/05/24 19:09:54 ingo Exp $ | |
11 % | |
12 function varargout = test_objmeta_quantity(varargin) | |
13 | |
14 utp = varargin{1}; | |
15 | |
16 if ~utp.testRunner.skipRepoTests() | |
17 | |
18 dbTable = 'objmeta'; | |
19 tableField = 'quantity'; | |
20 | |
21 % Check that the metadata was set with a submit PLIST | |
22 try | |
23 for nn = 1:numel(utp.objIds) | |
24 | |
25 % get 'quantity' from the objmeta table | |
26 val = utp.getTableEntry(dbTable, tableField, utp.objIds(nn)); | |
27 | |
28 % Check that we get only one result for the query | |
29 assert(numel(val)==1) | |
30 | |
31 % Check that the query result with the entry in the sinfoPlist | |
32 assert(strcmp(val{1}, utp.sinfoPlist.find(tableField))) | |
33 end | |
34 catch Me | |
35 throw(Me); | |
36 end | |
37 | |
38 % Check that the metadata was set with a submit structure | |
39 try | |
40 for nn = 1:numel(utp.objIdsStruct) | |
41 | |
42 % get 'quantity' from the objmeta table | |
43 val = utp.getTableEntry(dbTable, tableField, utp.objIdsStruct(nn)); | |
44 | |
45 % Check that we get only one result for the query | |
46 assert(numel(val)==1) | |
47 | |
48 % Check that the query result with the entry in the sinfoStruct | |
49 assert(strcmp(val{1}, utp.sinfoStruct.(tableField))) | |
50 end | |
51 catch Me | |
52 throw(Me); | |
53 end | |
54 | |
55 varargout{1} = sprintf('Test the field ''%s'' of the database table ''%s'' with the database %s ', tableField, dbTable, utp.testRunner.repositoryPlist.find('database')); | |
56 else | |
57 varargout{1} = 'Skip database test'; | |
58 end | |
59 end |