Adapt and integrate string_view tests
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 9 Apr 2018 17:31:06 +0000 (13:31 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Mon, 9 Apr 2018 18:20:47 +0000 (14:20 -0400)
commitc9638d2669ced9348eac869dadc7be24df85a9a8
tree2020518c320679400ad58e2e03d5585c0ffe1dcd
parentfdc116781b03f5d30e93f5013159f39c4c0f3471
Adapt and integrate string_view tests

The previous patch copied the string_view tests from libstdc++.  This
patch adjusts them in a similar way that the libstdc++ optional tests
are integrated in our unit test suite.

Not all tests are used, some of them require language features not
present in c++11.  For example, we can't use a string_view constructor
where the length is not explicit in a constexpr, because
std::char_traits::length is not a constexpr itself (it is in c++17
though).  Nevertheless, a good number of tests are integrated, which
covers pretty well the string_view features.

gdb/ChangeLog:

* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
string_view-selftests.c.
* unittests/basic_string_view/capacity/1.cc: Adapt to GDB
testsuite.
* unittests/basic_string_view/cons/char/1.cc: Likewise.
* unittests/basic_string_view/cons/char/2.cc: Likewise.
* unittests/basic_string_view/cons/char/3.cc: Likewise.
* unittests/basic_string_view/element_access/char/1.cc:
Likewise.
* unittests/basic_string_view/element_access/char/empty.cc:
Likewise.
* unittests/basic_string_view/element_access/char/front_back.cc:
Likewise.
* unittests/basic_string_view/inserters/char/2.cc: Likewise.
* unittests/basic_string_view/modifiers/remove_prefix/char/1.cc:
Likewise.
* unittests/basic_string_view/modifiers/remove_suffix/char/1.cc:
Likewise.
* unittests/basic_string_view/modifiers/swap/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/compare/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/compare/char/13650.cc:
Likewise.
* unittests/basic_string_view/operations/copy/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/data/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/2.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/3.cc:
Likewise.
* unittests/basic_string_view/operations/find/char/4.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/1.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/2.cc:
Likewise.
* unittests/basic_string_view/operations/rfind/char/3.cc:
Likewise.
* unittests/basic_string_view/operations/substr/char/1.cc:
Likewise.
* unittests/basic_string_view/operators/char/2.cc: Likewise.
* unittests/string_view-selftests.c: New file.
27 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/unittests/basic_string_view/capacity/1.cc
gdb/unittests/basic_string_view/cons/char/1.cc
gdb/unittests/basic_string_view/cons/char/2.cc
gdb/unittests/basic_string_view/cons/char/3.cc
gdb/unittests/basic_string_view/element_access/char/1.cc
gdb/unittests/basic_string_view/element_access/char/empty.cc
gdb/unittests/basic_string_view/element_access/char/front_back.cc
gdb/unittests/basic_string_view/inserters/char/2.cc
gdb/unittests/basic_string_view/modifiers/remove_prefix/char/1.cc
gdb/unittests/basic_string_view/modifiers/remove_suffix/char/1.cc
gdb/unittests/basic_string_view/modifiers/swap/char/1.cc
gdb/unittests/basic_string_view/operations/compare/char/1.cc
gdb/unittests/basic_string_view/operations/compare/char/13650.cc
gdb/unittests/basic_string_view/operations/copy/char/1.cc
gdb/unittests/basic_string_view/operations/data/char/1.cc
gdb/unittests/basic_string_view/operations/find/char/1.cc
gdb/unittests/basic_string_view/operations/find/char/2.cc
gdb/unittests/basic_string_view/operations/find/char/3.cc
gdb/unittests/basic_string_view/operations/find/char/4.cc
gdb/unittests/basic_string_view/operations/rfind/char/1.cc
gdb/unittests/basic_string_view/operations/rfind/char/2.cc
gdb/unittests/basic_string_view/operations/rfind/char/3.cc
gdb/unittests/basic_string_view/operations/substr/char/1.cc
gdb/unittests/basic_string_view/operators/char/2.cc
gdb/unittests/string_view-selftests.c [new file with mode: 0644]