libstdc++: Improve tests for constexpr algorithms
authorJonathan Wakely <jwakely@redhat.com>
Thu, 29 Oct 2020 14:47:18 +0000 (14:47 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 29 Oct 2020 14:47:18 +0000 (14:47 +0000)
commit8c84486bba104399b7e544cb1ba343646d39ea0a
treea5b7591746792a83e332fdd5f397e4692c7b8df1
parent822c1d21a3c710831af65a6e3bc83f558fb39044
libstdc++: Improve tests for constexpr algorithms

These tests just return true without checking that the results of the
algorithms. Although it should be safe to assume that the algorithms
behave the same at compile-time as at run-time, we can use these tests
to verify it.

This replaces each 'return true' statement with a condition that depends
on the basic functionality of the algorithm, such as returning an
iterator to the right position.

libstdc++-v3/ChangeLog:

* testsuite/25_algorithms/all_of/constexpr.cc: Check result of
the algorithm.
* testsuite/25_algorithms/any_of/constexpr.cc: Likewise.
* testsuite/25_algorithms/binary_search/constexpr.cc: Likewise.
* testsuite/25_algorithms/copy_backward/constexpr.cc: Likewise.
* testsuite/25_algorithms/count/constexpr.cc: Likewise.
* testsuite/25_algorithms/equal/constexpr.cc: Likewise.
* testsuite/25_algorithms/equal_range/constexpr.cc: Likewise.
* testsuite/25_algorithms/fill/constexpr.cc: Likewise.
* testsuite/25_algorithms/find_end/constexpr.cc: Likewise.
* testsuite/25_algorithms/find_if/constexpr.cc: Likewise.
* testsuite/25_algorithms/is_partitioned/constexpr.cc: Likewise.
* testsuite/25_algorithms/is_permutation/constexpr.cc: Likewise.
* testsuite/25_algorithms/is_sorted_until/constexpr.cc:
Likewise.
* testsuite/25_algorithms/lexicographical_compare/constexpr.cc:
Likewise.
* testsuite/25_algorithms/lower_bound/constexpr.cc: Likewise.
* testsuite/25_algorithms/merge/constexpr.cc: Likewise.
* testsuite/25_algorithms/mismatch/constexpr.cc: Likewise.
* testsuite/25_algorithms/none_of/constexpr.cc: Likewise.
* testsuite/25_algorithms/partition_copy/constexpr.cc: Likewise.
* testsuite/25_algorithms/remove_copy/constexpr.cc: Likewise.
* testsuite/25_algorithms/remove_copy_if/constexpr.cc: Likewise.
* testsuite/25_algorithms/remove_if/constexpr.cc: Likewise.
* testsuite/25_algorithms/replace_if/constexpr.cc: Likewise.
* testsuite/25_algorithms/reverse/constexpr.cc: Likewise.
* testsuite/25_algorithms/reverse_copy/constexpr.cc: Likewise.
* testsuite/25_algorithms/rotate_copy/constexpr.cc: Likewise.
* testsuite/25_algorithms/search/constexpr.cc: Likewise.
* testsuite/25_algorithms/set_difference/constexpr.cc: Likewise.
* testsuite/25_algorithms/set_intersection/constexpr.cc:
Likewise.
* testsuite/25_algorithms/set_symmetric_difference/constexpr.cc:
Likewise.
* testsuite/25_algorithms/set_union/constexpr.cc: Likewise.
* testsuite/25_algorithms/unique_copy/constexpr.cc: Likewise.
* testsuite/25_algorithms/upper_bound/constexpr.cc: Likewise.
33 files changed:
libstdc++-v3/testsuite/25_algorithms/all_of/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/any_of/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/binary_search/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/copy_backward/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/count/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/equal/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/equal_range/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/fill/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/find_end/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/find_if/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/is_partitioned/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/is_permutation/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/is_sorted_until/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/lexicographical_compare/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/lower_bound/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/merge/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/mismatch/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/none_of/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/partition_copy/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/remove_copy/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/remove_copy_if/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/remove_if/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/replace_if/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/reverse/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/reverse_copy/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/rotate_copy/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/search/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/set_difference/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/set_intersection/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/set_symmetric_difference/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/set_union/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/unique_copy/constexpr.cc
libstdc++-v3/testsuite/25_algorithms/upper_bound/constexpr.cc