public void Remove() { var world = CollectionHelpers.PrepareWorld(); var first = new Data("data1"); var e = new Data("data3"); var last = new Data("data5"); var list = new ME.ECS.Collections.IntrusiveHashSetGeneric <Data>(); list.Add(first); list.Add(new Data("data2")); list.Add(e); list.Add(new Data("data4")); list.Add(last); list.Remove(e); UnityEngine.Debug.Assert(list.Count == 4); list.Remove(first); UnityEngine.Debug.Assert(list.Count == 3); list.Remove(last); UnityEngine.Debug.Assert(list.Count == 2); CollectionHelpers.CompleteWorld(world); }
public void ForEach() { var world = CollectionHelpers.PrepareWorld(); var e1 = new Data("data1"); var e2 = new Data("data2"); var e3 = new Data("data3"); var e4 = new Data("data4"); var e5 = new Data("data5"); var list = new ME.ECS.Collections.IntrusiveHashSetGeneric <Data>(); list.Add(e1); list.Add(e2); list.Add(e3); list.Add(e4); list.Add(e5); UnityEngine.Debug.Assert(list.Count == 5); var listArr = new System.Collections.Generic.List <Data>(); foreach (var item in list) { listArr.Add(item); } UnityEngine.Debug.Assert(listArr.Contains(e1)); UnityEngine.Debug.Assert(listArr.Contains(e2)); UnityEngine.Debug.Assert(listArr.Contains(e3)); UnityEngine.Debug.Assert(listArr.Contains(e4)); UnityEngine.Debug.Assert(listArr.Contains(e5)); CollectionHelpers.CompleteWorld(world); }
public void Add() { var world = CollectionHelpers.PrepareWorld(); var list = new ME.ECS.Collections.IntrusiveHashSetGeneric <Data>(); list.Add(new Data("data1")); list.Add(new Data("data2")); list.Add(new Data("data3")); list.Add(new Data("data4")); list.Add(new Data("data5")); UnityEngine.Debug.Assert(list.Count == 5); CollectionHelpers.CompleteWorld(world); }
public void Contains() { var world = CollectionHelpers.PrepareWorld(); var first = new Data("data1"); var e = new Data("data3"); var notE = new Data("data3.1"); var last = new Data("data5"); var list = new ME.ECS.Collections.IntrusiveHashSetGeneric <Data>(); list.Add(first); list.Add(new Data("data2")); list.Add(e); list.Add(new Data("data4")); list.Add(last); UnityEngine.Debug.Assert(list.Contains(e) == true); UnityEngine.Debug.Assert(list.Contains(notE) == false); CollectionHelpers.CompleteWorld(world); }