Skip to content

Commit

Permalink
add tests to Selection arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Dec 1, 2023
1 parent be64dc3 commit e030cd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/Selection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,15 @@ end
function Base.show(io::IO, s::Selection)
print(io, "Selection of $(atoms_str(s.natoms)) belonging to $(mol_str(s.nmols)).")
end

@testitem "Selection - argument errors" begin
using ComplexMixtures
@test_throws ArgumentError Selection([1,2,3], ["A", "B", "C"])
@test_throws ArgumentError Selection(Int[], ["A", "B", "C"]; nmols = 1)
@test_throws ArgumentError Selection([1, 2, 3], String[]; nmols = 1)
@test_throws ArgumentError Selection([1, 2, 3], String["A", "B"]; nmols = 1)
@test_throws ArgumentError Selection([1,2,3], ["A", "B", "C"]; nmols = 2)
@test_throws ArgumentError Selection([1,2,3], ["A", "B", "C"]; natomspermol = 2)
@test Selection([1,2,3], ["A","B","C"], natomspermol=1) == Selection(3, 3, 1, [1,2,3], [1,2,3], ["A"])
@test Selection([1,2,3], ["A","B","C"], nmols=1) == Selection(3, 1, 3, [1,2,3], [1,1,1], ["A","B","C"])
end
2 changes: 1 addition & 1 deletion src/compare.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(INTERNAL)
Union of types to define comparison operators.
"""
const ComplexMixturesTypes = Union{Result,Density,Volume,SolSummary,Options}
const ComplexMixturesTypes = Union{Result,Density,Volume,SolSummary,Options,Selection}

"""
Base.isapprox(r1::T, r2::T; debug=false) where T <: CMTypes
Expand Down

0 comments on commit e030cd3

Please sign in to comment.