void ReadWorker() { var session = fht.NewSession(); Key key = new Key { key = 0 }; int old = 0; int read = 0; begin = true; while (tick < UpdateNumber * UpdateCount) { Input input = default(Input); LargeOutput output = new LargeOutput(); session.Read(ref key, ref input, ref output, Empty.Default, 1); long df = BitConverter.ToInt64(output.value.value, 0); if (tick - old < UpdateNumber * UpdateCount / ReadCount) { continue; } old = tick; if (read % 8 == 0) { TestContext.WriteLine(); } TestContext.Write(read + ":" + df + "\t"); for (int j = 0; j < 64; j += sizeof(long)) { long v = BitConverter.ToInt64(output.value.value, j); Assert.AreEqual(v, df); } read++; } session.Dispose(); }
public void SingleUpsert() { UpsertWorker(); var session = fht.NewSession(); int iv = 10; Console.WriteLine(sizeof(int) + ":" + sizeof(long) + ":" + sizeof(short) + ":" + sizeof(byte)); Assert.AreEqual(iv, 10); Assert.AreEqual(sizeof(int), 4); Assert.AreEqual(sizeof(long), 8); Assert.AreEqual(sizeof(short), 2); Assert.AreEqual(sizeof(byte), 1); Key key = new Key { key = -1231 }; LargeValue value = new LargeValue(8); session.Upsert(ref key, ref value, Empty.Default, 1); LargeValue value1 = new LargeValue(13212, 64); session.Upsert(ref key, ref value1, Empty.Default, 1); Input input = default(Input); LargeOutput output = new LargeOutput(); session.Read(ref key, ref input, ref output, Empty.Default, 1); for (int i = 0; i < 64; i += sizeof(long)) { long v = BitConverter.ToInt64(output.value.value, i); Assert.AreEqual(v, 13212); } DeleteWorker(ref session); session.Dispose(); }