Mbpp/99

⚠️ 仅 Base 通过 Base: PASS Plus: FAIL
测试评估
指标结果
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]