public void AssertSimilarityOp(double overlap, IList common, IList <IList> vals, int index_bits, int minhash_bits) { IList <Value.HLLValue> hlls = new List <Value.HLLValue>(); for (int i = 0; i < keys.Length; i++) { Record record = AssertSuccess("init other keys", keys[i], Operation.Delete(), HLLOperation.Add(HLLPolicy.Default, binName, vals[i], index_bits, minhash_bits), HLLOperation.Add(HLLPolicy.Default, binName, common, index_bits, minhash_bits), Operation.Get(binName) ); IList result_list = record.GetList(binName); hlls.Add((Value.HLLValue)result_list[2]); } // Keep record around win binName is removed. Record r = AssertSuccess("other bin", key, Operation.Delete(), HLLOperation.Init(HLLPolicy.Default, binName + "other", index_bits, minhash_bits), HLLOperation.SetUnion(HLLPolicy.Default, binName, hlls), HLLOperation.Describe(binName) ); IList rlist = r.GetList(binName); IList description = (IList)rlist[1]; AssertDescription("check desc", description, index_bits, minhash_bits); r = AssertSuccess("similarity and intersect_count", key, HLLOperation.GetSimilarity(binName, hlls), HLLOperation.GetIntersectCount(binName, hlls) ); rlist = r.GetList(binName); double sim = (double)rlist[0]; long intersect_count = (long)rlist[1]; double expected_similarity = overlap; long expected_intersect_count = common.Count; AssertHMHSimilarity("check sim", index_bits, minhash_bits, sim, expected_similarity, intersect_count, expected_intersect_count); }