예제 #1
0
    def test_converter_macro_collapsing(self):
        converter = TestConfigurationConverter(self._all_test_configurations,
                                               MOCK_MACROS)

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['win', 'release'])])

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('linux32', 'x86', 'release'),
            TestConfiguration('precise', 'x86_64', 'release'),
            TestConfiguration('trusty', 'x86_64', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['win', 'linux', 'release'])])

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('snowleopard', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['win', 'mac', 'release'])])

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('snowleopard', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['win', 'mac', 'release'])])

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['win', 'release'])])
    def test_converter_macro_collapsing(self):
        converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)

        configs_to_match = set(
            [TestConfiguration("vista", "x86", "release"), TestConfiguration("win7", "x86", "release")]
        )
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "release"])])

        configs_to_match = set(
            [
                TestConfiguration("vista", "x86", "release"),
                TestConfiguration("win7", "x86", "release"),
                TestConfiguration("precise", "x86_64", "release"),
                TestConfiguration("trusty", "x86_64", "release"),
            ]
        )
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "linux", "release"])])

        configs_to_match = set(
            [
                TestConfiguration("vista", "x86", "release"),
                TestConfiguration("win7", "x86", "release"),
                TestConfiguration("snowleopard", "x86", "release"),
            ]
        )
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "mac", "release"])])

        configs_to_match = set(
            [
                TestConfiguration("vista", "x86", "release"),
                TestConfiguration("win7", "x86", "release"),
                TestConfiguration("snowleopard", "x86", "release"),
            ]
        )
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "mac", "release"])])

        configs_to_match = set(
            [TestConfiguration("vista", "x86", "release"), TestConfiguration("win7", "x86", "release")]
        )
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win", "release"])])
    def test_converter_macro_collapsing(self):
        converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])])

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('linux32', 'x86', 'release'),
            TestConfiguration('precise', 'x86_64', 'release'),
            TestConfiguration('trusty', 'x86_64', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'linux', 'release'])])

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('snowleopard', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release'])])

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('snowleopard', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release'])])

        configs_to_match = set([
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])])
    def test_to_specifier_lists(self):
        converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)

        self.assertEqual(converter.to_specifiers_list(set(self._all_test_configurations)), [[]])
        self.assertEqual(converter.to_specifiers_list(set()), [])

        configs_to_match = set([TestConfiguration("win7", "x86", "release")])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["release", "win7"])])

        configs_to_match = set([TestConfiguration("win7", "x86", "release"), TestConfiguration("win7", "x86", "debug")])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win7"])])

        configs_to_match = set(
            [
                TestConfiguration("precise", "x86_64", "debug"),
                TestConfiguration("trusty", "x86_64", "debug"),
                TestConfiguration("win7", "x86", "release"),
            ]
        )
        self.assertEqual(
            converter.to_specifiers_list(configs_to_match), [set(["release", "win7"]), set(["debug", "linux"])]
        )

        configs_to_match = set(
            [
                TestConfiguration("win7", "x86", "release"),
                TestConfiguration("win7", "x86", "release"),
                TestConfiguration("trusty", "x86_64", "debug"),
                TestConfiguration("precise", "x86_64", "debug"),
                TestConfiguration("trusty", "x86_64", "debug"),
                TestConfiguration("precise", "x86_64", "debug"),
            ]
        )
        self.assertEqual(
            converter.to_specifiers_list(configs_to_match), [set(["release", "win7"]), set(["debug", "linux"])]
        )

        configs_to_match = set(
            [
                TestConfiguration("win7", "x86", "release"),
                TestConfiguration("snowleopard", "x86", "release"),
                TestConfiguration("vista", "x86", "release"),
                TestConfiguration("precise", "x86_64", "release"),
                TestConfiguration("trusty", "x86_64", "release"),
            ]
        )
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["release"])])

        configs_to_match = set(
            [TestConfiguration("win7", "x86", "release"), TestConfiguration("snowleopard", "x86", "release")]
        )
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(["win7", "mac", "release"])])

        configs_to_match = set(
            [
                TestConfiguration("snowleopard", "x86", "release"),
                TestConfiguration("win7", "x86", "release"),
                TestConfiguration("win7", "x86", "debug"),
                TestConfiguration("trusty", "x86_64", "release"),
            ]
        )
        self.assertEqual(
            converter.to_specifiers_list(configs_to_match), [set(["win7"]), set(["release", "mac", "trusty"])]
        )
    def test_to_specifier_lists(self):
        converter = TestConfigurationConverter(self._all_test_configurations,
                                               MOCK_MACROS)

        self.assertEqual(
            converter.to_specifiers_list(set(self._all_test_configurations)),
            [[]])
        self.assertEqual(converter.to_specifiers_list(set()), [])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['release', 'win7'])])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'debug'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['win7'])])

        configs_to_match = set([
            TestConfiguration('precise', 'x86_64', 'debug'),
            TestConfiguration('trusty', 'x86_64', 'debug'),
            TestConfiguration('win7', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['release', 'win7']),
                          set(['debug', 'linux'])])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('trusty', 'x86_64', 'debug'),
            TestConfiguration('precise', 'x86_64', 'debug'),
            TestConfiguration('trusty', 'x86_64', 'debug'),
            TestConfiguration('precise', 'x86_64', 'debug'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['release', 'win7']),
                          set(['debug', 'linux'])])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('snowleopard', 'x86', 'release'),
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('precise', 'x86_64', 'release'),
            TestConfiguration('trusty', 'x86_64', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['release'])])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('snowleopard', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['win7', 'mac', 'release'])])

        configs_to_match = set([
            TestConfiguration('snowleopard', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'debug'),
            TestConfiguration('trusty', 'x86_64', 'release'),
        ])
        self.assertEqual(
            converter.to_specifiers_list(configs_to_match),
            [set(['win7']), set(['release', 'mac', 'trusty'])])
    def test_to_specifier_lists(self):
        converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)

        self.assertEqual(converter.to_specifiers_list(set(self._all_test_configurations)), [[]])
        self.assertEqual(converter.to_specifiers_list(set()), [])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['release', 'win7'])])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'debug'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win7'])])

        configs_to_match = set([
            TestConfiguration('linux32', 'x86', 'debug'),
            TestConfiguration('precise', 'x86_64', 'debug'),
            TestConfiguration('trusty', 'x86_64', 'debug'),
            TestConfiguration('win7', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['release', 'win7']), set(['debug', 'linux'])])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('trusty', 'x86_64', 'debug'),
            TestConfiguration('precise', 'x86_64', 'debug'),
            TestConfiguration('linux32', 'x86', 'debug'),
            TestConfiguration('trusty', 'x86_64', 'debug'),
            TestConfiguration('precise', 'x86_64', 'debug'),
            TestConfiguration('linux32', 'x86', 'debug'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['release', 'win7']), set(['debug', 'linux'])])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('snowleopard', 'x86', 'release'),
            TestConfiguration('vista', 'x86', 'release'),
            TestConfiguration('linux32', 'x86', 'release'),
            TestConfiguration('precise', 'x86_64', 'release'),
            TestConfiguration('trusty', 'x86_64', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['release'])])

        configs_to_match = set([
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('snowleopard', 'x86', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win7', 'mac', 'release'])])

        configs_to_match = set([
            TestConfiguration('snowleopard', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'release'),
            TestConfiguration('win7', 'x86', 'debug'),
            TestConfiguration('trusty', 'x86_64', 'release'),
        ])
        self.assertEqual(converter.to_specifiers_list(configs_to_match),
                         [set(['win7']), set(['release', 'mac', 'trusty'])])