Skip to content

Commit

Permalink
Add test for creating a list array from a cell array that just contains
Browse files Browse the repository at this point in the history
empty arrays
  • Loading branch information
sgilmore10 committed Nov 2, 2023
1 parent af7203b commit c62784d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions matlab/test/arrow/array/list/tFromMATLAB.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,33 @@ function ListOfListOfStrings(testCase)
testCase.verifyEqual(actual, expected);
end

function OnlyEmptyElements(testCase)
% Create a ListArray containing only empty elements.
import arrow.array.ListArray

emptyDuration = duration.empty(0, 0);

C = {emptyDuration, emptyDuration, emptyDuration, emptyDuration};
actual = ListArray.fromMATLAB(C);

values = arrow.array(duration.empty);
offsets = arrow.array(int32([0 0 0 0 0]));
expected = ListArray.fromArrays(offsets, values);

testCase.verifyEqual(actual, expected);
end

function ClassTypeMismatchError(testCase)
% Verify fromMATLAB throws an error whose identifier is
% "arrow:array:list:ClassTypeMismatch" if given a cell array
% containing arrays with different class types.
import arrow.array.ListArray

C = {1, [2 3 4], "A", 5};
fcn = @() ListArray.fromMATLAB(C);
testCase.verifyError(fcn, "arrow:array:list:ClassTypeMismatch");
end

end

end

0 comments on commit c62784d

Please sign in to comment.