rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
test_cacheable_object.m
Go to the documentation of this file.
1 function OK = test_cacheable_object
2  % function OK = test_cacheable_object
3  % test for the CacheableObject class
4 
5  OK = true;
6 
7  matfile = fullfile(rbmatlabtemp, 'cacheable_object_test');
8  comatfile = fullfile(rbmatlabtemp, 'cacheable_object_test_co');
9 
10  tobj.large_data = rand(100, 100);
11  tobj.string = 'string';
12  tobj.xyz = 12345;
13 
14  save(matfile, 'tobj');
15 
16  co1 = CacheableObject(matfile);
17 
18  oldobj = co1.obj;
19 
20  save(comatfile, 'co1');
21 
22  load(comatfile);
23 
24  OK = OK & structcmp(co1.obj, oldobj);
25 
26  tobj.xyz = 123;
27  save(matfile, 'tobj');
28 
29  try
30  load(comatfile);
31  OK = OK & isempty(co1.obj);
32  catch
33  end
34 
35  delete([matfile,'.mat']);
36  delete([comatfile,'.mat']);
37 
38 end