range-v3 icon indicating copy to clipboard operation
range-v3 copied to clipboard

test/view/cartesian_product.cpp: test_1422() is never called

Open dzzzb opened this issue 4 years ago • 2 comments

https://github.com/ericniebler/range-v3/issues/1422 added test_1422(): https://github.com/ericniebler/range-v3/blob/master/test/view/cartesian_product.cpp#L286

but it is not called anywhere! https://github.com/ericniebler/range-v3/search?q=1422 image

Unless there's some magic going on to automatically find and call this, shouldn't a call be added in main()?

dzzzb avatar Jun 23 '21 16:06 dzzzb

I think the intent is that this is a compile-only test case - note the appearance of CPP_assert (which is a static_assert wrapper) but no CHECKs (runtime asserts) in test_1422. It would be a good idea to annotate such test cases with a comment like // COMPILE-ONLY to avoid confusion.

CaseyCarter avatar Jun 23 '21 16:06 CaseyCarter

Ahh, OK, had I read a bit closer I should've realised that CPP_assert must be compile-time. :-) So it's probably obvious for anyone with an understanding of your tests.

It could be extra nice to add a comment or some kind of annotation/attibute like [[maybe_unused]] or a wrapper thereof. I think had the function been static, most compilers would probably warn about it being unused, hence encouraging the attribute.

However, that's a larger issue/feature, so up to you whether you want to keep this open!

dzzzb avatar Jun 24 '21 08:06 dzzzb