]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/unittests/basic_string_view/operations/find/char/1.cc
Adapt and integrate string_view tests
[thirdparty/binutils-gdb.git] / gdb / unittests / basic_string_view / operations / find / char / 1.cc
index d7d2f37706eb3e35401a32c9a5f6f21be40dd633..a68434a22a9d693b9016089a1b6f87cdcd5b0b66 100644 (file)
 
 // basic_string_view find
 
-#include <string_view>
-#include <testsuite_hooks.h>
+namespace operations_find_1 {
 
 void
 test01()
 {
-  typedef std::string_view::size_type csize_type;
-  typedef std::string_view::const_reference cref;
-  typedef std::string_view::reference ref;
-  csize_type npos = std::string_view::npos;
+  typedef gdb::string_view::size_type csize_type;
+  typedef gdb::string_view::const_reference cref;
+  typedef gdb::string_view::reference ref;
+  csize_type npos = gdb::string_view::npos;
   csize_type csz01, csz02;
 
   const char str_lit01[] = "mave";
-  const std::string_view str01("mavericks, santa cruz");
-  std::string_view str02(str_lit01);
-  std::string_view str03("s, s");
-  std::string_view str04;
+  const gdb::string_view str01("mavericks, santa cruz");
+  gdb::string_view str02(str_lit01);
+  gdb::string_view str03("s, s");
+  gdb::string_view str04;
 
   // size_type find(const string_view&, size_type pos = 0) const;
   csz01 = str01.find(str01);
@@ -85,6 +84,7 @@ test01()
   VERIFY( csz01 == npos );
 }
 
+#ifndef GDB_STRING_VIEW
 constexpr bool
 test02()
 {
@@ -152,13 +152,17 @@ test02()
 
   return true;
 }
-
+#endif
 
 int
 main()
 {
   test01();
+#ifndef GDB_STRING_VIEW
   static_assert( test02() );
+#endif
 
   return 0;
 }
+
+} // namespace operations_find_1