From 94b2dd0998230c758abd92c99d3700c971f7a31a Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sun, 22 Aug 2010 00:59:46 +0000 Subject: Fixing whitespace problems llvm-svn: 111767 --- .../bitset.members/left_shift.pass.cpp | 49 +++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'libcxx/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp') diff --git a/libcxx/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp b/libcxx/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp index b1d373187e4..f19987c018c 100644 --- a/libcxx/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp +++ b/libcxx/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp @@ -1 +1,48 @@ -//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test bitset operator<<(size_t pos) const; #include #include #include template std::bitset make_bitset() { std::bitset v; for (std::size_t i = 0; i < N; ++i) v[i] = static_cast(std::rand() & 1); return v; } template void test_left_shift() { for (std::size_t s = 0; s <= N+1; ++s) { std::bitset v1 = make_bitset(); std::bitset v2 = v1; assert((v1 <<= s) == (v2 << s)); } } int main() { test_left_shift<0>(); test_left_shift<1>(); test_left_shift<31>(); test_left_shift<32>(); test_left_shift<33>(); test_left_shift<63>(); test_left_shift<64>(); test_left_shift<65>(); test_left_shift<1000>(); } \ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// test bitset operator<<(size_t pos) const; + +#include +#include +#include + +template +std::bitset +make_bitset() +{ + std::bitset v; + for (std::size_t i = 0; i < N; ++i) + v[i] = static_cast(std::rand() & 1); + return v; +} + +template +void test_left_shift() +{ + for (std::size_t s = 0; s <= N+1; ++s) + { + std::bitset v1 = make_bitset(); + std::bitset v2 = v1; + assert((v1 <<= s) == (v2 << s)); + } +} + +int main() +{ + test_left_shift<0>(); + test_left_shift<1>(); + test_left_shift<31>(); + test_left_shift<32>(); + test_left_shift<33>(); + test_left_shift<63>(); + test_left_shift<64>(); + test_left_shift<65>(); + test_left_shift<1000>(); +} -- cgit v1.2.3