[debug] Use poison instead of undef to set a killed dbg.assign address [NFC] (#119760)
[llvm-project.git] / libcxx / test / std / numerics / numarray / template.valarray / valarray.cons / initializer_list.pass.cpp
blobe6430f6ee900781d4873545b68a8b61682206662
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03
11 // <valarray>
13 // template<class T> class valarray;
15 // valarray(initializer_list<value_type>);
17 #include <valarray>
18 #include <cassert>
20 #include "test_macros.h"
22 int main(int, char**)
25 typedef int T;
26 T a[] = {1, 2, 3, 4, 5};
27 const unsigned N = sizeof(a)/sizeof(a[0]);
28 std::valarray<T> v = {1, 2, 3, 4, 5};
29 assert(v.size() == N);
30 for (unsigned i = 0; i < N; ++i)
31 assert(v[i] == a[i]);
34 typedef double T;
35 T a[] = {1, 2, 3, 4, 5};
36 const unsigned N = sizeof(a)/sizeof(a[0]);
37 std::valarray<T> v = {1, 2, 3, 4, 5};
38 assert(v.size() == N);
39 for (unsigned i = 0; i < N; ++i)
40 assert(v[i] == a[i]);
43 return 0;