| 1 | //===- TypeTest.cpp - SMT type unit tests ---------------------------------===// |
|---|---|
| 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 | #include "mlir/Dialect/SMT/IR/SMTDialect.h" |
| 10 | #include "mlir/Dialect/SMT/IR/SMTTypes.h" |
| 11 | #include "gtest/gtest.h" |
| 12 | |
| 13 | using namespace mlir; |
| 14 | using namespace smt; |
| 15 | |
| 16 | namespace { |
| 17 | |
| 18 | TEST(SMTFuncTypeTest, NonEmptyDomain) { |
| 19 | MLIRContext context; |
| 20 | context.loadDialect<SMTDialect>(); |
| 21 | Location loc(UnknownLoc::get(&context)); |
| 22 | |
| 23 | auto boolTy = BoolType::get(&context); |
| 24 | auto funcTy = SMTFuncType::getChecked(loc, ArrayRef<Type>{}, boolTy); |
| 25 | ASSERT_EQ(funcTy, Type()); |
| 26 | context.getDiagEngine().registerHandler(handler: [&](Diagnostic &diag) { |
| 27 | ASSERT_STREQ(diag.str().c_str(), "domain must not be empty"); |
| 28 | }); |
| 29 | } |
| 30 | |
| 31 | } // namespace |
| 32 |
