From a99c6c949b7fd7cb28d15b2e19382747b41e1fb4 Mon Sep 17 00:00:00 2001 From: Beforerr Date: Thu, 14 Nov 2024 12:35:29 -0800 Subject: [PATCH] test: add testset for "String constructor with keywords" --- test/runtests.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index d77e476..a66524a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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)