New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MATLAB] Create shared test class utility for numeric arrays. #35537
Comments
take |
kou
added a commit
that referenced
this issue
May 16, 2023
…` for converting to MATLAB types (#35551) ### Rationale for this change In order to allow clients to write generic code for different concrete `arrow.array.Array` subclasses in MATLAB, it would be helpful to have one generic `toMATLAB` method. `toMATLAB` would convert the `arrow.array.Array` into a corresponding MATLAB type. For example, `arrow.array.Float64Array` would be converted to a MATLAB `double` array. ```matlab >> doubleMatlabArray = toMATLAB(float64ArrowArray) % Convert the arrow.array.Float64Array to a MATLAB double array ``` ### What changes are included in this PR? 1. Added a public `toMATLAB` method to the `arrow.array.Array` superclass. Example of using `toMATLAB` on an `arrow.array.Float64Array`: ```matlab >> arrowArray = arrow.array.Float64Array(1:10) arrowArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] >> matlabArray = toMATLAB(arrowArray) matlabArray = 1 2 3 4 5 6 7 8 9 10 >> class(matlabArray) ans = 'double' ``` ### Are these changes tested? 1. Yes, we added tests for `toMATLAB` to `tFloat32Array.m` and `tFloat64Array.m`. 2. This was qualified on a Debian 11 machine. ### Future Directions 1. Move the `toMATLAB` tests to the shared test utility class (i.e. #35537). ### Notes 1. Thanks to @ sgilmore10 for her help with this pull request! * Closes: #35550 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
kou
added a commit
that referenced
this issue
May 19, 2023
#35556) ### Rationale for this change To avoid writing duplicate tests, we created an an Abstract Test Class called `hNumericArray` which defines tests that can be shared by all numeric array types. Concrete test classes can inherit from this class to automatically get the shared test points. ### What changes are included in this PR? 1. Defined new abstract test class `hNumericArray` 2. Modified `tFloat32Array` to inherit from `hNumericArray` 3. Modified `tFloat64Array` to inherit from `hNumericArray` ### Are these changes tested? 1. Qualified the tests still pass on macOS. ### Are there any user-facing changes? There are no user-facing changes in this PR. This PR only has test-related changes. * Closes: #35537 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the enhancement requested
Many of the unit tests we'll write for numeric arrays will be identical. We should write a shared test class utility called
hNumericArray.m
that our test classes for numeric arrays - e.g.tFloat64Arrray.m
- can inherit from.Component(s)
MATLAB
The text was updated successfully, but these errors were encountered: