Skip to content

Commit

Permalink
Fixed automatic feedback for trace task in HW2 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanAnNess authored Oct 29, 2024
1 parent 2a74d9f commit bf94bb5
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions homework/H2_Linear_Algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -820,28 +820,16 @@ else
# Results
result_square = trace(A_square)
result_diagonal = trace(A_diagonal)
shouldError = true
try
result_not_square = trace(A_not_square)
shouldError = false
catch
end

# Test missing
if ismissing(result_square) || ismissing(result_diagonal)
still_missing()
# Test for square matrix
elseif result_square != result_ref
elseif !isapprox(result_square, result_ref, atol=1e-4)
keep_working(md"Check your implementation for square matrices.")

# Test for non-square matrix
elseif !shouldError
keep_working(md"Did you check whether the matrix is a square matrix?")

# Test for diagonal matrix
elseif result_diagonal != result_ref
elseif !isapprox(result_diagonal, result_ref, atol=1e-4)
keep_working(md"Check your implementation for diagonal matrices.")

else
correct()
end
Expand Down

0 comments on commit bf94bb5

Please sign in to comment.