From 5a83710e371fe68a06e6e3876c6a2c8b820a8976 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 20 Dec 2014 01:40:03 +0000 Subject: Move test into test/std subdirectory. llvm-svn: 224658 --- .../bitset.members/index_const.pass.cpp | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 libcxx/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp (limited to 'libcxx/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp') diff --git a/libcxx/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp new file mode 100644 index 00000000000..e3c28c69357 --- /dev/null +++ b/libcxx/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// test constexpr bool operator[](size_t pos) const; + +#include +#include +#include + +#pragma clang diagnostic ignored "-Wtautological-compare" + +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_index_const() +{ + const std::bitset v1 = make_bitset(); + if (N > 0) + { + assert(v1[N/2] == v1.test(N/2)); + } +} + +int main() +{ + test_index_const<0>(); + test_index_const<1>(); + test_index_const<31>(); + test_index_const<32>(); + test_index_const<33>(); + test_index_const<63>(); + test_index_const<64>(); + test_index_const<65>(); + test_index_const<1000>(); +} -- cgit v1.2.3