1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03, c++11, c++14, c++17
10
11// <valarray>
12
13// class slice;
14
15// friend bool operator==(const slice& x, const slice& y);
16
17#include <cassert>
18#include <valarray>
19
20#include "test_comparisons.h"
21
22void test() {
23 {
24 std::slice s1;
25 std::slice s2;
26
27 assert(testEquality(s1, s2, true));
28 }
29 {
30 std::slice s1{1, 2, 3};
31 std::slice s2{1, 2, 3};
32
33 assert(testEquality(s1, s2, true));
34 }
35 {
36 std::slice s1;
37 std::slice s2{1, 2, 3};
38
39 assert(testEquality(s1, s2, false));
40 }
41 {
42 std::slice s1{0, 2, 3};
43 std::slice s2{1, 2, 3};
44
45 assert(testEquality(s1, s2, false));
46 }
47 {
48 std::slice s1{1, 0, 3};
49 std::slice s2{1, 2, 3};
50
51 assert(testEquality(s1, s2, false));
52 }
53 {
54 std::slice s1{1, 2, 0};
55 std::slice s2{1, 2, 3};
56
57 assert(testEquality(s1, s2, false));
58 }
59}
60
61int main(int, char**) {
62 test();
63
64 return 0;
65}
66

source code of libcxx/test/std/numerics/numarray/class.slice/slice.ops/slice.ops.pass.cpp