private void Get(Key key) { policy.filterExp = Exp.Build( Exp.NE( BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)), BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)), BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)))); r = client.Get(policy, key); AssertRecordFound(key, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)), Exp.Val(new byte[] { 0x03 }))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void GetInt(Key key) { policy.filterExp = Exp.Build( Exp.NE( BitExp.GetInt(Exp.Val(32), Exp.Val(8), true, Exp.BlobBin(binA)), Exp.Val(0x05))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.GetInt(Exp.Val(32), Exp.Val(8), true, Exp.BlobBin(binA)), Exp.Val(0x05))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void SetInt(Key key) { policy.filterExp = Exp.Build( Exp.NE( BitExp.Get(Exp.Val(24), Exp.Val(8), BitExp.SetInt(BitPolicy.Default, Exp.Val(24), Exp.Val(8), Exp.Val(0x42), Exp.BlobBin(binA))), BitExp.Get(Exp.Val(8), Exp.Val(8), Exp.BlobBin(binA)))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.Get(Exp.Val(24), Exp.Val(8), BitExp.SetInt(BitPolicy.Default, Exp.Val(24), Exp.Val(8), Exp.Val(0x42), Exp.BlobBin(binA))), BitExp.Get(Exp.Val(8), Exp.Val(8), Exp.BlobBin(binA)))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void Subtract(Key key) { policy.filterExp = Exp.Build( Exp.NE( BitExp.Get(Exp.Val(24), Exp.Val(8), BitExp.Subtract(BitPolicy.Default, Exp.Val(24), Exp.Val(8), Exp.Val(1), false, BitOverflowAction.FAIL, Exp.BlobBin(binA))), BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.Get(Exp.Val(24), Exp.Val(8), BitExp.Subtract(BitPolicy.Default, Exp.Val(24), Exp.Val(8), Exp.Val(1), false, BitOverflowAction.FAIL, Exp.BlobBin(binA))), BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void Resize(Key key) { Exp size = Exp.Val(6); policy.filterExp = Exp.Build( Exp.NE( BitExp.Resize(BitPolicy.Default, size, 0, Exp.BlobBin(binA)), BitExp.Resize(BitPolicy.Default, size, 0, Exp.BlobBin(binA)))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.Resize(BitPolicy.Default, size, 0, Exp.BlobBin(binA)), BitExp.Resize(BitPolicy.Default, size, 0, Exp.BlobBin(binA)))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void And(Key key) { byte[] bytes = new byte[] { (byte)0x01 }; policy.filterExp = Exp.Build( Exp.NE( BitExp.Get(Exp.Val(0), Exp.Val(8), BitExp.And(BitPolicy.Default, Exp.Val(16), Exp.Val(8), Exp.Val(bytes), Exp.BlobBin(binA))), BitExp.Get(Exp.Val(0), Exp.Val(8), Exp.BlobBin(binA)))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.Get(Exp.Val(0), Exp.Val(8), BitExp.And(BitPolicy.Default, Exp.Val(16), Exp.Val(8), Exp.Val(bytes), Exp.BlobBin(binA))), BitExp.Get(Exp.Val(0), Exp.Val(8), Exp.BlobBin(binA)))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void Remove(Key key) { int expected = 0x42; policy.filterExp = Exp.Build( Exp.NE( BitExp.GetInt(Exp.Val(0), Exp.Val(8), false, BitExp.Remove(BitPolicy.Default, Exp.Val(0), Exp.Val(1), Exp.BlobBin(binA))), Exp.Val(expected))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.GetInt(Exp.Val(0), Exp.Val(8), false, BitExp.Remove(BitPolicy.Default, Exp.Val(0), Exp.Val(1), Exp.BlobBin(binA))), Exp.Val(expected))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void Insert(Key key) { byte[] bytes = new byte[] { (byte)0xff }; int expected = 0xff; policy.filterExp = Exp.Build( Exp.NE( BitExp.GetInt(Exp.Val(8), Exp.Val(8), false, BitExp.Insert(BitPolicy.Default, Exp.Val(1), Exp.Val(bytes), Exp.BlobBin(binA))), Exp.Val(expected))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( BitExp.GetInt(Exp.Val(8), Exp.Val(8), false, BitExp.Insert(BitPolicy.Default, Exp.Val(1), Exp.Val(bytes), Exp.BlobBin(binA))), Exp.Val(expected))); r = client.Get(policy, key); AssertRecordFound(key, r); }