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 CastOperationLinkTests : public CAPITest {};
11
13TEST_F(CastOperationLinkTests, IsA_Cast_FeltToIndexOp) {
14 auto testOperation = createIndexOperation();
15
16 // This will always return false since `createIndex*` returns an MLIR builtin
17 EXPECT_FALSE(llzkOperationIsA_Cast_FeltToIndexOp(testOperation));
18
19 mlirOperationDestroy(testOperation);
20}
21
23TEST_F(CastOperationLinkTests, llzk_FeltToIndexOp_Build) {
24 // Returns an `arith.constant` op, which will never match the FeltToIndexOp 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
34 (void)llzkCast_FeltToIndexOpBuild(builder, location, dummyValue);
35 // No need to destroy builder or op since this code never runs.
36 }
37
38 mlirOperationDestroy(testOp);
39}
40
41struct FeltToIndexOpBuildFuncHelper : public TestAnyBuildFuncHelper<CAPITest> {
42 virtual bool callIsA(MlirOperation op) override { return llzkOperationIsA_Cast_FeltToIndexOp(op); }
46 static std::unique_ptr<FeltToIndexOpBuildFuncHelper> get();
47
48protected:
50};
51
54TEST_F(CAPITest, FeltToIndexOp_build_pass) { FeltToIndexOpBuildFuncHelper::get()->run(*this); }
55
56TEST_F(CastOperationLinkTests, llzk_FeltToIndexOp_GetValue) {
57 auto testOp = createIndexOperation();
58
61 }
62
63 mlirOperationDestroy(testOp);
64}
65
66TEST_F(CastOperationLinkTests, llzk_FeltToIndexOp_SetValue) {
67 auto testOp = createIndexOperation();
68
70 auto dummyValue = mlirOperationGetResult(testOp, 0);
71 llzkCast_FeltToIndexOpSetValue(testOp, dummyValue);
72 }
73
74 mlirOperationDestroy(testOp);
75}
76
77TEST_F(CastOperationLinkTests, llzk_FeltToIndexOp_GetResult) {
78 auto testOp = createIndexOperation();
79
82 }
83
84 mlirOperationDestroy(testOp);
85}
86
88TEST_F(CastOperationLinkTests, IsA_Cast_IntToFeltOp) {
89 auto testOperation = createIndexOperation();
90
91 // This will always return false since `createIndex*` returns an MLIR builtin
92 EXPECT_FALSE(llzkOperationIsA_Cast_IntToFeltOp(testOperation));
93
94 mlirOperationDestroy(testOperation);
95}
96
98TEST_F(CastOperationLinkTests, llzk_IntToFeltOp_Build) {
99 // Returns an `arith.constant` op, which will never match the IntToFeltOp dialect check.
100 auto testOp = createIndexOperation();
101
102 // This condition is always false, so the function is never actually called.
103 // We only verify it compiles and links correctly.
105 MlirOpBuilder builder = mlirOpBuilderCreate(context);
106 MlirLocation location = mlirLocationUnknownGet(context);
107 auto dummyValue = mlirOperationGetResult(testOp, 0);
108
109 (void)llzkCast_IntToFeltOpBuild(builder, location, dummyValue);
110 // No need to destroy builder or op since this code never runs.
111 }
112
113 mlirOperationDestroy(testOp);
114}
115
116struct IntToFeltOpBuildFuncHelper : public TestAnyBuildFuncHelper<CAPITest> {
117 virtual bool callIsA(MlirOperation op) override { return llzkOperationIsA_Cast_IntToFeltOp(op); }
121 static std::unique_ptr<IntToFeltOpBuildFuncHelper> get();
122
123protected:
125};
126
129TEST_F(CAPITest, IntToFeltOp_build_pass) { IntToFeltOpBuildFuncHelper::get()->run(*this); }
130
131TEST_F(CastOperationLinkTests, llzk_IntToFeltOp_GetValue) {
132 auto testOp = createIndexOperation();
133
135 (void)llzkCast_IntToFeltOpGetValue(testOp);
136 }
137
138 mlirOperationDestroy(testOp);
139}
140
141TEST_F(CastOperationLinkTests, llzk_IntToFeltOp_SetValue) {
142 auto testOp = createIndexOperation();
143
145 auto dummyValue = mlirOperationGetResult(testOp, 0);
146 llzkCast_IntToFeltOpSetValue(testOp, dummyValue);
147 }
148
149 mlirOperationDestroy(testOp);
150}
151
152TEST_F(CastOperationLinkTests, llzk_IntToFeltOp_GetResult) {
153 auto testOp = createIndexOperation();
154
156 (void)llzkCast_IntToFeltOpGetResult(testOp);
157 }
158
159 mlirOperationDestroy(testOp);
160}
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 llzkCast_FeltToIndexOpGetResult(MlirOperation op)
Get Result result from llzk::cast::FeltToIndexOp Operation.
void llzkCast_IntToFeltOpSetValue(MlirOperation op, MlirValue value)
Set Value operand of llzk::cast::IntToFeltOp Operation.
MlirOperation llzkCast_IntToFeltOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue value)
Build a llzk::cast::IntToFeltOp Operation.
MlirValue llzkCast_FeltToIndexOpGetValue(MlirOperation op)
Get Value operand from llzk::cast::FeltToIndexOp Operation.
bool llzkOperationIsA_Cast_FeltToIndexOp(MlirOperation inp)
Returns true if the Operation is a llzk::cast::FeltToIndexOp.
bool llzkOperationIsA_Cast_IntToFeltOp(MlirOperation inp)
Returns true if the Operation is a llzk::cast::IntToFeltOp.
MlirValue llzkCast_IntToFeltOpGetResult(MlirOperation op)
Get Result result from llzk::cast::IntToFeltOp Operation.
void llzkCast_FeltToIndexOpSetValue(MlirOperation op, MlirValue value)
Set Value operand of llzk::cast::FeltToIndexOp Operation.
MlirValue llzkCast_IntToFeltOpGetValue(MlirOperation op)
Get Value operand from llzk::cast::IntToFeltOp Operation.
MlirOperation llzkCast_FeltToIndexOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue value)
Build a llzk::cast::FeltToIndexOp Operation.
virtual bool callIsA(MlirOperation op) override
static std::unique_ptr< FeltToIndexOpBuildFuncHelper > get()
This method must be implemented to return a subclass of FeltToIndexOpBuildFuncHelper that at least im...
static std::unique_ptr< IntToFeltOpBuildFuncHelper > get()
This method must be implemented to return a subclass of IntToFeltOpBuildFuncHelper that at least impl...
IntToFeltOpBuildFuncHelper()=default
virtual bool callIsA(MlirOperation op) override