blob: c40f1c1b6d2d1525f38d84809442660d794e2860 [file] [log] [blame]
<%!
import vec_test_helpers
%>\
<%def name="test_opmvv_vred(template_helper, src2, src1, ref_vv)">
<%
src1 = vec_test_helpers.to_carr_str(src1)
src2 = vec_test_helpers.to_carr_str(src2)
ref_vv = vec_test_helpers.to_carr_str(ref_vv)
%>\
namespace softrvv_${template_helper.op_code}_test {
namespace {
${insert_variable_init(template_helper, src2, src1, ref_vv)}
class SoftRvv${template_helper.op_code.capitalize()}Test : public ::testing::Test {
protected:
void SetUp() override { memset(dest, 0, sizeof(dest)); }
};
${insert_test(template_helper)}\
} // namespace
} // namespace softrvv_${op}_test\
</%def>\
<%def name="insert_variable_init(template_helper, src2, src1, ref_vv)">
<%
var_types = template_helper.get_var_types()
%>\
${var_types.src1_type} src1[] = {${src1}};
${var_types.src2_type} src2[] = {${src2}};
const int kAVL = sizeof(src1)/sizeof(src1[0]);
${var_types.dest_type} dest[kAVL];
${var_types.dest_type} ref_vv[kAVL] = {${ref_vv}};
</%def>\
<%def name="insert_test(template_helper)">
<%
var_types = template_helper.get_var_types()
datatypes = template_helper.get_softrvv_template_data_type()
%>\
TEST_F(SoftRvv${template_helper.op_code.capitalize()}Test, VS) {
softrvv::${template_helper.op_code}_vs<${datatypes}>(dest, src2, src1, kAVL);\
assert_vec_elem_eq<${var_types.dest_type}>(kAVL, dest, ref_vv);
}
</%def>\