• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/functional/not_fn.h"
6 
7 #include <functional>
8 
9 #include "testing/gtest/include/gtest/gtest.h"
10 
11 namespace base {
12 
TEST(FunctionalTest,NotFn)13 TEST(FunctionalTest, NotFn) {
14   constexpr auto not_less = base::not_fn(std::less<>());
15 
16   using NotLessT = decltype(not_less);
17   static_assert(static_cast<const NotLessT&>(not_less)(1, 1), "");
18   static_assert(static_cast<NotLessT&>(not_less)(2, 1), "");
19   static_assert(static_cast<const NotLessT&&>(not_less)(2, 2), "");
20   static_assert(!static_cast<NotLessT&&>(not_less)(1, 2), "");
21 }
22 
23 }  // namespace base
24