测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 659 字符 |
模型生成的代码 (659 字符)
def index_multiplication(tup1, tup2):
"""
Perform index-wise multiplication of elements in two nested tuples.
The function recursively multiplies corresponding elements. If both elements
are tuples, it returns a new tuple with the same structure where each pair
of elements is multiplied. Otherwise, it multiplies the two scalar values.
"""
if isinstance(tup1, tuple) and isinstance(tup2, tuple):
# Recursively multiply corresponding elements
return tuple(index_multiplication(a, b) for a, b in zip(tup1, tup2))
else:
# Base case: both are numbers (or non-tuple elements)
return tup1 * tup2
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试