public void TestUrlLookup()
        {
            foreach (string Url in this.DistinctUrls)
            {
                MacroscopeUrlLookup.Lookup(Url: Url);
            }

            foreach (string Url in this.RandomizedUrls.Keys)
            {
                ulong value     = MacroscopeUrlLookup.Lookup(Url: Url);
                ulong found     = 0;
                bool  not_found = true;

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

                Assert.IsFalse(not_found);
                Assert.AreEqual(value, found);
            }
        }
        /**************************************************************************/

        public TestMacroscopeUrlLookup()
        {
            MacroscopeUrlLookup.Clear();

            Faker fake = new Faker();

            this.Urls           = new List <string>();
            this.RandomizedUrls = new Dictionary <string, bool>();

            for (int i = 0; i < this.MaxUrls; i++)
            {
                Urls.Add(fake.Internet.UrlWithPath());
            }

            this.DistinctUrls = Urls.Distinct().ToList();

            foreach (string Url in this.DistinctUrls)
            {
                this.RandomizedUrls.Add(Url, true);
            }
        }
Beispiel #3
0
        /** Global URL to Digest Routines *****************************************/

        public static ulong UrlToDigest(string Url)
        {
            ulong value = MacroscopeUrlLookup.Lookup(Url: Url);

            return(value);
        }