Skip to content

Commit

Permalink
Address code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Aug 30, 2023
1 parent 7cb599c commit e83a080
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
5 changes: 3 additions & 2 deletions matlab/test/arrow/array/hNumericArray.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function TestArrowType(tc)
end

function TestIsEqualTrue(tc)
% Verifies isequal returns true when expected. Two are
% Verifies isequal returns true when expected. Two arrays are
% considered equal if:
% 1. They have the same type
% 2. They have the same length
Expand All @@ -171,7 +171,8 @@ function TestIsEqualTrue(tc)

function TestIsEqualFalse(tc)
% Verify isequal returns false when expected. Two arrays are
% considered not equal if one of the conditions is met:
% considered not equal if one of the following conditions is
% met:
% 1. They have different types
% 2. They have different lengths
% 3. Different elements are valid
Expand Down
2 changes: 1 addition & 1 deletion matlab/test/arrow/array/tBooleanArray.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function TestArrowType(tc)
end

function TestIsEqualTrue(tc)
% Verifies isequal returns true when expected. Two are
% Verifies isequal returns true when expected. Two arrays are
% considered equal if:
% 1. They have the same type
% 2. They have the same length
Expand Down
1 change: 1 addition & 0 deletions matlab/test/arrow/array/tTime32Array.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ function TestIsEqualFalse(tc, Unit)
% 2. They have different lengths
% 3. Different elements are valid
% 4. The corresponding valid elements are not equal.
% 5. They have the same TimeUnit.

times1 = seconds([1 2 3 4]);
times2 = seconds([1 1 2 3]);
Expand Down
5 changes: 3 additions & 2 deletions matlab/test/arrow/array/tTime64Array.m
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,13 @@ function NanosecondPrecision(testCase)
end

function TestIsEqualTrue(tc, Unit)
% Verifies isequal returns true when expected. Two are
% Verifies isequal returns true when expected. Two arrays are
% considered equal if:
% 1. They have the same type
% 2. They have the same length
% 3. The same elements are valid
% 4. Corresponding valid elements are equal.
% 5. They have the same TimeUnit

times1 = seconds([1 2 3 4]);
times2 = seconds([1 2 10 4]);
Expand Down Expand Up @@ -283,7 +284,7 @@ function TestIsEqualFalse(tc, Unit)
end

function TestIsEqualFalseTimeUnitMistmatch(tc)
% Verify two Time64Arrays are not considered equal they have
% Verify two Time64Arrays are not considered equal if they have
% different TimeUnit values.
times1 = seconds([1 2 3 4]);

Expand Down
15 changes: 15 additions & 0 deletions matlab/test/arrow/array/tTimestampArray.m
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,21 @@ function TestIsEqualFalseTimeZoneMistmatch(tc)
tc.verifyFalse(isequal(array1, array2));
end

function TestIsEqualSameInstantDifferentTimeZone(tc)
% Verify two TimestampArrays are not considered equal if
% they represent the same "instant in time", but have different
% TimeZone values.
dates1 = datetime(2023, 6, 22, TimeZone="America/Anchorage") + days(0:4);
dates2 = dates1;
dates2.TimeZone = "America/New_York";

array1 = tc.ArrowArrayConstructorFcn(dates1);
array2 = tc.ArrowArrayConstructorFcn(dates2);

% arrays are not equal
tc.verifyFalse(isequal(array1, array2));
end

function TestIsEqualFalseTimeUnitMistmatch(tc, TimeZone)
% Verify two TimestampArrays are not considered equal if their
% TimeUnit values differ.
Expand Down

0 comments on commit e83a080

Please sign in to comment.