示例#1
0
        public void TestStringLookup()
        {
            foreach (string Text in this.DistinctTexts)
            {
                MacroscopeStringLookup.Lookup(Text: Text);
            }

            foreach (string Text in this.RandomizedTexts.Keys)
            {
                ulong value     = MacroscopeStringLookup.Lookup(Text: Text);
                ulong found     = 0;
                bool  not_found = true;

                for (int k = 0; k < this.DistinctTexts.Count(); k++)
                {
                    if (this.DistinctTexts[k] == Text)
                    {
                        found     = (ulong)k;
                        not_found = false;
                        break;
                    }
                    else
                    {
                        not_found = true;
                    }
                }

                Assert.IsFalse(not_found);
                Assert.AreEqual(value, found);
            }
        }
示例#2
0
        /**************************************************************************/

        public TestMacroscopeStringLookup()
        {
            MacroscopeStringLookup.Clear();

            Faker fake = new Faker();

            this.Texts           = new List <string>();
            this.RandomizedTexts = new Dictionary <string, bool>();

            for (int i = 0; i < this.MaxTexts; i++)
            {
                Texts.Add(fake.Lorem.Sentence());
            }

            this.DistinctTexts = Texts.Distinct().ToList();

            foreach (string Text in this.DistinctTexts)
            {
                this.RandomizedTexts.Add(Text, true);
            }
        }
示例#3
0
        /** Text Numeeric Digest **************************************************/

        public static ulong StringToDigest(string Text)
        {
            ulong value = MacroscopeStringLookup.Lookup(Text: Text);

            return(value);
        }