You've already forked Zygisk-Assistant
mirror of
https://github.com/snake-4/Zygisk-Assistant.git
synced 2025-09-06 06:37:02 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <array>
|
||||
|
||||
// template <size_t I, class T, size_t N> T& get(array<T, N>& a);
|
||||
|
||||
// Prevent -Warray-bounds from issuing a diagnostic when testing with clang verify.
|
||||
// ADDITIONAL_COMPILE_FLAGS: -Wno-array-bounds
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef double T;
|
||||
typedef std::array<T, 3> C;
|
||||
C c = {1, 2, 3.5};
|
||||
std::get<3>(c) = 5.5; // expected-note {{requested here}}
|
||||
// expected-error-re@array:* {{{{(static_assert|static assertion)}} failed{{( due to requirement '3U[L]{0,2} < 3U[L]{0,2}')?}}{{.*}}Index out of bounds in std::get<> (std::array)}}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <array>
|
||||
|
||||
// template <size_t I, class T, size_t N> T& get(array<T, N>& a);
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
template <typename ...T>
|
||||
TEST_CONSTEXPR std::array<int, sizeof...(T)> tempArray(T ...args)
|
||||
{
|
||||
return {args...};
|
||||
}
|
||||
|
||||
TEST_CONSTEXPR_CXX14 bool tests()
|
||||
{
|
||||
{
|
||||
std::array<double, 1> array = {3.3};
|
||||
assert(std::get<0>(array) == 3.3);
|
||||
std::get<0>(array) = 99.1;
|
||||
assert(std::get<0>(array) == 99.1);
|
||||
}
|
||||
{
|
||||
std::array<double, 2> array = {3.3, 4.4};
|
||||
assert(std::get<0>(array) == 3.3);
|
||||
assert(std::get<1>(array) == 4.4);
|
||||
std::get<0>(array) = 99.1;
|
||||
std::get<1>(array) = 99.2;
|
||||
assert(std::get<0>(array) == 99.1);
|
||||
assert(std::get<1>(array) == 99.2);
|
||||
}
|
||||
{
|
||||
std::array<double, 3> array = {3.3, 4.4, 5.5};
|
||||
assert(std::get<0>(array) == 3.3);
|
||||
assert(std::get<1>(array) == 4.4);
|
||||
assert(std::get<2>(array) == 5.5);
|
||||
std::get<1>(array) = 99.2;
|
||||
assert(std::get<0>(array) == 3.3);
|
||||
assert(std::get<1>(array) == 99.2);
|
||||
assert(std::get<2>(array) == 5.5);
|
||||
}
|
||||
{
|
||||
std::array<double, 1> array = {3.3};
|
||||
static_assert(std::is_same<double&, decltype(std::get<0>(array))>::value, "");
|
||||
}
|
||||
{
|
||||
assert(std::get<0>(tempArray(1, 2, 3)) == 1);
|
||||
assert(std::get<1>(tempArray(1, 2, 3)) == 2);
|
||||
assert(std::get<2>(tempArray(1, 2, 3)) == 3);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
tests();
|
||||
#if TEST_STD_VER >= 14
|
||||
static_assert(tests(), "");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <array>
|
||||
|
||||
// template <size_t I, class T, size_t N> const T& get(const array<T, N>& a);
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
TEST_CONSTEXPR_CXX14 bool tests()
|
||||
{
|
||||
{
|
||||
std::array<double, 1> const array = {3.3};
|
||||
assert(std::get<0>(array) == 3.3);
|
||||
}
|
||||
{
|
||||
std::array<double, 2> const array = {3.3, 4.4};
|
||||
assert(std::get<0>(array) == 3.3);
|
||||
assert(std::get<1>(array) == 4.4);
|
||||
}
|
||||
{
|
||||
std::array<double, 3> const array = {3.3, 4.4, 5.5};
|
||||
assert(std::get<0>(array) == 3.3);
|
||||
assert(std::get<1>(array) == 4.4);
|
||||
assert(std::get<2>(array) == 5.5);
|
||||
}
|
||||
{
|
||||
std::array<double, 1> const array = {3.3};
|
||||
static_assert(std::is_same<double const&, decltype(std::get<0>(array))>::value, "");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
tests();
|
||||
#if TEST_STD_VER >= 14
|
||||
static_assert(tests(), "");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <array>
|
||||
|
||||
// template <size_t I, class T, size_t N> const T&& get(const array<T, N>&& a);
|
||||
|
||||
// UNSUPPORTED: c++03
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
|
||||
{
|
||||
typedef std::unique_ptr<double> T;
|
||||
typedef std::array<T, 1> C;
|
||||
const C c = {std::unique_ptr<double>(new double(3.5))};
|
||||
static_assert(std::is_same<const T&&, decltype(std::get<0>(std::move(c)))>::value, "");
|
||||
static_assert(noexcept(std::get<0>(std::move(c))), "");
|
||||
const T&& t = std::get<0>(std::move(c));
|
||||
assert(*t == 3.5);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER >= 14
|
||||
{
|
||||
typedef double T;
|
||||
typedef std::array<T, 3> C;
|
||||
constexpr const C c = {1, 2, 3.5};
|
||||
static_assert(std::get<0>(std::move(c)) == 1, "");
|
||||
static_assert(std::get<1>(std::move(c)) == 2, "");
|
||||
static_assert(std::get<2>(std::move(c)) == 3.5, "");
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <array>
|
||||
|
||||
// template <size_t I, class T, size_t N> T&& get(array<T, N>&& a);
|
||||
|
||||
// UNSUPPORTED: c++03
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef std::unique_ptr<double> T;
|
||||
typedef std::array<T, 1> C;
|
||||
C c = {std::unique_ptr<double>(new double(3.5))};
|
||||
T t = std::get<0>(std::move(c));
|
||||
assert(*t == 3.5);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <array>
|
||||
|
||||
// tuple_element<I, array<T, N> >::type
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
typedef double T;
|
||||
typedef std::array<T, 3> C;
|
||||
std::tuple_element<3, C> foo; // expected-note {{requested here}}
|
||||
// expected-error-re@array:* {{{{(static_assert|static assertion)}} failed{{( due to requirement '3U[L]{0,2} < 3U[L]{0,2}')?}}{{.*}}Index out of bounds in std::tuple_element<> (std::array)}}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <array>
|
||||
|
||||
// tuple_element<I, array<T, N> >::type
|
||||
|
||||
#include <array>
|
||||
#include <type_traits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
template <class T>
|
||||
void test()
|
||||
{
|
||||
{
|
||||
typedef T Exp;
|
||||
typedef std::array<T, 3> C;
|
||||
static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
|
||||
static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
|
||||
static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
|
||||
}
|
||||
{
|
||||
typedef T const Exp;
|
||||
typedef std::array<T, 3> const C;
|
||||
static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
|
||||
static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
|
||||
static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
|
||||
}
|
||||
{
|
||||
typedef T volatile Exp;
|
||||
typedef std::array<T, 3> volatile C;
|
||||
static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
|
||||
static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
|
||||
static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
|
||||
}
|
||||
{
|
||||
typedef T const volatile Exp;
|
||||
typedef std::array<T, 3> const volatile C;
|
||||
static_assert((std::is_same<typename std::tuple_element<0, C>::type, Exp>::value), "");
|
||||
static_assert((std::is_same<typename std::tuple_element<1, C>::type, Exp>::value), "");
|
||||
static_assert((std::is_same<typename std::tuple_element<2, C>::type, Exp>::value), "");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test<double>();
|
||||
test<int>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <array>
|
||||
|
||||
// tuple_size<array<T, N> >::value
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
template <class T, std::size_t N>
|
||||
void test()
|
||||
{
|
||||
{
|
||||
typedef std::array<T, N> C;
|
||||
static_assert((std::tuple_size<C>::value == N), "");
|
||||
}
|
||||
{
|
||||
typedef std::array<T const, N> C;
|
||||
static_assert((std::tuple_size<C>::value == N), "");
|
||||
}
|
||||
{
|
||||
typedef std::array<T volatile, N> C;
|
||||
static_assert((std::tuple_size<C>::value == N), "");
|
||||
}
|
||||
{
|
||||
typedef std::array<T const volatile, N> C;
|
||||
static_assert((std::tuple_size<C>::value == N), "");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
test<double, 0>();
|
||||
test<double, 3>();
|
||||
test<double, 5>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user