Skip to content

Commit

Permalink
Add "Test addition and subtraction"
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Nov 16, 2021
1 parent f3ded58 commit 32dc5d8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,16 @@ end
@test a / 2 == EngineeringStress(0.5, 1, 1.5, 2, 2.5, 3)
@test 2a / 2 == a
end

@testset "Test addition and subtraction" begin
a = EngineeringStrain(1:6)
b = -EngineeringStrain(1:1:6)
@test a - b == 2a
@test b - a == -2a
@test a + b == EngineeringStrain(zeros(6))
a = TensorStress(EngineeringStress(1:6))
b = -TensorStress(EngineeringStress(1:6))
@test a - b == 2a
@test b - a == -2a
@test a + b == TensorStress(zeros(3, 3))
end

0 comments on commit 32dc5d8

Please sign in to comment.