📄 testenumerator.cs
字号:
foreach (Record rec in intIndex.Range(fromInclusive, null, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = intIndex.Get(fromExclusive, null);
j = records.Length;
foreach (Record rec in intIndex.Range(fromExclusive, null, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = intIndex.Get(null, tillInclusive);
j = records.Length;
foreach (Record rec in intIndex.Range(null, tillInclusive, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = intIndex.Get(null, tillExclusive);
j = records.Length;
foreach (Record rec in intIndex.Range(null, tillExclusive, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = intIndex.ToArray();
j = records.Length;
foreach (Record rec in intIndex.Reverse())
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
// str key ascent order
records = strIndex.Get(fromInclusiveStr, tillInclusiveStr);
j = 0;
foreach (Record rec in strIndex.Range(fromInclusiveStr, tillInclusiveStr, IterationOrder.AscentOrder))
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
records = strIndex.Get(fromInclusiveStr, tillExclusiveStr);
j = 0;
foreach (Record rec in strIndex.Range(fromInclusiveStr, tillExclusiveStr, IterationOrder.AscentOrder))
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
records = strIndex.Get(fromExclusiveStr, tillInclusiveStr);
j = 0;
foreach (Record rec in strIndex.Range(fromExclusiveStr, tillInclusiveStr, IterationOrder.AscentOrder))
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
records = strIndex.Get(fromExclusiveStr, tillExclusiveStr);
j = 0;
foreach (Record rec in strIndex.Range(fromExclusiveStr, tillExclusiveStr, IterationOrder.AscentOrder))
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
records = strIndex.Get(fromInclusiveStr, null);
j = 0;
foreach (Record rec in strIndex.Range(fromInclusiveStr, null, IterationOrder.AscentOrder))
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
records = strIndex.Get(fromExclusiveStr, null);
j = 0;
foreach (Record rec in strIndex.Range(fromExclusiveStr, null, IterationOrder.AscentOrder))
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
records = strIndex.Get(null, tillInclusiveStr);
j = 0;
foreach (Record rec in strIndex.Range(null, tillInclusiveStr, IterationOrder.AscentOrder))
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
records = strIndex.Get(null, tillExclusiveStr);
j = 0;
foreach (Record rec in strIndex.Range(null, tillExclusiveStr, IterationOrder.AscentOrder))
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
records = strIndex.ToArray();
j = 0;
foreach (Record rec in strIndex)
{
Debug.Assert(rec == records[j++]);
}
Debug.Assert(j == records.Length);
// str key descent order
records = strIndex.Get(fromInclusiveStr, tillInclusiveStr);
j = records.Length;
foreach (Record rec in strIndex.Range(fromInclusiveStr, tillInclusiveStr, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = strIndex.Get(fromInclusiveStr, tillExclusiveStr);
j = records.Length;
foreach (Record rec in strIndex.Range(fromInclusiveStr, tillExclusiveStr, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = strIndex.Get(fromExclusiveStr, tillInclusiveStr);
j = records.Length;
foreach (Record rec in strIndex.Range(fromExclusiveStr, tillInclusiveStr, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = strIndex.Get(fromExclusiveStr, tillExclusiveStr);
j = records.Length;
foreach (Record rec in strIndex.Range(fromExclusiveStr, tillExclusiveStr, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = strIndex.Get(fromInclusiveStr, null);
j = records.Length;
foreach (Record rec in strIndex.Range(fromInclusiveStr, null, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = strIndex.Get(fromExclusiveStr, null);
j = records.Length;
foreach (Record rec in strIndex.Range(fromExclusiveStr, null, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = strIndex.Get(null, tillInclusiveStr);
j = records.Length;
foreach (Record rec in strIndex.Range(null, tillInclusiveStr, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = strIndex.Get(null, tillExclusiveStr);
j = records.Length;
foreach (Record rec in strIndex.Range(null, tillExclusiveStr, IterationOrder.DescentOrder))
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
records = strIndex.ToArray();
j = records.Length;
foreach (Record rec in strIndex.Reverse())
{
Debug.Assert(rec == records[--j]);
}
Debug.Assert(j == 0);
if (i % 100 == 0) {
Console.Write("Iteration " + i + "\n");
}
}
Console.WriteLine("\nElapsed time for performing " + nRecords*36 + " index range searches: "
+ (DateTime.Now - start));
strIndex.Clear();
intIndex.Clear();
Debug.Assert(!strIndex.GetEnumerator().MoveNext());
Debug.Assert(!intIndex.GetEnumerator().MoveNext());
Debug.Assert(!strIndex.Reverse().GetEnumerator().MoveNext());
Debug.Assert(!intIndex.Reverse().GetEnumerator().MoveNext());
db.Commit();
db.Gc();
db.Close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -