测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | FAIL |
| 代码长度 | 497 字符 |
模型生成的代码 (497 字符)
import math
def zero_count(arr):
"""
Returns the ratio of zeroes to non-zeroes in an array of integers.
Parameters:
arr (list of int): Input array.
Returns:
float: Ratio of zeros to non-zeros. If there are no non-zero elements, returns 0.0.
"""
zero_count = sum(1 for x in arr if x == 0)
non_zero_count = len(arr) - zero_count
# Avoid division by zero
if non_zero_count == 0:
return 0.0
return zero_count / non_zero_count
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]