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 StringOperationLinkTests : public CAPITest {};
11
13TEST_F(StringOperationLinkTests, IsA_String_LitStringOp) {
14 auto testOperation = createIndexOperation();
15
16 // This will always return false since `createIndex*` returns an MLIR builtin
17 EXPECT_FALSE(llzkOperationIsA_String_LitStringOp(testOperation));
18
19 mlirOperationDestroy(testOperation);
20}
21
23TEST_F(StringOperationLinkTests, llzk_LitStringOp_Build) {
24 // Returns an `arith.constant` op, which will never match the LitStringOp 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 resultType = createIndexType();
34 auto valueAttr = mlirOperationGetName(testOp);
35
36 (void)llzkString_LitStringOpBuild(builder, location, resultType, valueAttr);
37 // No need to destroy builder or op since this code never runs.
38 }
39
40 mlirOperationDestroy(testOp);
41}
42
43struct LitStringOpBuildFuncHelper : public TestAnyBuildFuncHelper<CAPITest> {
44 virtual bool callIsA(MlirOperation op) override { return llzkOperationIsA_String_LitStringOp(op); }
48 static std::unique_ptr<LitStringOpBuildFuncHelper> get();
49
50protected:
52};
53
56TEST_F(CAPITest, LitStringOp_build_pass) { LitStringOpBuildFuncHelper::get()->run(*this); }
57
58TEST_F(StringOperationLinkTests, llzk_LitStringOp_GetValueAttr) {
59 auto testOp = createIndexOperation();
60
63 }
64
65 mlirOperationDestroy(testOp);
66}
67
68TEST_F(StringOperationLinkTests, llzk_LitStringOp_SetValueAttr) {
69 auto testOp = createIndexOperation();
70
72 llzkString_LitStringOpSetValue(testOp, createIndexAttribute());
73 }
74
75 mlirOperationDestroy(testOp);
76}
77
78TEST_F(StringOperationLinkTests, llzk_LitStringOp_GetResult) {
79 auto testOp = createIndexOperation();
80
83 }
84
85 mlirOperationDestroy(testOp);
86}
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 llzkString_LitStringOpGetResult(MlirOperation op)
Get Result result from llzk::string::LitStringOp Operation.
MlirAttribute llzkString_LitStringOpGetValue(MlirOperation op)
Get Value attribute from llzk::string::LitStringOp Operation.
MlirOperation llzkString_LitStringOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resultType, MlirIdentifier value)
Build a llzk::string::LitStringOp Operation.
void llzkString_LitStringOpSetValue(MlirOperation op, MlirAttribute attr)
Set Value attribute of llzk::string::LitStringOp Operation.
bool llzkOperationIsA_String_LitStringOp(MlirOperation inp)
Returns true if the Operation is a llzk::string::LitStringOp.
virtual bool callIsA(MlirOperation op) override
LitStringOpBuildFuncHelper()=default
static std::unique_ptr< LitStringOpBuildFuncHelper > get()
This method must be implemented to return a subclass of LitStringOpBuildFuncHelper that at least impl...