public void TestExistingSingle() { ExactSearch <Vector> es = new ExactSearch <Vector>(_tree.Root); Assert.AreSame(_vecs[2], Numbered.First(es.FindExact(Vector.Create(-2.0, 3.0)))); Assert.AreEqual(_vecs[2], Numbered.First(es.FindExact(Vector.Create(-2.0, 3.0)))); }
public void TestNonExisting() { ExactSearch <Vector> es = new ExactSearch <Vector>(_tree.Root); List <Vector> elements = new List <Vector>(es.FindExact(Vector.Create(4.0, 6.0))); Assert.AreEqual(0, elements.Count); }
public void TestLimitResultset() { ExactSearch <Vector> es = new ExactSearch <Vector>(_tree.Root); es.CountLimit = 2; List <Vector> elements = new List <Vector>(es.FindExact(Vector.Create(1.0, 5.0))); Assert.AreEqual(2, elements.Count); }
public void TestExistingDuplicates() { ExactSearch <Vector> es = new ExactSearch <Vector>(_tree.Root); IEnumerable <Vector> en = es.FindExact(Vector.Create(1.0, 5.0)); Assert.IsTrue(VectorComparison.Equal(Numbered.First(en), Vector.Create(1.0, 5.0))); Assert.IsTrue(VectorComparison.Equal(Numbered.Second(en), Vector.Create(1.0, 5.0))); Assert.IsTrue(VectorComparison.Equal(Numbered.Third(en), Vector.Create(1.0, 5.0))); }