MatchersTest.cpp 861 B

12345678910111213141516171819202122232425
  1. //===----- unittests/MatchersTest.cpp -------------------------------------===//
  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. #include "llvm/ADT/Optional.h"
  9. #include "llvm/Testing/Support/SupportHelpers.h"
  10. #include "gmock/gmock-matchers.h"
  11. using ::testing::_;
  12. using ::testing::AllOf;
  13. using ::testing::Gt;
  14. using ::testing::Lt;
  15. using ::testing::Not;
  16. namespace {
  17. TEST(MatchersTest, Optional) {
  18. EXPECT_THAT(llvm::Optional<int>(llvm::None), Not(llvm::ValueIs(_)));
  19. EXPECT_THAT(llvm::Optional<int>(10), llvm::ValueIs(10));
  20. EXPECT_THAT(llvm::Optional<int>(10), llvm::ValueIs(AllOf(Lt(11), Gt(9))));
  21. }
  22. } // namespace