public void InsertCase3() { UnsafeOrderedCollection *t; t = Tree(_insertCase3); AssertTree(t, "20L=[4=[3L=2|*]|[9=7|11]]|[26=21|30]"); UnsafeOrderedCollection.Insert(t, 15); AssertTree(t, "9=[4L=[3L=2|*]|7]|[20=[11R=*|15]|[26=21|30]]"); t = Tree(_insertCase3); AssertTree(t, "20L=[4=[3L=2|*]|[9=7|11]]|[26=21|30]"); UnsafeOrderedCollection.Insert(t, 8); AssertTree(t, "9=[4=[3L=2|*]|[7R=*|8]]|[20R=11|[26=21|30]]"); }
public static bool Contains <T>(UnsafeOrderedSet *set, T item) where T : unmanaged, IComparable <T> { return(UnsafeOrderedCollection.Find <T>(&set->_collection, item) != null); }
public static void Remove <T>(UnsafeOrderedSet *set, T item) where T : unmanaged, IComparable <T> { UnsafeOrderedCollection.Remove <T>(&set->_collection, item); }
public static int Count(UnsafeOrderedSet *set) { return(UnsafeOrderedCollection.Count(&set->_collection)); }
static void AssertTree(UnsafeOrderedCollection *c, string expected) { NUnit.Framework.Assert.AreEqual(expected, UnsafeOrderedCollection.PrintTree <int>(c, Print)); }