测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 324 字符 |
模型生成的代码 (324 字符)
def highest_Power_of_2(n):
"""
Returns the highest power of 2 that is less than or equal to n.
Assumes n is a positive integer.
"""
if n <= 0:
return 0 # No positive power of 2 fits this condition
# The highest power of 2 ≤ n is simply 2^(bit_length - 1)
return 1 << (n.bit_length() - 1)
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试