コード例 #1
0
    def test_intersection3(self):
        a = HashSet()
        b = HashSet()
        c = HashSet()
        for i in range(1000):
            a.insert(i)
            a.insert(i)

        for i in range(500, 1000):
            b.insert(i)
            b.insert(i)
            b.insert(i)

        for i in range(600, 700):
            c.insert(i)
            c.insert(i)
            c.insert(i)
            c.insert(i)

        b.intersection(c)
        a.intersection(b)
        for i in range(600):
            self.assertEqual(a.getCount(i), 0)
        for i in range(600, 700):
            self.assertEqual(a.getCount(i), 2)
        for i in range(700, 1000):
            self.assertEqual(a.getCount(i), 0)
コード例 #2
0
    def test_intersection1(self):
        a = HashSet()
        b = HashSet()
        for i in range(1000):
            a.insert(i)

        for i in range(1000, 2000):
            b.insert(i)

        a.intersection(b)
        for i in range(2000):
            self.assertEqual(a.getCount(i), 0)