1 classdef ConfRepoMgrCommonTC < matlab.unittest.TestCase
2 properties (Access=
protected)
4 SDefaultEthalon=struct('firstProp','alpha','secondProp','beta');
8 methods (Access=private)
9 function self=initData(self)
12 self.cm=self.factory.getInstance();
13 SConfA=struct('confName','testConfA','alpha',0,'beta',0);
14 SConfB=struct('confName','testConfB','alpha',11,'beta',11);
16 self.cm.putConf('testConfA',SConfA,0);
17 self.cm.putConf('testConfB',SConfB,0);
23 self = self@matlab.unittest.TestCase(varargin{:});
27 properties (MethodSetupParameter)
28 factoryParam=
struct(
'plain',...
40 methods (TestMethodSetup)
41 function self = setUp(
self,factoryParam)
42 self.factory=factoryParam;
48 function self = test_setParamAfterSelect(self)
50 cm=self.cm; %
#ok<*PROP> 51 cm.selectConf(
'testConfA');
52 valOrig=cm.getParam(
'alpha');
54 cm.setParam(
'alpha',val,
'writeDepth',
'cache');
55 cm.selectConf(
'testConfA',
'reloadIfSelected',
false);
56 self.verifyEqual(val,cm.getParam(
'alpha'));
57 cm.selectConf(
'testConfA',
'reloadIfSelected',
true);
58 self.verifyEqual(valOrig,cm.getParam(
'alpha'));
61 function testCacheConf(
self)
62 CONF_NAME_LIST={
'tstA',
'tstB',
'tstC'};
64 SConfA=
struct(
'confName',
'tstA',
'alpha',0,
'beta',0);
65 SConfB=
struct(
'confName',
'tstB',
'alpha',2,
'beta',2);
68 cm.putConfToCache(
'tstA',SConfA,SMeta);
69 checkIfCached([
true,
false,
false]);
70 checkIfSelected([
false,
false,
false]);
71 cm.putConfToCacheAndSelect(
'tstB',SConfB,SMeta);
72 checkIfCached([
true,
true,
false]);
73 checkIfSelected([
false,
true,
false]);
74 cm.putConfToStorage(
'tstC',SConfB,SMeta);
75 checkIfCached([
true,
true,
false]);
76 checkIfSelected([
false,
true,
false]);
78 function checkIfCached(isExpCachedVec)
79 isCachedVec=cellfun(@(x)cm.isCachedConf(x),CONF_NAME_LIST);
80 self.verifyEqual(isExpCachedVec,isCachedVec);
82 function checkIfSelected(isExpSelectedVec)
83 isSelectedVec=cellfun(@(x)cm.isConfSelected(x),CONF_NAME_LIST);
84 self.verifyEqual(isExpSelectedVec,isSelectedVec);