bit_xor.pass.cpp revision c52f43e72dfcea03037729649da84c23b3beb04a
1cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com//===----------------------------------------------------------------------===//
2cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com//
3cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com//                     The LLVM Compiler Infrastructure
4cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com//
5cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com// This file is distributed under the University of Illinois Open Source
6cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com// License. See LICENSE.TXT for details.
7cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com//
8cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com//===----------------------------------------------------------------------===//
9cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com
108cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com// <functional>
118cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com
128cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com// bit_xor
138cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com
148cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com#include <functional>
158cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com#include <type_traits>
168cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com#include <cassert>
178cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com
188cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.comint main()
198cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com{
208cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com    typedef std::bit_xor<int> F;
218cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com    const F f = F();
228cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
238cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com    assert(f(0xEA95, 0xEA95) == 0);
248cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com    assert(f(0xEA95, 0x58D3) == 0xB246);
258cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com    assert(f(0x58D3, 0xEA95) == 0xB246);
268cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com    assert(f(0x58D3, 0) == 0x58D3);
278cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com    assert(f(0xFFFF, 0x58D3) == 0xA72C);
288cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com}
298cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com