测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 800 字符 |
模型生成的代码 (800 字符)
def check_Consecutive(lst):
"""
Check whether the given list contains consecutive integers.
Consecutive integers mean that after sorting the list,
the difference between any two adjacent elements is 1,
and there are no duplicates.
Args:
lst (list of int): Input list of integers.
Returns:
bool: True if the list consists of consecutive integers,
False otherwise.
"""
if not lst: # empty list is vacuously consecutive
return True
if len(lst) == 1: # single element list is trivially consecutive
return True
sorted_lst = sorted(lst)
for i in range(1, len(sorted_lst)):
if sorted_lst[i] - sorted_lst[i-1] != 1:
return False
return True
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试