Ejemplo n.º 1
0
 def test_size(self):
     for t1_ in TYPE.types:
         t1 = SymbolBASICTYPE(t1_)
         for t2_ in TYPE.types:
             t2 = SymbolBASICTYPE(t2_)
             t = SymbolTYPE('test_type', 0, t1, t2)
             self.assertEqual(t.size, t1.size + t2.size)
Ejemplo n.º 2
0
 def test_to_signed(self):
     for type_ in TYPE.types:
         if type_ is TYPE.unknown or type_ == TYPE.string:
             continue
         t = SymbolBASICTYPE(type_)
         q = t.to_signed()
         self.assertTrue(q.is_signed)
Ejemplo n.º 3
0
 def test_is_alias(self):
     for t1_ in TYPE.types:
         t1 = SymbolBASICTYPE(t1_)
         for t2_ in TYPE.types:
             t2 = SymbolBASICTYPE(t2_)
             t = SymbolTYPE('test_type', 0, t1, t2)
             self.assertFalse(t.is_alias)
Ejemplo n.º 4
0
 def test__ne__(self):
     for t1_ in TYPE.types:
         t1 = SymbolBASICTYPE(t1_)
         for t2_ in TYPE.types:
             t2 = SymbolBASICTYPE(t2_)
             if t1 == t2:  # Already validated
                 self.assertTrue(t1 == t2)
             else:
                 self.assertTrue(t1 != t2)
Ejemplo n.º 5
0
    def test__eq__(self):
        for t_ in TYPE.types:
            t = SymbolBASICTYPE(t_)
            self.assertTrue(t == t)  # test same reference

        for t_ in TYPE.types:
            t1 = SymbolBASICTYPE(t_)
            t2 = SymbolBASICTYPE(t_)
            self.assertTrue(t1 == t2)

        t = SymbolBASICTYPE(TYPE.string)
        self.assertEqual(t, Type.string)
Ejemplo n.º 6
0
 def test__eq__(self):
     for t1_ in TYPE.types:
         t1 = SymbolBASICTYPE(t1_)
         for t2_ in TYPE.types:
             t2 = SymbolBASICTYPE(t2_)
             t = SymbolTYPE('test_type', 0, t1, t2)
             tt = SymbolTYPE('other_type', 0, t)
             self.assertTrue(t == t)
             self.assertFalse(t != t)
             self.assertFalse(tt == t)
             self.assertFalse(t == tt)
             self.assertTrue(tt == tt)
             self.assertFalse(tt != tt)
             self.assertTrue(t != tt)
             self.assertTrue(tt != t)
Ejemplo n.º 7
0
 def test_is_alias(self):
     for type_ in TYPE.types:
         t = SymbolBASICTYPE(type_)
         ta = SymbolTYPEALIAS('alias', 0, t)
         self.assertTrue(ta.is_alias)
         self.assertTrue(ta.is_basic)
         self.assertFalse(t.is_alias)
Ejemplo n.º 8
0
 def test_bool(self):
     for type_ in TYPE.types:
         t = SymbolBASICTYPE(type_)
         if t.type_ == TYPE.unknown:
             self.assertFalse(t)
         else:
             self.assertTrue(t)
Ejemplo n.º 9
0
 def test__eq__(self):
     for type_ in TYPE.types:
         t = SymbolBASICTYPE(type_)
         ta = SymbolTYPEALIAS('alias', 0, t)
         self.assertEqual(t.size, ta.size)
         self.assertTrue(ta == ta)
         self.assertTrue(t == ta)
         self.assertTrue(ta == t)
Ejemplo n.º 10
0
 def test_is_dynamic(self):
     for type_ in TYPE.types:
         t = SymbolBASICTYPE(type_)
         self.assertTrue((type_ == TYPE.string) == t.is_dynamic)
Ejemplo n.º 11
0
 def test_is_basic(self):
     for type_ in TYPE.types:
         t = SymbolBASICTYPE(type_)
         self.assertTrue(t.is_basic)
Ejemplo n.º 12
0
 def test_size(self):
     for type_ in TYPE.types:
         t = SymbolBASICTYPE(type_)
         self.assertEqual(t.size, TYPE.size(type_))