@@ -112,6 +112,57 @@ Y_UNIT_TEST_SUITE(TKernelRegistryTest) {
112
112
});
113
113
}
114
114
115
+ Y_UNIT_TEST (TestAddSubMulOps) {
116
+ for (const auto oper : {TKernelRequestBuilder::EBinaryOp::Add, TKernelRequestBuilder::EBinaryOp::Sub, TKernelRequestBuilder::EBinaryOp::Mul}) {
117
+ for (const auto slot : {EDataSlot::Int8, EDataSlot::Int16, EDataSlot::Int32, EDataSlot::Int64, EDataSlot::Uint8, EDataSlot::Uint16, EDataSlot::Uint32, EDataSlot::Uint64, EDataSlot::Float, EDataSlot::Double}) {
118
+ TestOne ([slot, oper](auto & b,auto & ctx) {
119
+ const auto blockUint8Type = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(EDataSlot::Uint8));
120
+ const auto blockType = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(slot));
121
+ return b.AddBinaryOp (oper, blockUint8Type, blockType, blockType);
122
+ });
123
+ TestOne ([slot, oper](auto & b,auto & ctx) {
124
+ const auto blockUint8Type = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(EDataSlot::Uint8));
125
+ const auto blockType = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(slot));
126
+ return b.AddBinaryOp (oper, blockType, blockUint8Type, blockType);
127
+ });
128
+ TestOne ([slot, oper](auto & b,auto & ctx) {
129
+ const auto blockType = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(slot));
130
+ return b.AddBinaryOp (oper, blockType, blockType, blockType);
131
+ });
132
+ }
133
+ }
134
+ }
135
+
136
+ Y_UNIT_TEST (TestDivModOps) {
137
+ for (const auto oper : {TKernelRequestBuilder::EBinaryOp::Div, TKernelRequestBuilder::EBinaryOp::Mod}) {
138
+ for (const auto slot : {EDataSlot::Int8, EDataSlot::Int16, EDataSlot::Int32, EDataSlot::Int64, EDataSlot::Uint8, EDataSlot::Uint16, EDataSlot::Uint32, EDataSlot::Uint64, EDataSlot::Float, EDataSlot::Double}) {
139
+ TestOne ([slot, oper](auto & b,auto & ctx) {
140
+ const auto blockUint8Type = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(EDataSlot::Uint8));
141
+ const auto rawType = ctx.template MakeType <TDataExprType>(slot);
142
+ const auto blockType = ctx.template MakeType <TBlockExprType>(rawType);
143
+ const auto returnType = EDataSlot::Float != slot && EDataSlot::Double != slot ?
144
+ ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TOptionalExprType>(rawType)) : blockType;
145
+ return b.AddBinaryOp (oper, blockUint8Type, blockType, returnType);
146
+ });
147
+ TestOne ([slot, oper](auto & b,auto & ctx) {
148
+ const auto blockUint8Type = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(EDataSlot::Uint8));
149
+ const auto rawType = ctx.template MakeType <TDataExprType>(slot);
150
+ const auto blockType = ctx.template MakeType <TBlockExprType>(rawType);
151
+ const auto returnType = EDataSlot::Float != slot && EDataSlot::Double != slot ?
152
+ ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TOptionalExprType>(rawType)) : blockType;
153
+ return b.AddBinaryOp (oper, blockType, blockUint8Type, returnType);
154
+ });
155
+ TestOne ([slot, oper](auto & b,auto & ctx) {
156
+ const auto rawType = ctx.template MakeType <TDataExprType>(slot);
157
+ const auto blockType = ctx.template MakeType <TBlockExprType>(rawType);
158
+ const auto returnType = EDataSlot::Float != slot && EDataSlot::Double != slot ?
159
+ ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TOptionalExprType>(rawType)) : blockType;
160
+ return b.AddBinaryOp (oper, blockType, blockType, returnType);
161
+ });
162
+ }
163
+ }
164
+ }
165
+
115
166
Y_UNIT_TEST (TestSize) {
116
167
TestOne ([](auto & b,auto & ctx) {
117
168
auto blockStrType = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(EDataSlot::String));
@@ -121,17 +172,21 @@ Y_UNIT_TEST_SUITE(TKernelRegistryTest) {
121
172
}
122
173
123
174
Y_UNIT_TEST (TestMinus) {
124
- TestOne ([](auto & b,auto & ctx) {
125
- auto blockInt32Type = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(EDataSlot::Int32));
126
- return b.AddUnaryOp (TKernelRequestBuilder::EUnaryOp::Minus, blockInt32Type, blockInt32Type);
127
- });
175
+ for (const auto slot : {EDataSlot::Int8, EDataSlot::Int16, EDataSlot::Int32, EDataSlot::Int64, EDataSlot::Float, EDataSlot::Double}) {
176
+ TestOne ([slot](auto & b,auto & ctx) {
177
+ const auto blockType = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(slot));
178
+ return b.AddUnaryOp (TKernelRequestBuilder::EUnaryOp::Minus, blockType, blockType);
179
+ });
180
+ }
128
181
}
129
182
130
183
Y_UNIT_TEST (TestAbs) {
131
- TestOne ([](auto & b,auto & ctx) {
132
- auto blockInt32Type = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(EDataSlot::Int32));
133
- return b.AddUnaryOp (TKernelRequestBuilder::EUnaryOp::Abs, blockInt32Type, blockInt32Type);
134
- });
184
+ for (const auto slot : {EDataSlot::Int8, EDataSlot::Int16, EDataSlot::Int32, EDataSlot::Int64, EDataSlot::Float, EDataSlot::Double}) {
185
+ TestOne ([slot](auto & b,auto & ctx) {
186
+ const auto blockType = ctx.template MakeType <TBlockExprType>(ctx.template MakeType <TDataExprType>(slot));
187
+ return b.AddUnaryOp (TKernelRequestBuilder::EUnaryOp::Abs, blockType, blockType);
188
+ });
189
+ }
135
190
}
136
191
137
192
Y_UNIT_TEST (TestCoalesece) {
0 commit comments