all.pass.cpp revision c52f43e72dfcea03037729649da84c23b3beb04a
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// test bool all() const;
11
12#include <bitset>
13#include <cassert>
14
15template <std::size_t N>
16void test_all()
17{
18    std::bitset<N> v;
19    v.reset();
20    assert(v.all() == (N == 0));
21    v.set();
22    assert(v.all() == true);
23    if (N > 1)
24    {
25        v[N/2] = false;
26        assert(v.all() == false);
27    }
28}
29
30int main()
31{
32    test_all<0>();
33    test_all<1>();
34    test_all<31>();
35    test_all<32>();
36    test_all<33>();
37    test_all<63>();
38    test_all<64>();
39    test_all<65>();
40    test_all<1000>();
41}
42