private static void checkLE(IndexBase indexByValue) { var keyType = new KeyInfo(KeyDataType.IntKey, KeyType.ScalarIndex, "test", true); //non existent value in the middle { var result1 = indexByValue.GetMany(MakeIntValue(12, keyType), QueryOperator.Le); Assert.AreEqual(result1.Count, 3); var count = indexByValue.GetCount(MakeIntValue(12, keyType), QueryOperator.Le); Assert.AreEqual(count, 3); } //existent value in the middle { var result1 = indexByValue.GetMany(MakeIntValue(13, keyType), QueryOperator.Le); Assert.AreEqual(result1.Count, 4); var count = indexByValue.GetCount(MakeIntValue(13, keyType), QueryOperator.Le); Assert.AreEqual(count, 4); } //value < all { var result1 = indexByValue.GetMany(MakeIntValue(0, keyType), QueryOperator.Le); Assert.AreEqual(result1.Count, 0); var count = indexByValue.GetCount(MakeIntValue(0, keyType), QueryOperator.Le); Assert.AreEqual(count, 0); } //value > all { var result1 = indexByValue.GetMany(MakeIntValue(99, keyType), QueryOperator.Le); Assert.AreEqual(result1.Count, 6); var count = indexByValue.GetCount(MakeIntValue(99, keyType), QueryOperator.Le); Assert.AreEqual(count, 6); } //first value { var result1 = indexByValue.GetMany(MakeIntValue(1, keyType), QueryOperator.Le).OrderBy(o => o.PrimaryKey) .ToList(); Assert.AreEqual(result1.Count, 1); Assert.AreEqual(result1[0].PrimaryKey.ToString(), "#1"); var count = indexByValue.GetCount(MakeIntValue(1, keyType), QueryOperator.Le); Assert.AreEqual(count, 1); } }
private static void CheckLs(IndexBase indexByValue) { var keyType = new KeyInfo("IndexKeyValue", 0, IndexType.Ordered); //non existent value in the middle { IList <PackedObject> result1 = indexByValue.GetMany(MakeIntValue(12, keyType), QueryOperator.Lt) .OrderBy(o => o.PrimaryKey) .ToList(); Assert.AreEqual(result1.Count, 3); Assert.AreEqual(result1[0].PrimaryKey.ToString(), "1"); Assert.AreEqual(result1[1].PrimaryKey.ToString(), "2"); Assert.AreEqual(result1[2].PrimaryKey.ToString(), "3"); var count = indexByValue.GetCount(MakeIntValue(12, keyType), QueryOperator.Lt); Assert.AreEqual(count, 3); } //existent value in the middle { IList <PackedObject> result1 = indexByValue.GetMany(MakeIntValue(13, keyType), QueryOperator.Lt) .OrderBy(o => o.PrimaryKey) .ToList(); Assert.AreEqual(result1.Count, 3); Assert.AreEqual(result1[2].PrimaryKey.ToString(), "3"); var count = indexByValue.GetCount(MakeIntValue(12, keyType), QueryOperator.Lt); Assert.AreEqual(count, 3); } //value < all { IList <PackedObject> result1 = indexByValue.GetMany(MakeIntValue(0, keyType), QueryOperator.Lt).OrderBy(o => o.PrimaryKey) .ToList(); Assert.AreEqual(result1.Count, 0); var count = indexByValue.GetCount(MakeIntValue(0, keyType), QueryOperator.Lt); Assert.AreEqual(count, 0); } //value > all { IList <PackedObject> result1 = indexByValue.GetMany(MakeIntValue(99, keyType), QueryOperator.Lt) .OrderBy(o => o.PrimaryKey) .ToList(); Assert.AreEqual(result1.Count, 6); var count = indexByValue.GetCount(MakeIntValue(99, keyType), QueryOperator.Lt); Assert.AreEqual(count, 6); } //first value { IList <PackedObject> result1 = indexByValue.GetMany(MakeIntValue(1, keyType), QueryOperator.Lt).OrderBy(o => o.PrimaryKey) .ToList(); Assert.AreEqual(result1.Count, 0); var count = indexByValue.GetCount(MakeIntValue(1, keyType), QueryOperator.Lt); Assert.AreEqual(count, 0); } }