< Summary

Class:BaseHashSet[T]
Assembly:BaseVariable
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/Variables/BaseHashSet.cs
Covered lines:16
Uncovered lines:8
Coverable lines:24
Total lines:61
Line coverage:66.6% (16 of 24)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BaseHashSet()0%110100%
BaseHashSet(...)0%2100%
Get()0%2100%
Set(...)0%6200%
Add(...)0%220100%
Add(...)0%330100%
Remove(...)0%330100%
Remove(...)0%330100%
Count()0%2100%
Contains(...)0%110100%
Equals(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/Variables/BaseHashSet.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3
 4public class BaseHashSet<T> : IBaseCollection<T>, IEquatable<IEnumerable<T>>
 5{
 6    public event Action<IEnumerable<T>> OnSet;
 7    public event Action<T> OnAdded;
 8    public event Action<T> OnRemoved;
 9
 152110    internal readonly HashSet<T> hashSet = new HashSet<T>();
 11
 304212    public BaseHashSet() { }
 013    public BaseHashSet(IEnumerable<T> elements) { hashSet = new HashSet<T>(elements); }
 14
 015    public IEnumerable<T> Get() => hashSet;
 16
 17    public void Set(IEnumerable<T> elements)
 18    {
 019        hashSet.Clear();
 020        hashSet.UnionWith(elements);
 21
 022        OnSet?.Invoke(hashSet);
 023    }
 24
 25    public void Add(T element)
 26    {
 144827        hashSet.Add(element);
 144828        OnAdded?.Invoke(element);
 143529    }
 30
 31    public void Add(IEnumerable<T> elements)
 32    {
 169433        foreach ( T e in elements )
 34        {
 40435            Add(e);
 36        }
 44337    }
 38
 39    public bool Remove(T element)
 40    {
 48741        if (!hashSet.Remove(element))
 9942            return false;
 43
 38844        OnRemoved?.Invoke(element);
 38845        return true;
 46    }
 47
 48    public void Remove(IEnumerable<T> elements)
 49    {
 81050        foreach ( T e in elements )
 51        {
 14652            Remove(e);
 53        }
 25954    }
 55
 056    public int Count() => hashSet.Count;
 57
 71858    public bool Contains(T element) => hashSet.Contains(element);
 59
 060    public virtual bool Equals(IEnumerable<T> other) { return EqualityComparer<IEnumerable<T>>.Default.Equals(hashSet, o
 61}