Exemplo n.º 1
0
        public void TestLongBothEndpointsIncluded()
        {
            FilterParamIndexDoubleRange index = GetLongDataset(FilterOperator.RANGE_CLOSED);

            VerifyLongPrimitive(index, -1, 0);
            VerifyLongPrimitive(index, 0, 2);
            VerifyLongPrimitive(index, 1, 5);
            VerifyLongPrimitive(index, 2, 5);
            VerifyLongPrimitive(index, 3, 7);
            VerifyLongPrimitive(index, 4, 6);
            VerifyLongPrimitive(index, 5, 6);
            VerifyLongPrimitive(index, 6, 6);
            VerifyLongPrimitive(index, 7, 6);
            VerifyLongPrimitive(index, 8, 6);
            VerifyLongPrimitive(index, 9, 5);
            VerifyLongPrimitive(index, 10, 3);
            VerifyLongPrimitive(index, 11, 1);

            index.Put(_testRange, _testEvaluator);
            Assert.AreEqual(_testEvaluator, index.Get(_testRange));
            Assert.IsTrue(index.ReadWriteLock != null);
            Assert.IsTrue(index.Remove(_testRange));
            Assert.IsFalse(index.Remove(_testRange));
            Assert.AreEqual(null, index.Get(_testRange));

            try
            {
                index["a"] = _testEvaluator;
                Assert.IsTrue(false);
            }
            catch (ArgumentException ex)
            {
                // Expected
            }
        }
Exemplo n.º 2
0
        public void TestDoubleFixedRangeSize()
        {
            FilterParamIndexDoubleRange index = MakeOne("DoublePrimitive", FilterOperator.RANGE_OPEN, _testEventType);

            for (int i = 0; i < 10000; i++)
            {
                var range = new DoubleRange(i, i + 1);
                index.Put(range, _testEvaluator);
            }

            VerifyDoublePrimitive(index, 5000, 0);
            VerifyDoublePrimitive(index, 5000.5, 1);
            VerifyDoublePrimitive(index, 5001, 0);
        }
Exemplo n.º 3
0
        public void TestDoubleVariableRangeSize()
        {
            FilterParamIndexDoubleRange index = MakeOne("DoublePrimitive", FilterOperator.RANGE_CLOSED, _testEventType);

            for (int i = 0; i < 100; i++)
            {
                var range = new DoubleRange(i, 2 * i);
                index.Put(range, _testEvaluator);
            }

            // 1 to 2
            // 2 to 4
            // 3 to 6
            // and so on

            VerifyDoublePrimitive(index, 1, 1);
            VerifyDoublePrimitive(index, 2, 2);
            VerifyDoublePrimitive(index, 2.001, 1);
            VerifyDoublePrimitive(index, 3, 2);
            VerifyDoublePrimitive(index, 4, 3);
            VerifyDoublePrimitive(index, 4.5, 2);
            VerifyDoublePrimitive(index, 50, 26);
        }
Exemplo n.º 4
0
        private void AddToIndex(FilterParamIndexDoubleRange index, double min, double max)
        {
            var r = new DoubleRange(min, max);

            index.Put(r, _testEvaluator);
        }