Skip to content

Make NdPluginAttribute compression aware, add unit tests for NDPluginAttribute#583

Open
jwlodek wants to merge 2 commits intoareaDetector:masterfrom
jwlodek:ndpluginattribute-compression-aware
Open

Make NdPluginAttribute compression aware, add unit tests for NDPluginAttribute#583
jwlodek wants to merge 2 commits intoareaDetector:masterfrom
jwlodek:ndpluginattribute-compression-aware

Conversation

@jwlodek
Copy link
Copy Markdown
Member

@jwlodek jwlodek commented Apr 28, 2026

Resolves #582. Was as simple as adding the boolean flag to the end of the superclass constructor call. Also added unit tests for the plugin that test with compressed and uncompressed arrays.

@jwlodek jwlodek requested a review from ericonr April 28, 2026 13:41
/* Test that NDPluginAttribute reads attributes from an uncompressed array */
BOOST_AUTO_TEST_CASE(test_attribute_uncompressed)
{
NDArray *input = createTestArray();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are using in the other tests, missing BOOST_REQUIRE(input != NULL)

processArray(input);

double readVal = attr->readDouble(NDPluginAttributeValString, 0);
BOOST_CHECK_CLOSE(readVal, 42.5, 0.001);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BOOST_CHECK_CLOSE(readVal, 42.5, 0.001);
BOOST_CHECK_CLOSE(readVal, testVal, 0.001);

processArray(input);

double readVal = attr->readDouble(NDPluginAttributeValString, 0);
BOOST_CHECK_CLOSE(readVal, 99.0, 0.001);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BOOST_CHECK_CLOSE(readVal, 99.0, 0.001);
BOOST_CHECK_CLOSE(readVal, testVal, 0.001);

processArray(input);

double readVal = attr->readDouble(NDPluginAttributeValString, 0);
BOOST_CHECK_CLOSE(readVal, 12345.0, 0.001);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not BOOST_CHECK_EQUAL?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CHECK_EQUAL should be OK. I usually use CHECK_CLOSE or the framework equivalent for floats due to precision issues, but since we're not doing any calculations or the like here it should match exactly.

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.

NDPluginAttribute isn't compression aware

2 participants