Exemple #1
0
    def test_extend(self):
        opts = options.option_list()
        opts.extend([options.pthread(), options.pic()])
        self.assertEqual(list(opts), [options.pthread(), options.pic()])

        opts = options.option_list(options.pthread())
        opts.extend([options.pthread(), options.pic()])
        self.assertEqual(list(opts), [options.pthread(), options.pic()])
Exemple #2
0
    def test_eq(self):
        opts1 = options.option_list(options.pthread())
        opts2 = options.option_list(options.pthread())
        opts3 = options.option_list(options.pic())

        self.assertTrue(opts1 == opts2)
        self.assertFalse(opts1 != opts2)
        self.assertFalse(opts1 == opts3)
        self.assertTrue(opts1 != opts3)
Exemple #3
0
    def test_index(self):
        opts = options.option_list(options.pthread(), options.pic())
        self.assertEqual(opts[0], options.pthread())
        self.assertEqual(opts[0:1], options.option_list(options.pthread()))

        opts[0] = '-v'
        self.assertEqual(opts, options.option_list('-v', options.pic()))
        opts[0:] = [options.define('name')]
        self.assertEqual(opts, options.option_list(options.define('name')))
Exemple #4
0
    def test_bool(self):
        opts = options.option_list()
        self.assertFalse(opts)

        opts = options.option_list(options.pthread())
        self.assertTrue(opts)

        opts = options.option_list(options.pthread(), options.pic())
        self.assertEqual(len(opts), 2)
Exemple #5
0
    def test_len(self):
        opts = options.option_list()
        self.assertEqual(len(opts), 0)

        opts = options.option_list(options.pthread())
        self.assertEqual(len(opts), 1)

        opts = options.option_list(options.pthread(), options.pic())
        self.assertEqual(len(opts), 2)
Exemple #6
0
    def test_iadd(self):
        opts = options.option_list(options.pthread())
        opts += options.option_list(options.pthread())
        opts += options.option_list(options.pic())

        self.assertEqual(opts,
                         options.option_list(options.pthread(), options.pic()))
        with self.assertRaises(TypeError):
            opts += [options.pic()]
Exemple #7
0
    def test_add(self):
        opts1 = options.option_list(options.pthread())
        opts2 = options.option_list(options.pthread())
        opts3 = options.option_list(options.pic())

        self.assertEqual(opts1 + opts2 + opts3,
                         options.option_list(options.pthread(), options.pic()))
        with self.assertRaises(TypeError):
            opts1 + [options.pic()]
Exemple #8
0
    def test_append(self):
        opts = options.option_list()
        opts.append(options.pthread())
        opts.append(options.pthread())
        self.assertEqual(list(opts), [options.pthread()])

        opts = options.option_list()
        opts.append('-v')
        opts.append('-v')
        self.assertEqual(list(opts), ['-v', '-v'])
Exemple #9
0
    def test_filled(self):
        opts = options.option_list(options.pthread())
        self.assertEqual(list(opts), [options.pthread()])

        opts = options.option_list([options.pthread()])
        self.assertEqual(list(opts), [options.pthread()])

        opts = options.option_list(options.pthread(), [options.pic()])
        self.assertEqual(list(opts), [options.pthread(), options.pic()])
Exemple #10
0
 def test_flags_pthread(self):
     self.assertEqual(
         self.linker.flags(opts.option_list(opts.pthread())),
         [] if self.env.target_platform.genus == 'darwin' else ['-pthread'])
Exemple #11
0
 def test_flags_pthread(self):
     self.assertEqual(self.compiler.flags(opts.option_list(opts.pthread())),
                      ['-pthread'])
Exemple #12
0
 def test_iter(self):
     opts = options.option_list(options.pthread(), options.pic())
     self.assertEqual(list(iter(opts)), [options.pthread(), options.pic()])
Exemple #13
0
 def test_filter(self):
     opts = options.option_list(options.pthread(), options.pic())
     opts2 = opts.filter(options.pic)
     self.assertEqual(opts2, options.option_list(options.pic()))
Exemple #14
0
 def test_copy(self):
     opts = options.option_list(options.pthread(), [options.pic()])
     opts2 = opts.copy()
     self.assertTrue(opts is not opts2)
     self.assertEqual(opts, opts2)