char *test_print() { object = Object_new(); Object_print(object); Object_destroy(object); object = True_new(); Object_print(object); Object_destroy_immortal(object); object = False_new(); Object_print(object); Object_destroy_immortal(object); object = Nil_new(); Object_print(object); Object_destroy_immortal(object); object = Integer_new(123); Object_print(object); Object_destroy(object); bstring hello = bfromcstr("hello"); object = String_new(hello); Object_print(object); Object_destroy(object); return NULL; }
void runtime_init() { Object_proto = Object_new(0); CFunction_proto = Object_new(Object_proto); Function_proto = Object_new(Object_proto); Hash_proto = Object_new(Object_proto); List_proto = Object_new(Object_proto); Symbol_proto = Object_new(Object_proto); Bool_proto = Object_new(Object_proto); Integer_proto = Object_new(Object_proto); Float_proto = Object_new(Object_proto); String_proto = Object_new(Object_proto); Exception_proto = Object_new(Object_proto); SymbolTable_init(); Object_initProto(); CFunction_initProto(); Function_initProto(); Hash_initProto(); List_initProto(); Symbol_initProto(); Bool_initProto(); Integer_initProto(); Float_initProto(); String_initProto(); Exception_initProto(); Qnil = Nil_new(); Qtrue = Bool_new(); Qfalse = Bool_new(); }
char *test_special() { object = True_new(); mu_assert(object->type == tTrue, "True has the wrong type"); mu_assert(object->immortal == 1, "True is not immortal"); Object_destroy_immortal(object); object = False_new(); mu_assert(object->type == tFalse, "False has the wrong type"); mu_assert(object->immortal == 1, "False is not immortal"); Object_destroy_immortal(object); object = Nil_new(); mu_assert(object->type == tNil, "Nil has the wrong type"); mu_assert(object->immortal == 1, "Nil is not immortal"); Object_destroy_immortal(object); object = Lobby_new(); mu_assert(object->type == tObject, "Lobby has the wrong type"); mu_assert(object->immortal == 1, "Lobby is not immortal"); Object_destroy_immortal(object); return NULL; }