1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // test bitset<N> operator<<(size_t pos) const;
16 #include "test_macros.h"
18 #if defined(TEST_COMPILER_CLANG)
19 #pragma clang diagnostic ignored "-Wtautological-compare"
20 #elif defined(TEST_COMPILER_C1XX)
21 #pragma warning(disable: 6294) // Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed.
24 template <std::size_t N>
29 for (std::size_t i = 0; i < N; ++i)
30 v[i] = static_cast<bool>(std::rand() & 1);
34 template <std::size_t N>
35 void test_left_shift()
37 for (std::size_t s = 0; s <= N+1; ++s)
39 std::bitset<N> v1 = make_bitset<N>();
40 std::bitset<N> v2 = v1;
41 assert((v1 <<= s) == (v2 << s));
49 test_left_shift<31>();
50 test_left_shift<32>();
51 test_left_shift<33>();
52 test_left_shift<63>();
53 test_left_shift<64>();
54 test_left_shift<65>();
55 test_left_shift<1000>();