测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | FAIL |
| Plus 测试 | FAIL |
| 代码长度 | 443 字符 |
模型生成的代码 (443 字符)
def magic_square_test(matrix):
"""
Determines if a given square matrix is a magic square.
A magic square is a square matrix where the sum of every row,
every column, and both diagonals are equal.
"""
if not matrix:
return False
n = len(matrix)
# Ensure matrix is square
for row in matrix:
if len(row) != n:
return False
target = sum(matrix[0])
# Check rows
Base 失败测试用例
[[[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5], [9, 6, 15, 4]]]
Plus 失败测试用例
[[[-2, 7, 6], [9, -5, 1], [4, 3, -7]]]