Exemplo n.º 1
0
 def test_slice_symbols(self):
     model = RsfModel(self.model_file.name)
     self.assertEqual(set(model.slice_symbols(["CONFIG_B1"])),
                      set(["CONFIG_B1"]))
     self.assertEqual(set(model.slice_symbols(["CONFIG_B2"])),
                      set(["CONFIG_B2"]))
     self.assertEqual(
         set(model.slice_symbols(["CONFIG_B3"])),
         set([
             "CONFIG_B3", "CONFIG_T2", "CONFIG_FOO", "CONFIG_BAR",
             "CONFIG_T2_MODULE", "CONFIG_MODULES"
         ]))
     self.assertEqual(set(model.slice_symbols(["CONFIG_B4"])),
                      set(["CONFIG_B4", "CONFIG_T1"]))
     self.assertEqual(set(model.slice_symbols(["CONFIG_T1"])),
                      set(["CONFIG_T1"]))
     self.assertEqual(
         set(model.slice_symbols(["CONFIG_T2"])),
         set([
             "CONFIG_T2", "CONFIG_T2_MODULE", "CONFIG_FOO", "CONFIG_BAR",
             "CONFIG_MODULES"
         ]))
     self.assertEqual(
         set(model.slice_symbols(["CONFIG_T2_MODULE"])),
         set([
             "CONFIG_T2_MODULE", "CONFIG_T2", "CONFIG_BAR",
             "CONFIG_MODULES", "CONFIG_FOO"
         ]))
Exemplo n.º 2
0
    def test_symbol_always_off(self):
        model = RsfModel(self.model_file.name)
        for symbol in ("CONFIG_B1", "B2", "CONFIG_B2"):
            self.assertNotIn(symbol, model.always_off_items)

        for symbol in ("CONFIG_B3", "CONFIG_B5"):
            self.assertIn(symbol, model.always_off_items)
Exemplo n.º 3
0
 def test_mentioned_items(self):
     model = RsfModel(self.model_file.name)
     self.assertEqual(model.mentioned_items("CONFIG_T1"), [])
     self.assertEqual(model.mentioned_items("CONFIG_FOO"), [])
     self.assertEqual(model.mentioned_items("CONFIG_B4"), ["CONFIG_T1"])
     self.assertEqual(set(model.mentioned_items("CONFIG_B3")),
                      set(["CONFIG_T2", "CONFIG_FOO", "CONFIG_BAR"]))
     self.assertEqual(set(model.mentioned_items("CONFIG_T2")),
                      set(["CONFIG_T2_MODULE", "CONFIG_FOO"]))
     self.assertEqual(set(model.mentioned_items("CONFIG_T2_MODULE")),
                      set(["CONFIG_T2", "CONFIG_MODULES", "CONFIG_BAR"]))
     self.assertEqual(set(model.mentioned_items("CONFIG_T3")),
                      set(["CONFIG_BAR"]))
Exemplo n.º 4
0
    def test_symbol_always_on(self):
        model = RsfModel(self.model_file.name)
        for symbol in ("CONFIG_ALWAYS_ON", "CONFIG_BARFOO", "CONFIG_A",
                       "CONFIG_B", "CONFIG_C", "CONFIG_MODULE"):
            self.assertNotIn(symbol, model.always_on_items)

        for symbol in ("CONFIG_B1", "CONFIG_B2"):
            self.assertIn(symbol, model.always_on_items)
Exemplo n.º 5
0
    def test_all_symbols_included(self):
        model = RsfModel(self.model_file.name)
        for symbol in ("CONFIG_B1", "CONFIG_B2", "CONFIG_B3", "CONFIG_B4",
                       "CONFIG_T1", "CONFIG_T2_MODULE", "CONFIG_T2",
                       "CONFIG_T3"):
            self.assertIn(symbol, model)

        for symbol in ("CONFIG_ALWAYS_ON", "ALWAYS_ON"):
            self.assertNotIn(symbol, model)
Exemplo n.º 6
0
 def test_types(self):
     model = RsfModel(self.model_file.name, self.rsf_file.name)
     for x in ("CONFIG_B1", "CONFIG_B2", "CONFIG_B3", "CONFIG_B4"):
         self.assertEqual(model.get_type(x), "boolean")
     for x in ("CONFIG_T1", "CONFIG_T2"):
         self.assertEqual(model.get_type(x), "tristate")
Exemplo n.º 7
0
 def test_none_leaf_features(self):
     model = RsfModel(self.model_file.name)
     self.assertNotIn(
         set(["CONFIG_FOO", "CONFIG_BAR", "CONFIG_T1", "CONFIG_T2"]),
         set(model.leaf_features()))
Exemplo n.º 8
0
 def test_leaf_features(self):
     model = RsfModel(self.model_file.name)
     for x in ("CONFIG_B1", "CONFIG_B2", "CONFIG_B3", "CONFIG_B4",
               "CONFIG_T3"):
         self.assertIn(x, model.leaf_features())