Updates:
Status: ReviewFailed
Comment #22 on issue 66 by
heartofm...@gmail.com: Improve display methods
0) Please revert changes to elltool.test.run_tests and potentially to
other run_tests functions
1) Apply smart-indent (Ctrl + I) to all your code
2) Fix all matlab code analyzer warnings (see
http://www.mathworks.co.uk/help/matlab/matlab_prog/check-code-for-errors-and-warnings.html)
in your code
3) Remove copy-pasting in ellipsoid/hyperplane.toStruct in the following
block of code
if (isPropIncluded)
SFieldNiceNames = struct('normal', 'normal', 'shift', 'shift',...
'absTol', 'absTol');
SFieldDescr = struct('normal', 'Hyperplane normal.',...
'shift', 'Hyperplane shift along normal from
origin.',...
'absTol', 'Absolute tolerance.');
else
SFieldNiceNames = struct('normal', 'normal', 'shift', 'shift');
SFieldDescr = struct('normal', 'Hyperplane normal.',...
'shift', 'Hyperplane shift along normal from
origin.');
end
4) In
ellipsoid.eq and hyperplane.eq use the second output of toStruct to name
the fields of compare structures.
As a result the field names should be "Q" and "q".
5) In ellipsoid.display
a) rename SdataArray into SDataArray, SfieldNames into SFieldNames etc.
b) the text output generated by the following lines should be generated
by strucdisp (just form Properties structure with actualClass and size
fields)
fprintf('Properties:\n');
fprintf(' |\n');
fprintf(' |-- actualClass : ''ellipsoid''\n');
fprintf(' |--------- size : ');
6) In ellipsoid.eq and hyperplane.eq
The following code doesn't make any sense becase for empty array there is no
Q matrix defined so you do not have anything to extract a square root from.
Prior to Dmitry Khristoforov's change
isempty was a method of ellipsoid class that return true for ellipsoids
without any matrix/center specified. Now the name of this method
is isEmpty so when you write isempty you call matlab built-in function that
returns true for arrays of 0x1x0 size.
Also, please use getAbsTol method for ellFirstArr, not just for the first
element.
This method returns a scalar value of absTol as a second output.
if (~isempty(ellFirstArr))
ABS_TOL = ellFirstArr(1).absTol;
else
ABS_TOL = 1e-6;
end
7) New functionality in strucdisp still is not covered with tests
8) Tests for display methods are too format-sensitive. Instead of comparing
the output with the expected output symbol by symbol
please find the entries correspoding to the specific field names and then
parse the following symbol representation of field value.
This way the tests won't be sensitive to the formatting that much.
Also, I still think that it is possible to write generic tests for both
hyperplane and ellipsoid. The only difference between them
is the field names and their initial values you use to create the objects.
Thus you can move the body of test methods in ADispStruct test case
(btw please rename it into ADispStructTC) and create the abstract method
that return field names and their value. Then in the derived
classes (EllipsoidDispStructTC and HyperplaneDispStructTC) you can
override the abstract methods by specifying ellipsoid-specific and
hyperplane-specific field names and values.
9) Once you are done please run elltool.core.test.run_tests first and then
elltool.test.run_tests to make sure that you haven't broken anything.
There were some tests for ellipsoid.display and we
10) Add tests for toStruct/fromStruct/eq/diplsay tests for
a) empty arrays of both ellipsoid and hyperplanes
b) scalar objects (I believe that you have them, just make sure that you
have all 4 methods covered)
c) multi-dimensional arrays (not just vectors)
Once you are done - please change the status of the issue
to "ReadyForReview"