Skip to content
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

[RFC]: add tests for @stdlib/ndarray/base/nullary #2229

Open
3 tasks done
headlessNode opened this issue May 4, 2024 · 3 comments
Open
3 tasks done

[RFC]: add tests for @stdlib/ndarray/base/nullary #2229

headlessNode opened this issue May 4, 2024 · 3 comments
Labels
Needs Discussion Needs further discussion. RFC Request for comments. Feature requests and proposed changes.

Comments

@headlessNode
Copy link
Contributor

Description

Currently, the @stdlib/ndarray/base/nullary/test/test.js only tests whether the main export is a function.

This RFC proposes to add tests to verify:

  • The first argument provided is an ndarray-like object

  • The input ndarray-like object contains valid data, dtype, shape, stride, offset, and order properties

  • No modification occurs if the data property of the input ndarray-like object is empty

  • The second argument provided is a function

  • The second argument returns a value compatible with the dtype of the output ndarray

  • The nullary function returns void

Related Issues

No.

Questions

No.

Other

No.

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
@stdlib-bot
Copy link
Contributor

👋 Hi there! 👋

And thank you for opening your first issue! We will get back to you shortly. 🏃 💨

@headlessNode
Copy link
Contributor Author

@kgryte @Planeshifter @Pranavchiku I'd like to work on this issue.

@kgryte
Copy link
Member

kgryte commented May 24, 2024

@headlessNode Thanks for opening this issue. Tests would be good to add for @stdlib/ndarray/base/nullary, so this contribution would be welcome.

I would suggest, however, consulting @stdlib/strided/base/nullary to see how tests are done there, as @stdlib/ndarray/base/nullary is the ndarray analog to that package.

Of note, several of the verifications you mention are not necessary, such as verifying that an ndarray-like object is provided, that a function is provided, that the ndarray-like object has specified properties, etc. @stdlib/ndarray/base/nullary is a "base" package, and we assume that a user knows what they are doing and has provided valid arguments, as can be observed from the implementation of @stdlib/ndarray/base/nullary.

Instead, tests should verify iteration behavior for 0-11D ndarrays, including contiguous and non-contiguous views, etc. Additionally, tests should verify iteration behavior for ndarrays backed by accessor arrays (e.g., ndarrays have a complex-valued data type, such as complex64 or complex128).

Doing all this will be required in order to achieve 100% test coverage for this package, given its implementation: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/nullary/lib

@kgryte kgryte added RFC Request for comments. Feature requests and proposed changes. Needs Discussion Needs further discussion. labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion Needs further discussion. RFC Request for comments. Feature requests and proposed changes.
Projects
None yet
Development

No branches or pull requests

3 participants