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 //===----------------------------------------------------------------------===// 8 9 // test: 10 11 // bool operator==(const bitset<N>& rhs) const; 12 // bool operator!=(const bitset<N>& rhs) const; 13 14 #include <bitset> 15 #include <cassert> 16 #include <cstddef> 17 #include <vector> 18 19 #include "../bitset_test_cases.h" 20 #include "test_macros.h" 21 22 template <std::size_t N> test_equality()23void test_equality() { 24 std::vector<std::bitset<N> > const cases = get_test_cases<N>(); 25 for (std::size_t c = 0; c != cases.size(); ++c) { 26 std::bitset<N> const v1 = cases[c]; 27 std::bitset<N> v2 = v1; 28 assert(v1 == v2); 29 if (v1.size() > 0) { 30 v2[N/2].flip(); 31 assert(v1 != v2); 32 } 33 } 34 } 35 main(int,char **)36int main(int, char**) { 37 test_equality<0>(); 38 test_equality<1>(); 39 test_equality<31>(); 40 test_equality<32>(); 41 test_equality<33>(); 42 test_equality<63>(); 43 test_equality<64>(); 44 test_equality<65>(); 45 test_equality<1000>(); 46 47 return 0; 48 } 49