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 | // <valarray> |
10 | |
11 | // template<class T> class valarray; |
12 | |
13 | // valarray(const value_type& x, size_t n); |
14 | |
15 | #include <valarray> |
16 | #include <cassert> |
17 | |
18 | #include "test_macros.h" |
19 | |
20 | int main(int, char**) |
21 | { |
22 | { |
23 | std::valarray<int> v(5, 100); |
24 | assert(v.size() == 100); |
25 | for (int i = 0; i < 100; ++i) |
26 | assert(v[i] == 5); |
27 | } |
28 | { |
29 | std::valarray<double> v(2.5, 100); |
30 | assert(v.size() == 100); |
31 | for (int i = 0; i < 100; ++i) |
32 | assert(v[i] == 2.5); |
33 | } |
34 | { |
35 | std::valarray<std::valarray<double> > v(std::valarray<double>(10), 100); |
36 | assert(v.size() == 100); |
37 | for (int i = 0; i < 100; ++i) |
38 | assert(v[i].size() == 10); |
39 | } |
40 | |
41 | return 0; |
42 | } |
43 | |