]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Refactor mdspan tests [PR121061]
authorLuc Grosheintz <luc.grosheintz@gmail.com>
Wed, 16 Jul 2025 13:45:43 +0000 (15:45 +0200)
committerTomasz Kamiński <tkaminsk@redhat.com>
Thu, 17 Jul 2025 14:01:41 +0000 (16:01 +0200)
commitdf7beaccef31f19ee73f034eb98e0e47be008d8e
tree032839b7b16dab9e5d72f0b3141793e046d05391
parentfcf22e1764b3c242cf6b240b71a46403c7f112ae
libstdc++: Refactor mdspan tests [PR121061]

PR121061 shows that the test coverage for custom integer types is
insufficient. Custom IndexTypes are passed to mdspan related objects in
one of two ways:

  * as a template parameter pack,
  * or as an array/span.

These two cases have different requirements on the (constness of) custom
IndexTypes. Therefore, the tests are restructured as follows:

  * allow testing with different custom integers,
  * separate code that tests the two cases described above,
  * use int_like.h for all tests with custom integers.

The affected tests are for:

  * creating extents, layout_stride::mapping and mdspan from
  custom integers,

  * mapping::operator() and mdspan::operator[].

PR libstdc++/121061

libstdc++-v3/ChangeLog:

* testsuite/23_containers/mdspan/extents/custom_integer.cc:
Enable checking with different custom integers. Improve
checking non-existence of overloads for incompatible custom
integers.
* testsuite/23_containers/mdspan/layouts/mapping.cc: ditto. Also
improve reuse of int_like.h.
* testsuite/23_containers/mdspan/layouts/stride.cc: ditto.
* testsuite/23_containers/mdspan/mdspan.cc: ditto.
* testsuite/23_containers/mdspan/extents/int_like.h: Rename (old
name).
* testsuite/23_containers/mdspan/int_like.h: Rename (new name).
(ThrowingInt): Add.
(NotIntLike): Add.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
libstdc++-v3/testsuite/23_containers/mdspan/extents/custom_integer.cc
libstdc++-v3/testsuite/23_containers/mdspan/extents/int_like.h [deleted file]
libstdc++-v3/testsuite/23_containers/mdspan/int_like.h [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/mdspan/layouts/mapping.cc
libstdc++-v3/testsuite/23_containers/mdspan/layouts/stride.cc
libstdc++-v3/testsuite/23_containers/mdspan/mdspan.cc