def test_def_1(self): sttype = uter.struct((uter.int, "a"), (uter.int, "b")) pointtype = uter.point(sttype) ppointtype = uter.point(pointtype) ppointdata = ppointtype() print ppointtype print ppointdata self.assertEqual(True, True, "")
def test_1(self): fun_obj = uter.export.function("fun_walk_list_1") sttype = uter.export.struct("my_node") stptype = uter.point(sttype) stpobj = stptype() result = fun_obj._Call(stpobj) self.assertEqual(True, result._GetValue() == 0, "")
def test_msg_1(self): #准备 fun_obj = uter.export.function("my_msg_proc_1") sttype = uter.export.struct("my_msg_head") psttype = uter.point(sttype) pstobj = psttype() retobj = fun_obj._Call(pstobj) self.assertEqual(True, retobj._GetValue() == -1, "")
def test_def_st(self): sttype_1 = uter.struct((uter.int, "a"), (uter.int, "b")) pointtype_1 = uter.point(sttype_1) self.assertEqual(True, pointtype_1._GetFinalType() == sttype_1, "") sttype_2 = uter.struct((uter.int, "a"), (uter.int, "b")) pointtype_2 = uter.point(sttype_2) self.assertEqual(True, pointtype_2._GetFinalType() == sttype_2, "") sttype_3 = uter.struct((uter.int, "a"), (uter.char, "b")) pointtype_3 = uter.point(sttype_3) self.assertEqual(True, pointtype_3._GetFinalType() == sttype_3, "") self.assertEqual(True, pointtype_1 == pointtype_2, "") self.assertEqual(True, pointtype_2 == pointtype_1, "") self.assertEqual(True, pointtype_1 != pointtype_3, "") self.assertEqual(True, pointtype_3 != pointtype_1, "") self.assertEqual(True, pointtype_2 != pointtype_3, "") self.assertEqual(True, pointtype_3 != pointtype_2, "")
def test_point(self): pointtype = uter.point(uter.void) print pointtype voidtype = pointtype._GetFinalType() print voidtype pointdata = pointtype() print pointdata self.assertEqual(True, True, "")
def test_all(self): self.assertEqual(True, type(uter.char) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.uchar) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.short) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.ushort) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.int) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.uint) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.long) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.ulong) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.longlong) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.ulonglong) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.float) is uter._UterMetaClass, "") self.assertEqual(True, type(uter.double) is uter._UterMetaClass, "") self.assertEqual(True, isinstance(uter.char, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.uchar, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.short, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.ushort, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.int, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.uint, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.long, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.ulong, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.longlong, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.ulonglong, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.float, uter._UterMetaClass), "") self.assertEqual(True, isinstance(uter.double, uter._UterMetaClass), "") datatype = uter.struct((uter.char, "a"), (uter.char, "b")) self.assertEqual(True, type(datatype) is uter._UterMetaClass, "") self.assertEqual(True, isinstance(datatype, uter._UterMetaClass), "") datatype = uter.union((uter.char, "a"), (uter.char, "b")) self.assertEqual(True, type(datatype) is uter._UterMetaClass, "") self.assertEqual(True, isinstance(datatype, uter._UterMetaClass), "") datatype = uter.enum(("a", 1), ("b", 3)) self.assertEqual(True, type(datatype) is uter._UterMetaClass, "") self.assertEqual(True, isinstance(datatype, uter._UterMetaClass), "") datatype = uter.point(uter.int) self.assertEqual(True, type(datatype) is uter._UterMetaClass, "") self.assertEqual(True, isinstance(datatype, uter._UterMetaClass), "") datatype = uter.array(uter.int, 8) self.assertEqual(True, type(datatype) is uter._UterMetaClass, "") self.assertEqual(True, isinstance(datatype, uter._UterMetaClass), "") datatype = uter.typedef(uter.int, "xxx") self.assertEqual(True, type(datatype) is uter._UterMetaClass, "") self.assertEqual(True, isinstance(datatype, uter._UterMetaClass), "")
def test_def_base(self): pointtype_1 = uter.point(uter.uint) print pointtype_1 self.assertEqual(True, pointtype_1._GetFinalType() == uter.uint, "") pointtype_2 = uter.point(uter.uint) print pointtype_2 self.assertEqual(True, pointtype_2._GetFinalType() == uter.uint, "") pointtype_3 = uter.point(uter.uchar) print pointtype_3 self.assertEqual(True, pointtype_3._GetFinalType() == uter.uchar, "") self.assertEqual(True, pointtype_1 == pointtype_1, "") self.assertEqual(True, pointtype_2 == pointtype_2, "") self.assertEqual(True, pointtype_3 == pointtype_3, "") self.assertEqual(True, pointtype_1 == pointtype_2, "") self.assertEqual(True, pointtype_2 == pointtype_1, "") self.assertEqual(True, pointtype_1 != pointtype_3, "") self.assertEqual(True, pointtype_3 != pointtype_1, "") self.assertEqual(True, pointtype_2 != pointtype_3, "") self.assertEqual(True, pointtype_3 != pointtype_2, "")
def test_export_type_new(self): totype = uter.export.struct("g_p_st_1_t") pointtype = uter.point(totype) pointdata_1 = pointtype() print pointdata_1 self.assertEqual(True, pointtype._MatchType(pointdata_1._GetType()), "") self.assertEqual(True, pointdata_1._GetValue() == 0, "") pointdata_2 = pointtype(0x12345678) print pointdata_2 self.assertEqual(True, pointdata_2._GetValue() == 0x12345678, "") pointdata_3 = pointtype(pointdata_2) print pointdata_3 self.assertEqual(True, pointdata_3._GetValue() == 0x12345678, "")
def test_def_type_new(self): sttype = uter.struct((uter.int, "a"), (uter.int, "b")) pointtype = uter.point(sttype) todata = sttype() pointdata_1 = pointtype() print pointdata_1 self.assertEqual(True, pointtype._MatchType(pointdata_1._GetType()), "") self.assertEqual(True, pointdata_1._GetValue() == 0, "") pointdata_2 = pointtype(0x12345678) print pointdata_2 self.assertEqual(True, pointdata_2._GetValue() == 0x12345678, "") pointdata_3 = pointtype(pointdata_2) print pointdata_3 self.assertEqual(True, pointdata_3._GetValue() == 0x12345678, "")
def test_num_val(self): sttype = uter.struct((uter.int, "a"), (uter.int, "b")) pointtype = uter.point(sttype) pointdata = pointtype() pointdata._SetValue(0x12345678) self.assertEqual(True, pointdata._GetValue() == 0x12345678, "")
def test_def_val(self): sttype = uter.struct((uter.int, "a"), (uter.int, "b")) pointtype = uter.point(sttype) pointdata = pointtype() self.assertEqual(True, pointdata._GetValue() == 0, "")