bit_or.pass.cpp 792 B

12345678910111213141516171819202122232425262728
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <functional>
  10. // bit_or
  11. #include <functional>
  12. #include <type_traits>
  13. #include <cassert>
  14. int main()
  15. {
  16. typedef std::bit_or<int> F;
  17. const F f = F();
  18. static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
  19. assert(f(0xEA95, 0xEA95) == 0xEA95);
  20. assert(f(0xEA95, 0x58D3) == 0xFAD7);
  21. assert(f(0x58D3, 0xEA95) == 0xFAD7);
  22. assert(f(0x58D3, 0) == 0x58D3);
  23. assert(f(0xFFFF, 0x58D3) == 0xFFFF);
  24. }