Skip to content

Commit

Permalink
Update tStructArray based on code feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Sep 20, 2023
1 parent 3dd9df6 commit e913f15
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions matlab/test/arrow/array/tStructArray.m
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ function toMATLAB(tc)
% in the StructArray are set to the type-specific null values.
valid = [1 2 5];
array = StructArray.fromArrays(tc.Float64Array, tc.StringArray, FieldNames=["X", "Y"], Valid=valid);
expectedTable([3 4], :) = repmat({NaN string(missing)}, [2 1]);
float64NullValue = tc.Float64Array.NullSubstitutionValue;
stringNullValue = tc.StringArray.NullSubstitutionValue;
expectedTable([3 4], :) = repmat({float64NullValue stringNullValue}, [2 1]);
actualTable = toMATLAB(array);
tc.verifyEqual(actualTable, expectedTable);
end
Expand All @@ -244,7 +246,9 @@ function table(tc)
% in the StructArray are set to the type-specific null values.
valid = [1 2 5];
array = StructArray.fromArrays(tc.Float64Array, tc.StringArray, FieldNames=["X", "Y"], Valid=valid);
expectedTable([3 4], :) = repmat({NaN string(missing)}, [2 1]);
float64NullValue = tc.Float64Array.NullSubstitutionValue;
stringNullValue = tc.StringArray.NullSubstitutionValue;
expectedTable([3 4], :) = repmat({float64NullValue stringNullValue}, [2 1]);
actualTable = toMATLAB(array);
tc.verifyEqual(actualTable, expectedTable);
end
Expand All @@ -263,7 +267,9 @@ function IsEqualFalse(tc)
array1 = StructArray.fromArrays(tc.Float64Array, tc.StringArray, FieldNames=["X", "Y"]);
array2 = StructArray.fromArrays(tc.StringArray, tc.Float64Array, FieldNames=["X", "Y"]);
array3 = StructArray.fromArrays(tc.Float64Array, tc.StringArray, FieldNames=["A", "B"]);
% StructArrays have the same FieldNames but the Fields have different types.
tc.verifyFalse(isequal(array1, array2));
% Fields of the StructArrays have the same types but the StructArrays have different FieldNames.
tc.verifyFalse(isequal(array1, array3));
end

Expand Down

0 comments on commit e913f15

Please sign in to comment.