LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.capi.test.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op C API Tests *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10class LlzkOperationLinkTests : public CAPITest {};
11
13TEST_F(LlzkOperationLinkTests, IsA_Llzk_NonDetOp) {
14 auto testOperation = createIndexOperation();
15
16 // This will always return false since `createIndex*` returns an MLIR builtin
17 EXPECT_FALSE(llzkOperationIsA_Llzk_NonDetOp(testOperation));
18
19 mlirOperationDestroy(testOperation);
20}
21
23TEST_F(LlzkOperationLinkTests, llzk_NonDetOp_Build) {
24 // Returns an `arith.constant` op, which will never match the NonDetOp dialect check.
25 auto testOp = createIndexOperation();
26
27 // This condition is always false, so the function is never actually called.
28 // We only verify it compiles and links correctly.
30 MlirOpBuilder builder = mlirOpBuilderCreate(context);
31 MlirLocation location = mlirLocationUnknownGet(context);
32 auto dummyValue = mlirOperationGetResult(testOp, 0);
33 auto resType = createIndexType();
34
35 (void)llzkLlzk_NonDetOpBuild(builder, location, resType);
36 // No need to destroy builder or op since this code never runs.
37 }
38
39 mlirOperationDestroy(testOp);
40}
41
42struct NonDetOpBuildFuncHelper : public TestAnyBuildFuncHelper<CAPITest> {
43 virtual bool callIsA(MlirOperation op) override { return llzkOperationIsA_Llzk_NonDetOp(op); }
47 static std::unique_ptr<NonDetOpBuildFuncHelper> get();
48
49protected:
51};
52
55TEST_F(CAPITest, NonDetOp_build_pass) { NonDetOpBuildFuncHelper::get()->run(*this); }
56
57TEST_F(LlzkOperationLinkTests, llzk_NonDetOp_GetRes) {
58 auto testOp = createIndexOperation();
59
61 (void)llzkLlzk_NonDetOpGetRes(testOp);
62 }
63
64 mlirOperationDestroy(testOp);
65}
TEST_F(ArrayOperationLinkTests, IsA_Array_ArrayLengthOp)
This test ensures llzkOperationIsA_Array_ArrayLengthOp links properly.
MlirOpBuilder mlirOpBuilderCreate(MlirContext ctx)
Creates a new OpBuilder for the given MLIR context.
Definition Builder.cpp:62
MlirValue llzkLlzk_NonDetOpGetRes(MlirOperation op)
Get Res result from llzk::NonDetOp Operation.
bool llzkOperationIsA_Llzk_NonDetOp(MlirOperation inp)
Returns true if the Operation is a llzk::NonDetOp.
MlirOperation llzkLlzk_NonDetOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resType)
Build a llzk::NonDetOp Operation.
virtual bool callIsA(MlirOperation op) override
static std::unique_ptr< NonDetOpBuildFuncHelper > get()
This method must be implemented to return a subclass of NonDetOpBuildFuncHelper that at least impleme...
NonDetOpBuildFuncHelper()=default