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

Overhauled tests for structure types containing structure types and pointers to them #296

Merged
merged 2 commits into from
Feb 1, 2022

Conversation

basshelal
Copy link
Contributor

Test suite overhaul for structure types (struct and union) containing structure types and pointers to them.

Added new method overloads for existing methods in Struct.java that are a little easier to use and more idiomatic in addition to the existing methods:

  • Struct.size() can take in just the Struct type's class like Struct.size(MyStruct.class) in addition to also passing in the Runtime if desired like Struct.size(MyStruct.class, Runtime.getSystemRuntime()). This makes it easier to use for quickly checking the size of a struct without needing to explicitly create a new one, though internally a new one is created using reflection.
  • Struct.inner() can take in just the Struct type's class like inner(MyInnerStruct.class). This makes it look similar to StructRef which has the same signature in its constructor and the implementation (reflection construction using the default constructor that takes a Runtime argument) was indeed taken from there.

Detailed JavaDoc comments have been added to both the new methods and the old ones

This modifies and uses changes from #295, merge that one first before this one!

… numeric types.

Removed now redundant tests in StructureTest.java and removed UnionTest.java entirely for this same reason, what remains are tests that will be overhauled in the future

Modified GNUmakefile to build for nested directories.
… structure types and pointers to them.

Added new method overloads for existing methods in Struct.java that are a little easier to use and more idiomatic in addition to the existing methods:
* Struct.size() can take in just the Struct type's class like `Struct.size(MyStruct.class)` in addition to also passing in the Runtime if desired like `Struct.size(MyStruct.class, Runtime.getSystemRuntime())`. This makes it easier to use for quickly checking the size of a struct without needing to explicitly create a new one, though internally a new one is created using reflection.
* Struct.inner() can take in just the Struct type's class like `inner(MyInnerStruct.class)`. This makes it look similar to `StructRef` which has the same signature in its constructor and the implementation (reflection construction using the default constructor that takes a Runtime argument) was indeed taken from there.
Detailed JavaDoc comments have been added to both the new methods and the old ones
@headius
Copy link
Member

headius commented Feb 1, 2022

Wow, this is great... even added documentation!

@headius headius added this to the non-release milestone Feb 1, 2022
@headius headius merged commit 34bdd8a into jnr:master Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants