static void TestBlum(string path) { var buf = File.ReadAllBytes(path); var tests = LoadTestFiles(spath_tests_folder); // load int maxStringLen = BitConverter.ToInt32(DataPack.Unpack(buf, 0), 0); //int count = BitConverter.ToInt32(DataPack.Unpack(buf, 0),sizeof(int)); int filterBufLen = BitConverter.ToInt32(DataPack.Unpack(buf, 0), sizeof(int)); byte[] arr = DataPack.Unpack(buf, 1); var excs2 = SplitString(ASCIIEncoding.ASCII.GetString(DataPack.Unpack(buf, 2))); var ends = SplitString(ASCIIEncoding.ASCII.GetString(DataPack.Unpack(buf, 3))); var d2b = SplitString(ASCIIEncoding.ASCII.GetString(DataPack.Unpack(buf, 4))); var bf = new BlumFilter(filterBufLen); bf.SetArray(arr); var flt = new PreFilter(excs2, ends, d2b, maxStringLen); int errcount = 0; foreach (var t in tests) { bool isWord = false; var s = t.Key.ToLower().Trim(); string sb; var sf = flt.WordStatus(s, out sb); if (sf == 0) { isWord = false; } else if (sf == 1) { isWord = true; } else { isWord = bf.Contains(sb); } if (isWord && !t.Value) { errcount++; } if (!isWord && t.Value) { errcount++; } } Console.WriteLine("Errors:{0} from {1}, {2}", errcount, tests.Count, (float)errcount / (float)(tests.Count) * 100.0F); }