Esempio n. 1
0
    def argument_empty_test(self):
        """Test cases with empty argument.
        """
        cases = []

        cases.append('\n\n;; Test operation with empty argument\n')

        case_data = {
            'op': '',
            'extended_name': 'arg-empty',
            'param_type': '',
            'result_type': '(result v128)',
            'params': '',
        }

        for op in self.UNARY_OPS:
            case_data['op'] = '{lane_type}.{op}'.format(
                lane_type=self.LANE_TYPE, op=op)
            case_data['extended_name'] = 'arg-empty'
            case_data['params'] = ''
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

        for op in self.BINARY_OPS:
            case_data['op'] = '{lane_type}.{op}'.format(
                lane_type=self.LANE_TYPE, op=op)
            case_data['extended_name'] = '1st-arg-empty'
            case_data['params'] = SIMD.v128_const('0', self.LANE_TYPE)
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

            case_data['extended_name'] = 'arg-empty'
            case_data['params'] = ''
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

        return '\n'.join(cases)
Esempio n. 2
0
    def get_argument_empty_case(self):
        """
        Generate argument empty cases
        """

        cases = []

        param_1 = SIMD.v128_const('0', 'i32x4')

        cases.append('\n\n;; Test operation with empty argument\n')

        case_data = {
            'op': '',
            'extended_name': 'arg-empty',
            'param_type': '',
            'result_type': '(result v128)',
            'params': '',
        }

        for op in self.UNARY_OPS:
            case_data['op'] = 'v128.' + op
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

        for op in self.BINARY_OPS:
            case_data['op'] = 'v128.' + op
            case_data['extended_name'] = '1st-arg-empty'
            case_data['params'] = param_1
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

            case_data['extended_name'] = 'arg-empty'
            case_data['params'] = ''
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

        for op in self.TERNARY_OPS:
            case_data['op'] = 'v128.' + op
            case_data['extended_name'] = '1st-arg-empty'
            case_data['params'] = param_1 + ' ' + param_1
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

            case_data['extended_name'] = 'two-args-empty'
            case_data['params'] = param_1
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

            case_data['extended_name'] = 'arg-empty'
            case_data['params'] = ''
            cases.append(AssertInvalid.get_arg_empty_test(**case_data))

        return '\n'.join(cases) + '\n'