Esempio n. 1
0
    def new_class(self, class_class):
        # Allocate a new class and set its class to be the given class class
        result = Class(self, class_class.get_number_of_instance_fields())
        result.set_class(class_class)

        # Return the freshly allocated class
        return result
Esempio n. 2
0
    def new_metaclass_class(self):
        # Allocate the metaclass classes
        result = Class(self, 0, Class(self, 0, None))

        # Setup the metaclass hierarchy
        result.get_class(self).set_class(result)
        return result
Esempio n. 3
0
    def new_system_class(self):
        # Allocate the new system class
        system_class = Class(self, 0, Class(self, 0, None))

        # Setup the metaclass hierarchy
        system_class.get_class(self).set_class(self.metaclassClass)
        return system_class
Esempio n. 4
0
    def new_system_class(self):
        # Allocate the new system class
        system_class = Class(self, 0, Class(self, 0, None))

        # Setup the metaclass hierarchy
        system_class.get_class(self).set_class(self.metaclassClass)
        return system_class
Esempio n. 5
0
    def new_metaclass_class(self):
        # Allocate the metaclass classes
        result = Class(self, 0, Class(self, 0, None))

        # Setup the metaclass hierarchy
        result.get_class(self).set_class(result)
        return result
Esempio n. 6
0
    def new_class(self, class_class):
        # Allocate a new class and set its class to be the given class class
        result = Class(self, class_class.get_number_of_instance_fields())
        result.set_class(class_class)

        # Return the freshly allocated class
        return result
Esempio n. 7
0
class ObjectTestCase(unittest.TestCase):
    def setUp(self):
        self.universe = Universe
        self.object_integer = Object(None)
        self.integer_class = Class(self.universe)
        self.integer_class.set_name(Symbol(Object(None), "Integer"))
        self.object_integer._class = self.integer_class

    def test_get_class(self):
        integer_class = Class(self.universe)
        integer_class.set_name(Symbol(Object(None), "Integer"))
        self.assertEqual(integer_class, self.object_integer.get_class())

    def test_set_class(self):
        self.object_integer.set_class(Double)

    def test_get_field_name(self):
        pass

    def test_get_field_index(self):
        pass

    def test_get_number_of_fields(self):
        pass

    def test_get_default_number_of_fields(self):
        self.assertEqual(self.object_integer.NUMBER_OF_OBJECT_FIELDS,
                         self.object_integer._get_default_number_of_fields())

    def test_get_field(self):
        pass

    def test_set_field(self):
        pass

    def test_send(self):
        pass

    def test_send_does_not_understand(self):
        pass

    def test_send_unknown_global(self):
        pass

    def send_escaped_block(self):
        pass

    def test_str(self):
        self.assertEqual("a Integer", str(self.object_integer))
Esempio n. 8
0
    def new_system_class(self):
        # Allocate the new system class
        system_class = Class(self)

        # Setup the metaclass hierarchy
        system_class.set_class(Class(self))
        system_class.get_class(self).set_class(self.metaclassClass)

        # Return the freshly allocated system class
        return system_class
Esempio n. 9
0
    def new_metaclass_class(self):
        # Allocate the metaclass classes
        result = Class(self)
        result.set_class(Class(self))

        # Setup the metaclass hierarchy
        result.get_class(self).set_class(result)

        # Return the freshly allocated metaclass class
        return result
Esempio n. 10
0
 def test_get_class(self):
     integer_class = Class(self.universe)
     integer_class.set_name(Symbol(Object(None), "Integer"))
     self.assertEqual(integer_class, self.object_integer.get_class())
Esempio n. 11
0
 def setUp(self):
     self.universe = Universe
     self.object_integer = Object(None)
     self.integer_class = Class(self.universe)
     self.integer_class.set_name(Symbol(Object(None), "Integer"))
     self.object_integer._class = self.integer_class
Esempio n. 12
0
 def new_class(self, class_class):
     # Allocate a new class and set its class to be the given class class
     return Class(self, class_class.get_number_of_instance_fields(),
                  class_class)