测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | FAIL |
| 代码长度 | 392 字符 |
模型生成的代码 (392 字符)
def decimal_to_binary(n: int) -> str:
"""
Convert a non-negative integer to its binary representation as a string,
with no leading zeros. For n = 0, returns '0'.
"""
if n == 0:
return '0'
bits = []
while n > 0:
bits.append(str(n % 2))
n //= 2
# Bits are collected from LSB to MSB, so reverse.
bits.reverse()
return ''.join(bits)
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
[-5]