< Summary

Class:BaseHashSet[T]
Assembly:BaseVariable
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/Variables/BaseHashSet.cs
Covered lines:18
Uncovered lines:6
Coverable lines:24
Total lines:61
Line coverage:75% (18 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%110100%
Set(...)0%6200%
Add(...)0%220100%
Add(...)0%330100%
Remove(...)0%330100%
Remove(...)0%330100%
Count()0%110100%
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
 163210    internal readonly HashSet<T> hashSet = new HashSet<T>();
 11
 326412    public BaseHashSet() { }
 013    public BaseHashSet(IEnumerable<T> elements) { hashSet = new HashSet<T>(elements); }
 14
 1715    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    {
 126527        hashSet.Add(element);
 126528        OnAdded?.Invoke(element);
 124629    }
 30
 31    public void Add(IEnumerable<T> elements)
 32    {
 182833        foreach ( T e in elements )
 34        {
 43935            Add(e);
 36        }
 47537    }
 38
 39    public bool Remove(T element)
 40    {
 52241        if (!hashSet.Remove(element))
 10342            return false;
 43
 41944        OnRemoved?.Invoke(element);
 41945        return true;
 46    }
 47
 48    public void Remove(IEnumerable<T> elements)
 49    {
 89650        foreach ( T e in elements )
 51        {
 16352            Remove(e);
 53        }
 28554    }
 55
 50656    public int Count() => hashSet.Count;
 57
 77258    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}