xref: /llvm-project/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp (revision b49d45925c235bc32c21933f958cb5d4a44364f3)
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 // <functional>
10 
11 // binary_negate
12 
13 // MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
14 #define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
15 
16 #include <functional>
17 #include <type_traits>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 
22 int main(int, char**)
23 {
24     typedef std::binary_negate<std::logical_and<int> > F;
25     const F f = F(std::logical_and<int>());
26     static_assert((std::is_same<int, F::first_argument_type>::value), "" );
27     static_assert((std::is_same<int, F::second_argument_type>::value), "" );
28     static_assert((std::is_same<bool, F::result_type>::value), "" );
29     assert(!f(36, 36));
30     assert( f(36, 0));
31     assert( f(0, 36));
32     assert( f(0, 0));
33 
34   return 0;
35 }
36