Skip to content

Commit c8950b8

Browse files
committed
Add unit tests for arrow.c.Array
1 parent 3e42689 commit c8950b8

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

matlab/test/arrow/tArray.m

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
%TARRAY Defines unit tests for arrow.c.Array.
2+
3+
% Licensed to the Apache Software Foundation (ASF) under one or more
4+
% contributor license agreements. See the NOTICE file distributed with
5+
% this work for additional information regarding copyright ownership.
6+
% The ASF licenses this file to you under the Apache License, Version
7+
% 2.0 (the "License"); you may not use this file except in compliance
8+
% with the License. You may obtain a copy of the License at
9+
%
10+
% http://www.apache.org/licenses/LICENSE-2.0
11+
%
12+
% Unless required by applicable law or agreed to in writing, software
13+
% distributed under the License is distributed on an "AS IS" BASIS,
14+
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15+
% implied. See the License for the specific language governing
16+
% permissions and limitations under the License.
17+
classdef tArray < matlab.unittest.TestCase
18+
19+
methods (Test)
20+
function Smoke(testCase)
21+
array = arrow.c.Array();
22+
23+
% Verify array is an instance of arrow.c.Array.
24+
testCase.verifyInstanceOf(array, "arrow.c.Array");
25+
26+
% Verify array has one public property named Address.
27+
props = properties(array);
28+
testCase.verifyEqual(props, {'Address'});
29+
end
30+
31+
function TestAddressProperty(testCase)
32+
array = arrow.c.Array();
33+
34+
% It's impossible to know what the value of Address will be.
35+
% Just verify Address is a scalar uint64.
36+
address = array.Address;
37+
testCase.verifyInstanceOf(address, "uint64");
38+
testCase.verifyTrue(isscalar(address));
39+
end
40+
41+
function TestAddressNoSetter(testCase)
42+
% Verify the Address property is read-only.
43+
array = arrow.c.Array();
44+
fcn = @() setfield(array, "Address", uint64(10));
45+
testCase.verifyError(fcn, "MATLAB:class:SetProhibited");
46+
end
47+
end
48+
end

0 commit comments

Comments
 (0)