Skip to content

Commit

Permalink
Add positive test cases to tRoundTripRecordBatch.m
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed May 24, 2024
1 parent e3eac68 commit 4903c53
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions matlab/test/arrow/c/tRoundTripRecordBatch.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,57 @@
classdef tRoundTripRecordBatch < matlab.unittest.TestCase

methods (Test)
% Test methods
function ZeroColumnRecordBatch(testCase)
expected = arrow.recordBatch(table());

cArray = arrow.c.Array();
cSchema = arrow.c.Schema();
expected.export(cArray.Address, cSchema.Address);
actual = arrow.tabular.RecordBatch.import(cArray, cSchema);

function unimplementedTest(testCase)
testCase.verifyFail("Unimplemented test");
testCase.verifyEqual(actual, expected);
end

function ZeroRowRecordBatch(testCase)
doubleArray = arrow.array([]);
stringArray = arrow.array(string.empty(0, 0));
expected = arrow.tabular.RecordBatch.fromArrays(doubleArray, stringArray);

cArray = arrow.c.Array();
cSchema = arrow.c.Schema();
expected.export(cArray.Address, cSchema.Address);
actual = arrow.tabular.RecordBatch.import(cArray, cSchema);

testCase.verifyEqual(actual, expected);
end

function OneRowRecordBatch(testCase)
varNames = ["Col1" "Col2" "Col3"];
t = table(1, "A", false, VariableNames=varNames);
expected = arrow.recordBatch(t);

cArray = arrow.c.Array();
cSchema = arrow.c.Schema();
expected.export(cArray.Address, cSchema.Address);
actual = arrow.tabular.RecordBatch.import(cArray, cSchema);

testCase.verifyEqual(actual, expected);
end

function MultiRowRecordBatch(testCase)
varNames = ["Col1" "Col2" "Col3"];
t = table((1:3)', ["A"; "B"; "C"], [false; true; false],...
VariableNames=varNames);
expected = arrow.recordBatch(t);

cArray = arrow.c.Array();
cSchema = arrow.c.Schema();
expected.export(cArray.Address, cSchema.Address);
actual = arrow.tabular.RecordBatch.import(cArray, cSchema);

testCase.verifyEqual(actual, expected);
end

end

end

0 comments on commit 4903c53

Please sign in to comment.