def test_adscastk_youtube(self):
        import csv
        c = AdaptiveDataStreamCachingAlgorithmWithStaticTopKCache(1000, monitored=2000, window_size=2000)
        cache_hits = 0
        contents = 0

        with open('../../../resources/UMass_YouTube_traces/YouTube_Trace_7days_reformatted.trace', 'r') as csv_file:
            csv_reader = csv.reader(csv_file)
            for row in csv_reader:
                contents += 1
                content = int(row[2])

                if c.get(content):
                    cache_hits += 1
                else:
                    c.put(content)

        self.assertListEqual([contents, cache_hits], [258673, 35758])
    def test_adscastk_ibm(self):
        import csv
        c = AdaptiveDataStreamCachingAlgorithmWithStaticTopKCache(500, monitored=1000, window_size=1000)
        cache_hits = 0
        contents = 0

        with open('../../../resources/IBM_traces/anon-url-trace_reformatted.trace', 'r') as csv_file:
            csv_reader = csv.reader(csv_file)
            for row in csv_reader:
                contents += 1
                content = int(row[2])

                if c.get(content):
                    cache_hits += 1
                else:
                    c.put(content)

        self.assertListEqual([contents, cache_hits], [8626163, 2889917])
    def test_adscastk_youtube(self):
        import csv
        c = AdaptiveDataStreamCachingAlgorithmWithStaticTopKCache(
            1000, monitored=2000, window_size=2000)
        cache_hits = 0
        contents = 0

        with open(
                '../../../resources/UMass_YouTube_traces/YouTube_Trace_7days_reformatted.trace',
                'r') as csv_file:
            csv_reader = csv.reader(csv_file)
            for row in csv_reader:
                contents += 1
                content = int(row[2])

                if c.get(content):
                    cache_hits += 1
                else:
                    c.put(content)

        self.assertListEqual([contents, cache_hits], [258673, 35758])
    def test_adscastk_ibm(self):
        import csv
        c = AdaptiveDataStreamCachingAlgorithmWithStaticTopKCache(
            500, monitored=1000, window_size=1000)
        cache_hits = 0
        contents = 0

        with open(
                '../../../resources/IBM_traces/anon-url-trace_reformatted.trace',
                'r') as csv_file:
            csv_reader = csv.reader(csv_file)
            for row in csv_reader:
                contents += 1
                content = int(row[2])

                if c.get(content):
                    cache_hits += 1
                else:
                    c.put(content)

        self.assertListEqual([contents, cache_hits], [8626163, 2889917])