Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / numerics / numarray / template.valarray / valarray.cons / value_size.pass.cpp
blob48416f97411dd6880159efeffc20d3ba95ca6cd2
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 // <valarray>
11 // template<class T> class valarray;
13 // valarray(const value_type& x, size_t n);
15 #include <valarray>
16 #include <cassert>
18 #include "test_macros.h"
20 int main(int, char**)
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);
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);
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);
41 return 0;