From e69c6de5867c94f9a2af5e1df2bdf064896eecdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20O=27Mara?= Date: Sat, 21 Mar 2020 17:18:34 +1100 Subject: [PATCH] Equality comparators --- src/sam/header.jl | 4 ++++ src/sam/metainfo.jl | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/sam/header.jl b/src/sam/header.jl index 1369e37..668cb59 100644 --- a/src/sam/header.jl +++ b/src/sam/header.jl @@ -14,6 +14,10 @@ function Header() return Header(MetaInfo[]) end +function Base.:(==)(a::Header, b::Header) + return a.metainfo == b.metainfo +end + function Base.copy(header::Header) return Header(header.metainfo) end diff --git a/src/sam/metainfo.jl b/src/sam/metainfo.jl index f40e6ae..f99c952 100644 --- a/src/sam/metainfo.jl +++ b/src/sam/metainfo.jl @@ -12,6 +12,15 @@ mutable struct MetaInfo dictval::Vector{UnitRange{Int}} end +function Base.:(==)(a::MetaInfo, b::MetaInfo) + return a.data == b.data && + a.filled == b.filled && + a.tag == b.tag && + a.val == b.val && + a.dictkey == b.dictkey && + a.dictval == b.dictval +end + function MetaInfo(data::Vector{UInt8}=UInt8[]) metainfo = MetaInfo(data, 1:0, 1:0, 1:0, UnitRange{Int}[], UnitRange{Int}[]) if !isempty(data)