summaryrefslogtreecommitdiff
path: root/chromium/base/functional/not_fn_unittest.cc
blob: 6d1c80030121696a1e9a900e7669e402c966f763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/functional/not_fn.h"

#include <functional>

#include "testing/gtest/include/gtest/gtest.h"

namespace base {

TEST(FunctionalTest, NotFn) {
  constexpr auto not_less = base::not_fn(std::less<>());

  using NotLessT = decltype(not_less);
  static_assert(static_cast<const NotLessT&>(not_less)(1, 1), "");
  static_assert(static_cast<NotLessT&>(not_less)(2, 1), "");
  static_assert(static_cast<const NotLessT&&>(not_less)(2, 2), "");
  static_assert(!static_cast<NotLessT&&>(not_less)(1, 2), "");
}

}  // namespace base