kevingurney commented on code in PR #47059:
URL: https://github.com/apache/arrow/pull/47059#discussion_r2201824769


##########
matlab/test/arrow/array/tValidateArray.m:
##########
@@ -0,0 +1,102 @@
+%TVALIDATEARRAY Test class for the arrow.array.Array/validate() method.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tValidateArray < matlab.unittest.TestCase
+
+    methods (Test)
+
+        function InvalidValidationModeInput(test)
+            % Verify arrow.array.Array/validate() throws an exception if
+            % provided an invalid value for the ValidationMode name-value 
+            % pair.
+            array = arrow.array.Float64Array.fromMATLAB(1:5);
+
+            % Cannot convert "abc" to a ValidtionMode value
+            fcn = @() array.validate(ValidationMode="abc");
+            test.verifyError(fcn, "MATLAB:validation:UnableToConvert");
+
+            % ValidtionMode must be scalar
+            modes = [arrow.array.ValidationMode.Full 
arrow.array.ValidationMode.Minimal];
+            fcn = @() array.validate(ValidationMode=modes);
+            test.verifyError(fcn, "MATLAB:validation:IncompatibleSize");
+
+            % ValidationMode.None is not supported
+            mode = arrow.array.ValidationMode.None;
+            fcn = @() array.validate(ValidationMode=mode);
+            test.verifyError(fcn, "arrow:array:InvalidValidationMode");
+        end
+
+        function ValidationModeMinimalFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateMinimalFailed if
+            % ValidationMode="Minimal" and the array fails the "Minimal"
+            % validation checks.
+            offsets = arrow.array(int32([0 1 3 4 5]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Minimal");
+            test.verifyError(fcn, "arrow:array:ValidateMinimalFailed")
+        end
+
+        function ValidationModeMinimalPasses(test)
+            % Verify arrow.array.Array/validate() does not throw an
+            % exception if ValidationMode="Minimal" the array passes the

Review Comment:
   ```suggestion
               % exception if ValidationMode="Minimal" and the array passes the
   ```



##########
matlab/test/arrow/array/tValidateArray.m:
##########
@@ -0,0 +1,102 @@
+%TVALIDATEARRAY Test class for the arrow.array.Array/validate() method.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tValidateArray < matlab.unittest.TestCase
+
+    methods (Test)
+
+        function InvalidValidationModeInput(test)
+            % Verify arrow.array.Array/validate() throws an exception if
+            % provided an invalid value for the ValidationMode name-value 
+            % pair.
+            array = arrow.array.Float64Array.fromMATLAB(1:5);
+
+            % Cannot convert "abc" to a ValidtionMode value

Review Comment:
   a
   ```suggestion
               % Cannot convert "abc" to a ValidationMode value
   ```



##########
matlab/test/arrow/array/tValidateArray.m:
##########
@@ -0,0 +1,102 @@
+%TVALIDATEARRAY Test class for the arrow.array.Array/validate() method.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tValidateArray < matlab.unittest.TestCase
+
+    methods (Test)
+
+        function InvalidValidationModeInput(test)
+            % Verify arrow.array.Array/validate() throws an exception if
+            % provided an invalid value for the ValidationMode name-value 
+            % pair.
+            array = arrow.array.Float64Array.fromMATLAB(1:5);
+
+            % Cannot convert "abc" to a ValidtionMode value
+            fcn = @() array.validate(ValidationMode="abc");
+            test.verifyError(fcn, "MATLAB:validation:UnableToConvert");
+
+            % ValidtionMode must be scalar
+            modes = [arrow.array.ValidationMode.Full 
arrow.array.ValidationMode.Minimal];
+            fcn = @() array.validate(ValidationMode=modes);
+            test.verifyError(fcn, "MATLAB:validation:IncompatibleSize");
+
+            % ValidationMode.None is not supported
+            mode = arrow.array.ValidationMode.None;
+            fcn = @() array.validate(ValidationMode=mode);
+            test.verifyError(fcn, "arrow:array:InvalidValidationMode");
+        end
+
+        function ValidationModeMinimalFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateMinimalFailed if
+            % ValidationMode="Minimal" and the array fails the "Minimal"
+            % validation checks.
+            offsets = arrow.array(int32([0 1 3 4 5]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Minimal");
+            test.verifyError(fcn, "arrow:array:ValidateMinimalFailed")
+        end
+
+        function ValidationModeMinimalPasses(test)
+            % Verify arrow.array.Array/validate() does not throw an
+            % exception if ValidationMode="Minimal" the array passes the
+            % "Miminal" validtion checks.
+            offsets = arrow.array(int32([0 1 0]));
+            values = arrow.array([1 2 3]);
+            % NOTE: the array is actually invalid, but it passes the
+            % "Minimal" validation checks.
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Minimal");
+            test.verifyWarningFree(fcn, "arrow:array:ValidateMinimalFailed")
+        end
+
+        function ValidationModeFullFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateFullFailed if

Review Comment:
   ```suggestion
               % with the ID arrow:array:ValidateFullFailed if
   ```



##########
matlab/test/arrow/array/tValidateArray.m:
##########
@@ -0,0 +1,102 @@
+%TVALIDATEARRAY Test class for the arrow.array.Array/validate() method.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tValidateArray < matlab.unittest.TestCase
+
+    methods (Test)
+
+        function InvalidValidationModeInput(test)
+            % Verify arrow.array.Array/validate() throws an exception if
+            % provided an invalid value for the ValidationMode name-value 
+            % pair.
+            array = arrow.array.Float64Array.fromMATLAB(1:5);
+
+            % Cannot convert "abc" to a ValidtionMode value
+            fcn = @() array.validate(ValidationMode="abc");
+            test.verifyError(fcn, "MATLAB:validation:UnableToConvert");
+
+            % ValidtionMode must be scalar
+            modes = [arrow.array.ValidationMode.Full 
arrow.array.ValidationMode.Minimal];
+            fcn = @() array.validate(ValidationMode=modes);
+            test.verifyError(fcn, "MATLAB:validation:IncompatibleSize");
+
+            % ValidationMode.None is not supported
+            mode = arrow.array.ValidationMode.None;
+            fcn = @() array.validate(ValidationMode=mode);
+            test.verifyError(fcn, "arrow:array:InvalidValidationMode");
+        end
+
+        function ValidationModeMinimalFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateMinimalFailed if

Review Comment:
   ```suggestion
               % with the ID arrow:array:ValidateMinimalFailed if
   ```



##########
matlab/test/arrow/array/tValidateArray.m:
##########
@@ -0,0 +1,102 @@
+%TVALIDATEARRAY Test class for the arrow.array.Array/validate() method.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tValidateArray < matlab.unittest.TestCase
+
+    methods (Test)
+
+        function InvalidValidationModeInput(test)
+            % Verify arrow.array.Array/validate() throws an exception if
+            % provided an invalid value for the ValidationMode name-value 
+            % pair.
+            array = arrow.array.Float64Array.fromMATLAB(1:5);
+
+            % Cannot convert "abc" to a ValidtionMode value
+            fcn = @() array.validate(ValidationMode="abc");
+            test.verifyError(fcn, "MATLAB:validation:UnableToConvert");
+
+            % ValidtionMode must be scalar
+            modes = [arrow.array.ValidationMode.Full 
arrow.array.ValidationMode.Minimal];
+            fcn = @() array.validate(ValidationMode=modes);
+            test.verifyError(fcn, "MATLAB:validation:IncompatibleSize");
+
+            % ValidationMode.None is not supported
+            mode = arrow.array.ValidationMode.None;
+            fcn = @() array.validate(ValidationMode=mode);
+            test.verifyError(fcn, "arrow:array:InvalidValidationMode");
+        end
+
+        function ValidationModeMinimalFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateMinimalFailed if
+            % ValidationMode="Minimal" and the array fails the "Minimal"
+            % validation checks.
+            offsets = arrow.array(int32([0 1 3 4 5]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Minimal");
+            test.verifyError(fcn, "arrow:array:ValidateMinimalFailed")
+        end
+
+        function ValidationModeMinimalPasses(test)
+            % Verify arrow.array.Array/validate() does not throw an
+            % exception if ValidationMode="Minimal" the array passes the
+            % "Miminal" validtion checks.

Review Comment:
   ```suggestion
               % "Minimal" validation checks.
   ```



##########
matlab/test/arrow/array/tValidateArray.m:
##########
@@ -0,0 +1,102 @@
+%TVALIDATEARRAY Test class for the arrow.array.Array/validate() method.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tValidateArray < matlab.unittest.TestCase
+
+    methods (Test)
+
+        function InvalidValidationModeInput(test)
+            % Verify arrow.array.Array/validate() throws an exception if
+            % provided an invalid value for the ValidationMode name-value 
+            % pair.
+            array = arrow.array.Float64Array.fromMATLAB(1:5);
+
+            % Cannot convert "abc" to a ValidtionMode value
+            fcn = @() array.validate(ValidationMode="abc");
+            test.verifyError(fcn, "MATLAB:validation:UnableToConvert");
+
+            % ValidtionMode must be scalar

Review Comment:
   ```suggestion
               % ValidationMode must be scalar
   ```



##########
matlab/test/arrow/array/tValidateArray.m:
##########
@@ -0,0 +1,102 @@
+%TVALIDATEARRAY Test class for the arrow.array.Array/validate() method.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tValidateArray < matlab.unittest.TestCase
+
+    methods (Test)
+
+        function InvalidValidationModeInput(test)
+            % Verify arrow.array.Array/validate() throws an exception if
+            % provided an invalid value for the ValidationMode name-value 
+            % pair.
+            array = arrow.array.Float64Array.fromMATLAB(1:5);
+
+            % Cannot convert "abc" to a ValidtionMode value
+            fcn = @() array.validate(ValidationMode="abc");
+            test.verifyError(fcn, "MATLAB:validation:UnableToConvert");
+
+            % ValidtionMode must be scalar
+            modes = [arrow.array.ValidationMode.Full 
arrow.array.ValidationMode.Minimal];
+            fcn = @() array.validate(ValidationMode=modes);
+            test.verifyError(fcn, "MATLAB:validation:IncompatibleSize");
+
+            % ValidationMode.None is not supported
+            mode = arrow.array.ValidationMode.None;
+            fcn = @() array.validate(ValidationMode=mode);
+            test.verifyError(fcn, "arrow:array:InvalidValidationMode");
+        end
+
+        function ValidationModeMinimalFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateMinimalFailed if
+            % ValidationMode="Minimal" and the array fails the "Minimal"
+            % validation checks.
+            offsets = arrow.array(int32([0 1 3 4 5]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Minimal");
+            test.verifyError(fcn, "arrow:array:ValidateMinimalFailed")
+        end
+
+        function ValidationModeMinimalPasses(test)
+            % Verify arrow.array.Array/validate() does not throw an
+            % exception if ValidationMode="Minimal" the array passes the
+            % "Miminal" validtion checks.
+            offsets = arrow.array(int32([0 1 0]));
+            values = arrow.array([1 2 3]);
+            % NOTE: the array is actually invalid, but it passes the
+            % "Minimal" validation checks.
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Minimal");
+            test.verifyWarningFree(fcn, "arrow:array:ValidateMinimalFailed")
+        end
+
+        function ValidationModeFullFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateFullFailed if
+            % ValidationMode="Full" and the array fails the "Full"
+            % validation checks.
+            offsets = arrow.array(int32([0 1 0]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Full");
+            test.verifyError(fcn, "arrow:array:ValidateFullFailed")
+        end
+
+        function ValidationModeFullPasses(test)
+            % Verify arrow.array.Array/validate() does not throw an
+            % exception if ValidationMode="Full" and the array passes
+            % the "full" validtion checks.
+            offsets = arrow.array(int32([0 1 3]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Full");
+            test.verifyWarningFree(fcn);
+        end
+
+        function DefaultValidationModeIsMimimal(test)
+            % Verify the default ValidationMode value is "Minimal".
+            offsets = arrow.array(int32([0 1 2 3]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate();
+            test.verifyWarningFree(fcn, "arrow:array:ValidateMinimalFailed")
+

Review Comment:
   ```suggestion
   ```



##########
matlab/test/arrow/array/tValidateArray.m:
##########
@@ -0,0 +1,102 @@
+%TVALIDATEARRAY Test class for the arrow.array.Array/validate() method.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements.  See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License.  You may obtain a copy of the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied.  See the License for the specific language governing
+% permissions and limitations under the License.
+
+classdef tValidateArray < matlab.unittest.TestCase
+
+    methods (Test)
+
+        function InvalidValidationModeInput(test)
+            % Verify arrow.array.Array/validate() throws an exception if
+            % provided an invalid value for the ValidationMode name-value 
+            % pair.
+            array = arrow.array.Float64Array.fromMATLAB(1:5);
+
+            % Cannot convert "abc" to a ValidtionMode value
+            fcn = @() array.validate(ValidationMode="abc");
+            test.verifyError(fcn, "MATLAB:validation:UnableToConvert");
+
+            % ValidtionMode must be scalar
+            modes = [arrow.array.ValidationMode.Full 
arrow.array.ValidationMode.Minimal];
+            fcn = @() array.validate(ValidationMode=modes);
+            test.verifyError(fcn, "MATLAB:validation:IncompatibleSize");
+
+            % ValidationMode.None is not supported
+            mode = arrow.array.ValidationMode.None;
+            fcn = @() array.validate(ValidationMode=mode);
+            test.verifyError(fcn, "arrow:array:InvalidValidationMode");
+        end
+
+        function ValidationModeMinimalFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateMinimalFailed if
+            % ValidationMode="Minimal" and the array fails the "Minimal"
+            % validation checks.
+            offsets = arrow.array(int32([0 1 3 4 5]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Minimal");
+            test.verifyError(fcn, "arrow:array:ValidateMinimalFailed")
+        end
+
+        function ValidationModeMinimalPasses(test)
+            % Verify arrow.array.Array/validate() does not throw an
+            % exception if ValidationMode="Minimal" the array passes the
+            % "Miminal" validtion checks.
+            offsets = arrow.array(int32([0 1 0]));
+            values = arrow.array([1 2 3]);
+            % NOTE: the array is actually invalid, but it passes the
+            % "Minimal" validation checks.
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Minimal");
+            test.verifyWarningFree(fcn, "arrow:array:ValidateMinimalFailed")
+        end
+
+        function ValidationModeFullFails(test)
+            % Verify arrow.array.Array/validate() throws an exception 
+            % with the ID is arrow:array:ValidateFullFailed if
+            % ValidationMode="Full" and the array fails the "Full"
+            % validation checks.
+            offsets = arrow.array(int32([0 1 0]));
+            values = arrow.array([1 2 3]);
+            array = arrow.array.ListArray.fromArrays(offsets, values, 
ValidationMode="None");
+            fcn = @() array.validate(ValidationMode="Full");
+            test.verifyError(fcn, "arrow:array:ValidateFullFailed")
+        end
+
+        function ValidationModeFullPasses(test)
+            % Verify arrow.array.Array/validate() does not throw an
+            % exception if ValidationMode="Full" and the array passes
+            % the "full" validtion checks.

Review Comment:
   ```suggestion
               % the "full" validation checks.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to