Skip to content

Commit

Permalink
test: add testset for "String constructor with keywords"
Browse files Browse the repository at this point in the history
  • Loading branch information
Beforerr committed Nov 14, 2024
1 parent 7ef641d commit a99c6c9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ using Mendeleev: elements
@test charge(he2plus) == 2q
end

@testset "String constructor with keywords" begin
@test Particle("Fe").charge_number == 0
@test Particle("Fe 2+").charge_number == 2
@test Particle("Fe"; Z=2).charge_number == 2
@test Particle("Fe 2+"; Z=2).charge_number == 2
@test_throws ArgumentError Particle("Fe 2+"; Z=3)

@test Particle("Fe").mass_number == 56
@test Particle("Fe-54").mass_number == 54
@test Particle("Fe"; mass_numb=54).mass_number == 54
@test Particle("Fe-54", mass_numb=54).mass_number == 54
@test_throws ArgumentError Particle("Fe-54"; mass_numb=55)
end

@testset "Atomic Number Constructor" begin
# Test basic construction
iron = Particle(26)
Expand Down

0 comments on commit a99c6c9

Please sign in to comment.