Initial commit

This commit is contained in:
Yervant7
2024-01-16 19:28:29 -03:00
commit 8c0524dc0f
9054 changed files with 1081727 additions and 0 deletions
@@ -0,0 +1,45 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// <string_view>
// constexpr bool contains(charT x) const noexcept;
#include <string_view>
#include <cassert>
#include "test_macros.h"
constexpr bool test()
{
using SV = std::string_view;
SV sv1 {};
SV sv2 {"abcde", 5};
ASSERT_NOEXCEPT(sv1.contains('e'));
assert(!sv1.contains('c'));
assert(!sv1.contains('e'));
assert(!sv1.contains('x'));
assert( sv2.contains('c'));
assert( sv2.contains('e'));
assert(!sv2.contains('x'));
return true;
}
int main(int, char**)
{
test();
static_assert(test());
return 0;
}
@@ -0,0 +1,75 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// <string_view>
// constexpr bool contains(const CharT *x) const;
#include <string_view>
#include <cassert>
#include "test_macros.h"
constexpr bool test()
{
using SV = std::string_view;
const char* s = "abcde";
SV sv0;
SV sv1 {s + 4, 1};
SV sv3 {s + 2, 3};
SV svNot {"xyz", 3};
assert( sv0.contains(""));
assert(!sv0.contains("e"));
assert( sv1.contains(""));
assert(!sv1.contains("d"));
assert( sv1.contains("e"));
assert(!sv1.contains("de"));
assert(!sv1.contains("cd"));
assert(!sv1.contains("cde"));
assert(!sv1.contains("bcde"));
assert(!sv1.contains("abcde"));
assert(!sv1.contains("xyz"));
assert( sv3.contains(""));
assert( sv3.contains("d"));
assert( sv3.contains("e"));
assert( sv3.contains("de"));
assert( sv3.contains("cd"));
assert(!sv3.contains("ce"));
assert( sv3.contains("cde"));
assert(!sv3.contains("edc"));
assert(!sv3.contains("bcde"));
assert(!sv3.contains("abcde"));
assert(!sv3.contains("xyz"));
assert( svNot.contains(""));
assert(!svNot.contains("d"));
assert(!svNot.contains("e"));
assert(!svNot.contains("de"));
assert(!svNot.contains("cd"));
assert(!svNot.contains("cde"));
assert(!svNot.contains("bcde"));
assert(!svNot.contains("abcde"));
assert( svNot.contains("xyz"));
assert(!svNot.contains("zyx"));
return true;
}
int main(int, char**)
{
test();
static_assert(test());
return 0;
}
@@ -0,0 +1,89 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// <string_view>
// constexpr bool contains(string_view x) const noexcept;
#include <string_view>
#include <cassert>
#include "test_macros.h"
constexpr bool test()
{
using SV = std::string_view;
const char* s = "abcde";
SV sv0;
SV sv1 {s + 1, 1};
SV sv2 {s + 1, 2};
SV sv3 {s + 1, 3};
SV sv4 {s + 1, 4};
SV sv5 {s , 5};
SV svNot {"xyz", 3};
SV svNot2 {"bd" , 2};
SV svNot3 {"dcb", 3};
ASSERT_NOEXCEPT(sv0.contains(sv0));
assert( sv0.contains(sv0));
assert(!sv0.contains(sv1));
assert( sv1.contains(sv0));
assert( sv1.contains(sv1));
assert(!sv1.contains(sv2));
assert(!sv1.contains(sv3));
assert(!sv1.contains(sv4));
assert(!sv1.contains(sv5));
assert(!sv1.contains(svNot));
assert(!sv1.contains(svNot2));
assert(!sv1.contains(svNot3));
assert( sv3.contains(sv0));
assert( sv3.contains(sv1));
assert( sv3.contains(sv2));
assert( sv3.contains(sv3));
assert(!sv3.contains(sv4));
assert(!sv3.contains(sv5));
assert(!sv3.contains(svNot));
assert(!sv3.contains(svNot2));
assert(!sv3.contains(svNot3));
assert( sv5.contains(sv0));
assert( sv5.contains(sv1));
assert( sv5.contains(sv2));
assert( sv5.contains(sv3));
assert( sv5.contains(sv4));
assert( sv5.contains(sv5));
assert(!sv5.contains(svNot));
assert(!sv5.contains(svNot2));
assert(!sv5.contains(svNot3));
assert( svNot.contains(sv0));
assert(!svNot.contains(sv1));
assert(!svNot.contains(sv2));
assert(!svNot.contains(sv3));
assert(!svNot.contains(sv4));
assert(!svNot.contains(sv5));
assert( svNot.contains(svNot));
assert(!svNot.contains(svNot2));
assert(!svNot.contains(svNot3));
return true;
}
int main(int, char**)
{
test();
static_assert(test());
return 0;
}
@@ -0,0 +1,49 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// <string_view>
// constexpr bool ends_with(charT x) const noexcept;
#include <string_view>
#include <cassert>
#include "test_macros.h"
#include "constexpr_char_traits.h"
int main(int, char**)
{
{
typedef std::string_view SV;
SV sv1 {};
SV sv2 { "abcde", 5 };
ASSERT_NOEXCEPT(sv1.ends_with('e'));
assert (!sv1.ends_with('e'));
assert (!sv1.ends_with('x'));
assert ( sv2.ends_with('e'));
assert (!sv2.ends_with('x'));
}
#if TEST_STD_VER > 11
{
typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1 {};
constexpr SV sv2 { "abcde", 5 };
static_assert (!sv1.ends_with('e'), "" );
static_assert (!sv1.ends_with('x'), "" );
static_assert ( sv2.ends_with('e'), "" );
static_assert (!sv2.ends_with('x'), "" );
}
#endif
return 0;
}
@@ -0,0 +1,100 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// <string_view>
// constexpr bool ends_with(const CharT *x) const;
#include <string_view>
#include <cassert>
#include "test_macros.h"
#include "constexpr_char_traits.h"
int main(int, char**)
{
{
typedef std::string_view SV;
const char *s = "abcde";
SV sv0 {};
SV sv1 { s + 4, 1 };
SV sv2 { s + 3, 2 };
SV svNot {"def", 3 };
LIBCPP_ASSERT_NOEXCEPT(sv0.ends_with(""));
assert ( sv0.ends_with(""));
assert (!sv0.ends_with("e"));
assert ( sv1.ends_with(""));
assert ( sv1.ends_with("e"));
assert (!sv1.ends_with("de"));
assert (!sv1.ends_with("cde"));
assert (!sv1.ends_with("bcde"));
assert (!sv1.ends_with("abcde"));
assert (!sv1.ends_with("def"));
assert ( sv2.ends_with(""));
assert ( sv2.ends_with("e"));
assert ( sv2.ends_with("de"));
assert (!sv2.ends_with("cde"));
assert (!sv2.ends_with("bcde"));
assert (!sv2.ends_with("abcde"));
assert (!sv2.ends_with("def"));
assert ( svNot.ends_with(""));
assert (!svNot.ends_with("e"));
assert (!svNot.ends_with("de"));
assert (!svNot.ends_with("cde"));
assert (!svNot.ends_with("bcde"));
assert (!svNot.ends_with("abcde"));
assert ( svNot.ends_with("def"));
}
#if TEST_STD_VER > 11
{
typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr const char *s = "abcde";
constexpr SV sv0 {};
constexpr SV sv1 { s + 4, 1 };
constexpr SV sv2 { s + 3, 2 };
constexpr SV svNot {"def", 3 };
static_assert ( sv0.ends_with(""), "" );
static_assert (!sv0.ends_with("e"), "" );
static_assert ( sv1.ends_with(""), "" );
static_assert ( sv1.ends_with("e"), "" );
static_assert (!sv1.ends_with("de"), "" );
static_assert (!sv1.ends_with("cde"), "" );
static_assert (!sv1.ends_with("bcde"), "" );
static_assert (!sv1.ends_with("abcde"), "" );
static_assert (!sv1.ends_with("def"), "" );
static_assert ( sv2.ends_with(""), "" );
static_assert ( sv2.ends_with("e"), "" );
static_assert ( sv2.ends_with("de"), "" );
static_assert (!sv2.ends_with("cde"), "" );
static_assert (!sv2.ends_with("bcde"), "" );
static_assert (!sv2.ends_with("abcde"), "" );
static_assert (!sv2.ends_with("def"), "" );
static_assert ( svNot.ends_with(""), "" );
static_assert (!svNot.ends_with("e"), "" );
static_assert (!svNot.ends_with("de"), "" );
static_assert (!svNot.ends_with("cde"), "" );
static_assert (!svNot.ends_with("bcde"), "" );
static_assert (!svNot.ends_with("abcde"), "" );
static_assert ( svNot.ends_with("def"), "" );
}
#endif
return 0;
}
@@ -0,0 +1,106 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// <string_view>
// constexpr bool ends_with(string_view x) const noexcept;
#include <string_view>
#include <cassert>
#include "test_macros.h"
#include "constexpr_char_traits.h"
int main(int, char**)
{
{
typedef std::string_view SV;
const char *s = "abcde";
SV sv0;
SV sv1 { s + 4, 1 };
SV sv2 { s + 3, 2 };
SV sv3 { s + 2, 3 };
SV sv4 { s + 1, 4 };
SV sv5 { s , 5 };
SV svNot {"def", 3 };
ASSERT_NOEXCEPT(sv0.ends_with(sv0));
assert ( sv0.ends_with(sv0));
assert (!sv0.ends_with(sv1));
assert ( sv1.ends_with(sv0));
assert ( sv1.ends_with(sv1));
assert (!sv1.ends_with(sv2));
assert (!sv1.ends_with(sv3));
assert (!sv1.ends_with(sv4));
assert (!sv1.ends_with(sv5));
assert (!sv1.ends_with(svNot));
assert ( sv2.ends_with(sv0));
assert ( sv2.ends_with(sv1));
assert ( sv2.ends_with(sv2));
assert (!sv2.ends_with(sv3));
assert (!sv2.ends_with(sv4));
assert (!sv2.ends_with(sv5));
assert (!sv2.ends_with(svNot));
assert ( svNot.ends_with(sv0));
assert (!svNot.ends_with(sv1));
assert (!svNot.ends_with(sv2));
assert (!svNot.ends_with(sv3));
assert (!svNot.ends_with(sv4));
assert (!svNot.ends_with(sv5));
assert ( svNot.ends_with(svNot));
}
#if TEST_STD_VER > 11
{
typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr const char *s = "abcde";
constexpr SV sv0 {};
constexpr SV sv1 { s + 4, 1 };
constexpr SV sv2 { s + 3, 2 };
constexpr SV sv3 { s + 2, 3 };
constexpr SV sv4 { s + 1, 4 };
constexpr SV sv5 { s, 5 };
constexpr SV svNot {"def", 3 };
static_assert ( sv0.ends_with(sv0), "" );
static_assert (!sv0.ends_with(sv1), "" );
static_assert ( sv1.ends_with(sv0), "" );
static_assert ( sv1.ends_with(sv1), "" );
static_assert (!sv1.ends_with(sv2), "" );
static_assert (!sv1.ends_with(sv3), "" );
static_assert (!sv1.ends_with(sv4), "" );
static_assert (!sv1.ends_with(sv5), "" );
static_assert (!sv1.ends_with(svNot), "" );
static_assert ( sv2.ends_with(sv0), "" );
static_assert ( sv2.ends_with(sv1), "" );
static_assert ( sv2.ends_with(sv2), "" );
static_assert (!sv2.ends_with(sv3), "" );
static_assert (!sv2.ends_with(sv4), "" );
static_assert (!sv2.ends_with(sv5), "" );
static_assert (!sv2.ends_with(svNot), "" );
static_assert ( svNot.ends_with(sv0), "" );
static_assert (!svNot.ends_with(sv1), "" );
static_assert (!svNot.ends_with(sv2), "" );
static_assert (!svNot.ends_with(sv3), "" );
static_assert (!svNot.ends_with(sv4), "" );
static_assert (!svNot.ends_with(sv5), "" );
static_assert ( svNot.ends_with(svNot), "" );
}
#endif
return 0;
}
@@ -0,0 +1,49 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// <string_view>
// constexpr bool starts_with(charT x) const noexcept;
#include <string_view>
#include <cassert>
#include "test_macros.h"
#include "constexpr_char_traits.h"
int main(int, char**)
{
{
typedef std::string_view SV;
SV sv1 {};
SV sv2 { "abcde", 5 };
ASSERT_NOEXCEPT(sv1.starts_with('e'));
assert (!sv1.starts_with('a'));
assert (!sv1.starts_with('x'));
assert ( sv2.starts_with('a'));
assert (!sv2.starts_with('x'));
}
#if TEST_STD_VER > 11
{
typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1 {};
constexpr SV sv2 { "abcde", 5 };
static_assert (!sv1.starts_with('a'), "" );
static_assert (!sv1.starts_with('x'), "" );
static_assert ( sv2.starts_with('a'), "" );
static_assert (!sv2.starts_with('x'), "" );
}
#endif
return 0;
}
@@ -0,0 +1,100 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// <string_view>
// constexpr bool starts_with(string_view x) const noexcept;
#include <string_view>
#include <cassert>
#include "test_macros.h"
#include "constexpr_char_traits.h"
int main(int, char**)
{
{
typedef std::string_view SV;
const char *s = "abcde";
SV sv0 {};
SV sv1 { s, 1 };
SV sv2 { s, 2 };
SV svNot {"def", 3 };
LIBCPP_ASSERT_NOEXCEPT(sv0.starts_with(""));
assert ( sv0.starts_with(""));
assert (!sv0.starts_with("a"));
assert ( sv1.starts_with(""));
assert ( sv1.starts_with("a"));
assert (!sv1.starts_with("ab"));
assert (!sv1.starts_with("abc"));
assert (!sv1.starts_with("abcd"));
assert (!sv1.starts_with("abcde"));
assert (!sv1.starts_with("def"));
assert ( sv2.starts_with(s + 5));
assert ( sv2.starts_with("a"));
assert ( sv2.starts_with("ab"));
assert (!sv2.starts_with("abc"));
assert (!sv2.starts_with("abcd"));
assert (!sv2.starts_with("abcde"));
assert (!sv2.starts_with("def"));
assert ( svNot.starts_with(""));
assert (!svNot.starts_with("a"));
assert (!svNot.starts_with("ab"));
assert (!svNot.starts_with("abc"));
assert (!svNot.starts_with("abcd"));
assert (!svNot.starts_with("abcde"));
assert ( svNot.starts_with("def"));
}
#if TEST_STD_VER > 11
{
typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr const char *s = "abcde";
constexpr SV sv0 {};
constexpr SV sv1 { s, 1 };
constexpr SV sv2 { s, 2 };
constexpr SV svNot {"def", 3 };
static_assert ( sv0.starts_with(""), "" );
static_assert (!sv0.starts_with("a"), "" );
static_assert ( sv1.starts_with(""), "" );
static_assert ( sv1.starts_with("a"), "" );
static_assert (!sv1.starts_with("ab"), "" );
static_assert (!sv1.starts_with("abc"), "" );
static_assert (!sv1.starts_with("abcd"), "" );
static_assert (!sv1.starts_with("abcde"), "" );
static_assert (!sv1.starts_with("def"), "" );
static_assert ( sv2.starts_with(s + 5), "" );
static_assert ( sv2.starts_with("a"), "" );
static_assert ( sv2.starts_with("ab"), "" );
static_assert (!sv2.starts_with("abc"), "" );
static_assert (!sv2.starts_with("abcd"), "" );
static_assert (!sv2.starts_with("abcde"), "" );
static_assert (!sv2.starts_with("def"), "" );
static_assert ( svNot.starts_with(""), "" );
static_assert (!svNot.starts_with("a"), "" );
static_assert (!svNot.starts_with("ab"), "" );
static_assert (!svNot.starts_with("abc"), "" );
static_assert (!svNot.starts_with("abcd"), "" );
static_assert (!svNot.starts_with("abcde"), "" );
static_assert ( svNot.starts_with("def"), "" );
}
#endif
return 0;
}
@@ -0,0 +1,106 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// <string_view>
// constexpr bool starts_with(string_view x) const noexcept;
#include <string_view>
#include <cassert>
#include "test_macros.h"
#include "constexpr_char_traits.h"
int main(int, char**)
{
{
typedef std::string_view SV;
const char *s = "abcde";
SV sv0 {};
SV sv1 { s, 1 };
SV sv2 { s, 2 };
SV sv3 { s, 3 };
SV sv4 { s, 4 };
SV sv5 { s, 5 };
SV svNot {"def", 3 };
ASSERT_NOEXCEPT(sv0.starts_with(sv0));
assert ( sv0.starts_with(sv0));
assert (!sv0.starts_with(sv1));
assert ( sv1.starts_with(sv0));
assert ( sv1.starts_with(sv1));
assert (!sv1.starts_with(sv2));
assert (!sv1.starts_with(sv3));
assert (!sv1.starts_with(sv4));
assert (!sv1.starts_with(sv5));
assert (!sv1.starts_with(svNot));
assert ( sv2.starts_with(sv0));
assert ( sv2.starts_with(sv1));
assert ( sv2.starts_with(sv2));
assert (!sv2.starts_with(sv3));
assert (!sv2.starts_with(sv4));
assert (!sv2.starts_with(sv5));
assert (!sv2.starts_with(svNot));
assert ( svNot.starts_with(sv0));
assert (!svNot.starts_with(sv1));
assert (!svNot.starts_with(sv2));
assert (!svNot.starts_with(sv3));
assert (!svNot.starts_with(sv4));
assert (!svNot.starts_with(sv5));
assert ( svNot.starts_with(svNot));
}
#if TEST_STD_VER > 11
{
typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr const char *s = "abcde";
constexpr SV sv0 {};
constexpr SV sv1 { s, 1 };
constexpr SV sv2 { s, 2 };
constexpr SV sv3 { s, 3 };
constexpr SV sv4 { s, 4 };
constexpr SV sv5 { s, 5 };
constexpr SV svNot {"def", 3 };
static_assert ( sv0.starts_with(sv0), "" );
static_assert (!sv0.starts_with(sv1), "" );
static_assert ( sv1.starts_with(sv0), "" );
static_assert ( sv1.starts_with(sv1), "" );
static_assert (!sv1.starts_with(sv2), "" );
static_assert (!sv1.starts_with(sv3), "" );
static_assert (!sv1.starts_with(sv4), "" );
static_assert (!sv1.starts_with(sv5), "" );
static_assert (!sv1.starts_with(svNot), "" );
static_assert ( sv2.starts_with(sv0), "" );
static_assert ( sv2.starts_with(sv1), "" );
static_assert ( sv2.starts_with(sv2), "" );
static_assert (!sv2.starts_with(sv3), "" );
static_assert (!sv2.starts_with(sv4), "" );
static_assert (!sv2.starts_with(sv5), "" );
static_assert (!sv2.starts_with(svNot), "" );
static_assert ( svNot.starts_with(sv0), "" );
static_assert (!svNot.starts_with(sv1), "" );
static_assert (!svNot.starts_with(sv2), "" );
static_assert (!svNot.starts_with(sv3), "" );
static_assert (!svNot.starts_with(sv4), "" );
static_assert (!svNot.starts_with(sv5), "" );
static_assert ( svNot.starts_with(svNot), "" );
}
#endif
return 0;
}