LLZK
3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Toggle main menu visibility
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
10
class
StringOperationLinkTests
:
public
CAPITest {};
11
13
TEST_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
23
TEST_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.
29
if
(
llzkOperationIsA_String_LitStringOp
(testOp)) {
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
43
struct
LitStringOpBuildFuncHelper
:
public
TestAnyBuildFuncHelper<CAPITest> {
44
virtual
bool
callIsA
(MlirOperation op)
override
{
return
llzkOperationIsA_String_LitStringOp
(op); }
48
static
std::unique_ptr<LitStringOpBuildFuncHelper>
get
();
49
50
protected
:
51
LitStringOpBuildFuncHelper
() =
default
;
52
};
53
56
TEST_F
(CAPITest, String_LitStringOp_build_pass) {
LitStringOpBuildFuncHelper::get
()->run(*
this
); }
57
58
TEST_F
(
StringOperationLinkTests
, llzk_LitStringOp_GetValueAttr) {
59
auto
testOp = createIndexOperation();
60
61
if
(
llzkOperationIsA_String_LitStringOp
(testOp)) {
62
(void)
llzkString_LitStringOpGetValue
(testOp);
63
}
64
65
mlirOperationDestroy(testOp);
66
}
67
68
TEST_F
(
StringOperationLinkTests
, llzk_LitStringOp_SetValueAttr) {
69
auto
testOp = createIndexOperation();
70
71
if
(
llzkOperationIsA_String_LitStringOp
(testOp)) {
72
llzkString_LitStringOpSetValue
(testOp, createIndexAttribute());
73
}
74
75
mlirOperationDestroy(testOp);
76
}
77
78
TEST_F
(
StringOperationLinkTests
, llzk_LitStringOp_GetResult) {
79
auto
testOp = createIndexOperation();
80
81
if
(
llzkOperationIsA_String_LitStringOp
(testOp)) {
82
(void)
llzkString_LitStringOpGetResult
(testOp);
83
}
84
85
mlirOperationDestroy(testOp);
86
}
TEST_F
TEST_F(ArrayOperationLinkTests, IsA_Array_ArrayLengthOp)
This test ensures llzkOperationIsA_Array_ArrayLengthOp links properly.
Definition
Ops.capi.test.cpp.inc:13
mlirOpBuilderCreate
MlirOpBuilder mlirOpBuilderCreate(MlirContext ctx)
Creates a new OpBuilder for the given MLIR context.
Definition
Builder.cpp:78
llzkString_LitStringOpGetResult
MlirValue llzkString_LitStringOpGetResult(MlirOperation op)
Get Result result from llzk::string::LitStringOp Operation.
Definition
Ops.capi.cpp.inc:41
llzkString_LitStringOpGetValue
MlirAttribute llzkString_LitStringOpGetValue(MlirOperation op)
Get Value attribute from llzk::string::LitStringOp Operation.
Definition
Ops.capi.cpp.inc:33
llzkString_LitStringOpBuild
MlirOperation llzkString_LitStringOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resultType, MlirIdentifier value)
Build a llzk::string::LitStringOp Operation.
Definition
Ops.capi.cpp.inc:16
llzkString_LitStringOpSetValue
void llzkString_LitStringOpSetValue(MlirOperation op, MlirAttribute attr)
Set Value attribute of llzk::string::LitStringOp Operation.
Definition
Ops.capi.cpp.inc:37
llzkOperationIsA_String_LitStringOp
bool llzkOperationIsA_String_LitStringOp(MlirOperation inp)
Returns true if the Operation is a llzk::string::LitStringOp.
Definition
Ops.capi.cpp.inc:29
StringOperationLinkTests
Definition
Ops.capi.test.cpp.inc:10
LitStringOpBuildFuncHelper::callIsA
virtual bool callIsA(MlirOperation op) override
Definition
Ops.capi.test.cpp.inc:44
LitStringOpBuildFuncHelper::LitStringOpBuildFuncHelper
LitStringOpBuildFuncHelper()=default
LitStringOpBuildFuncHelper::get
static std::unique_ptr< LitStringOpBuildFuncHelper > get()
This method must be implemented to return a subclass of LitStringOpBuildFuncHelper that at least impl...
build
include
llzk
Dialect
String
IR
Ops.capi.test.cpp.inc
Generated by
1.17.0
Copyright 2025 Veridise Inc. under the Apache License v2.0. Copyright 2026 Project LLZK under the Apache License v2.0.