public void ContainsTest() { const Int32 count = 1000000; // generate ip var ipArray = new UInt32[count]; for (var index = 0; index < count; index++) { ipArray[index] = (UInt32)random.Next(); } var resultArray = new Boolean[count]; var testResult = LoadTest.Execute ( "ContainsTest", index => { var ipAddress = ipArray[index]; resultArray[index] = geolocationTree.Contains(ipAddress); }, count ); Trace.WriteLine(testResult.ToString()); Trace.TraceInformation("Result is {0} hits and {1} misses", resultArray.Count(x => x), resultArray.Count(x => x == false)); }
public void AddCountContainsTest() { // Test Count Assert.AreEqual(intValidArray.Length, intArneTree.Count); // Test Contains for (var index = 0; index < intValidArray.Length; index++) { var item = intValidArray[index]; var contains = intArneTree.Contains(item); Assert.IsTrue(contains); } // Test Not Contains foreach (var contains in intInvalidArray.Select(value => intArneTree.Contains(value))) { Assert.IsFalse(contains); } }