public void TestMatchLongAndGreaterEquals() { FilterParamIndexCompare index = MakeOne("LongBoxed", FilterOperator.GREATER_OR_EQUAL); index.Put(1L, _testEvaluator); index.Put(2L, _testEvaluator); index.Put(4L, _testEvaluator); // Should not match with null VerifyLongBoxed(index, null, 0); VerifyLongBoxed(index, 0L, 0); VerifyLongBoxed(index, 1L, 1); VerifyLongBoxed(index, 2L, 2); VerifyLongBoxed(index, 3L, 2); VerifyLongBoxed(index, 4L, 3); VerifyLongBoxed(index, 10L, 3); // Put a long primitive in - should work index.Put(9l, _testEvaluator); try { index.Put(10, _testEvaluator); Assert.IsTrue(false); } catch (InvalidOperationException ex) { Assert.That(ex.InnerException, Is.InstanceOf <ArgumentException>()); } }
public void TestMatchDoubleAndGreater() { FilterParamIndexCompare index = MakeOne("DoublePrimitive", FilterOperator.GREATER); index.Put(1.5, _testEvaluator); index.Put(2.1, _testEvaluator); index.Put(2.2, _testEvaluator); VerifyDoublePrimitive(index, 1.5, 0); VerifyDoublePrimitive(index, 1.7, 1); VerifyDoublePrimitive(index, 2.2, 2); VerifyDoublePrimitive(index, 2.1999999, 2); VerifyDoublePrimitive(index, -1, 0); VerifyDoublePrimitive(index, 99, 3); Assert.AreEqual(_testEvaluator, index.Get(1.5d)); Assert.IsTrue(index.ReadWriteLock != null); Assert.IsTrue(index.Remove(1.5d)); Assert.IsFalse(index.Remove(1.5d)); Assert.AreEqual(null, index.Get(1.5d)); try { index["a"] = _testEvaluator; Assert.IsTrue(false); } catch (InvalidOperationException ex) { Assert.That(ex.InnerException, Is.InstanceOf <ArgumentException>()); } }
public void TestMatchDoubleAndLessOrEqualThan() { FilterParamIndexCompare index = MakeOne("DoubleBoxed", FilterOperator.LESS_OR_EQUAL); index.Put(7.4D, _testEvaluator); index.Put(7.5D, _testEvaluator); index.Put(7.6D, _testEvaluator); VerifyDoubleBoxed(index, 7.39, 3); VerifyDoubleBoxed(index, 7.4, 3); VerifyDoubleBoxed(index, 7.41, 2); VerifyDoubleBoxed(index, 7.5, 2); VerifyDoubleBoxed(index, 7.51, 1); VerifyDoubleBoxed(index, 7.6, 1); VerifyDoubleBoxed(index, 7.61, 0); }
public void TestMatchLongAndLessThan() { FilterParamIndexCompare index = MakeOne("LongPrimitive", FilterOperator.LESS); index.Put(1L, _testEvaluator); index.Put(10L, _testEvaluator); index.Put(100L, _testEvaluator); VerifyLongPrimitive(index, 100, 0); VerifyLongPrimitive(index, 101, 0); VerifyLongPrimitive(index, 99, 1); VerifyLongPrimitive(index, 11, 1); VerifyLongPrimitive(index, 10, 1); VerifyLongPrimitive(index, 9, 2); VerifyLongPrimitive(index, 2, 2); VerifyLongPrimitive(index, 1, 2); VerifyLongPrimitive(index, 0, 3); }