Skip to content

Commit

Permalink
Move display unit tests for DateType classes to tDisplay.m
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Sep 6, 2023
1 parent c210fcf commit 3b0f4fe
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 46 deletions.
22 changes: 0 additions & 22 deletions matlab/test/arrow/type/tDate32Type.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,6 @@ function DefaultDateUnit(testCase)
testCase.verifyEqual(actualUnit, expectedUnit);
end

function Display(testCase)
% Verify the display of Date32Type objects.
%
% Example:
%
% Date32Type with properties:
%
% ID: Date32
% DateUnit: Day
%
type = testCase.ConstructionFcn(); %#ok<NASGU>
classnameLink = "<a href=""matlab:helpPopup arrow.type.Date32Type"" style=""font-weight:bold"">Date32Type</a>";
header = " " + classnameLink + " with properties:" + newline;
body = strjust(pad(["ID:"; "DateUnit:"]));
body = body + " " + ["Date32"; "Day"];
body = " " + body;
footer = string(newline);
expectedDisplay = char(strjoin([header body' footer], newline));
actualDisplay = evalc('disp(type)');
testCase.verifyEqual(actualDisplay, expectedDisplay);
end

function DateUnitNoSetter(testCase)
% Verify that an error is thrown when trying to set the value
% of the DateUnit property.
Expand Down
22 changes: 0 additions & 22 deletions matlab/test/arrow/type/tDate64Type.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,6 @@ function DefaultDateUnit(testCase)
testCase.verifyEqual(actualUnit, expectedUnit);
end

function Display(testCase)
% Verify the display of Date64Type objects.
%
% Example:
%
% Date32Type with properties:
%
% ID: Date64
% DateUnit: Millisecond
%
type = testCase.ConstructionFcn(); %#ok<NASGU>
classnameLink = "<a href=""matlab:helpPopup arrow.type.Date64Type"" style=""font-weight:bold"">Date64Type</a>";
header = " " + classnameLink + " with properties:" + newline;
body = strjust(pad(["ID:"; "DateUnit:"]));
body = body + " " + ["Date64"; "Millisecond"];
body = " " + body;
footer = string(newline);
expectedDisplay = char(strjoin([header body' footer], newline));
actualDisplay = evalc('disp(type)');
testCase.verifyEqual(actualDisplay, expectedDisplay);
end

function DateUnitNoSetter(testCase)
% Verify that an error is thrown when trying to set the value
% of the DateUnit property.
Expand Down
28 changes: 26 additions & 2 deletions matlab/test/arrow/type/tDisplay.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ function TestTimeType(testCase, TimeType)
%
% ID: Time32
% TimeUnit: Second
%

type = TimeType;
fullClassName = string(class(type));
Expand All @@ -157,7 +156,32 @@ function TestTimeType(testCase, TimeType)

header = " " + typeLink + " with properties:" + newline;
body = strjust(pad(["ID:"; "TimeUnit:"]));
body = body + " " + ["Time32"; string(type.TimeUnit)];
body = body + " " + [string(type.ID); string(type.TimeUnit)];
body = " " + body;
footer = string(newline);
expectedDisplay = char(strjoin([header body' footer], newline));
actualDisplay = evalc('disp(type)');
testCase.verifyEqual(actualDisplay, expectedDisplay);
end

function TestDateType(testCase, DateType)
% Verify the display of DateType objects.
%
% Example:
%
% Date32Type with properties:
%
% ID: Date32
% DateUnit: Day

type = DateType;
fullClassName = string(class(type));
className = reverse(extractBefore(reverse(fullClassName), "."));
typeLink = makeLinkString(FullClassName=fullClassName, ClassName=className, BoldFont=true);

header = " " + typeLink + " with properties:" + newline;
body = strjust(pad(["ID:"; "DateUnit:"]));
body = body + " " + [string(type.ID); string(type.DateUnit)];
body = " " + body;
footer = string(newline);
expectedDisplay = char(strjoin([header body' footer], newline));
Expand Down

0 comments on commit 3b0f4fe

Please sign in to comment.