def testReadWriteIntFromStream(self): stream = MemoryStream() stream.writeInt(1) stream.resetPos() v = IntValue() v.readFromStream(stream) self.assertEqual(v.getVal(), 1) v.setVal(2) stream.resetPos() v.writeToStream(stream) self.assertEqual(stream.tellg(), 4) stream.resetPos() self.assertEqual(stream.readInt(), 2)
def testReadWriteVe2iFromStream(self): stream = MemoryStream() stream.writeInt(1) stream.writeInt(2) stream.resetPos() v = Vec2iValue() v.readFromStream(stream) self.assertEqual(v.getVal(), (1, 2)) v.setVal(3, 4) stream.resetPos() v.writeToStream(stream) self.assertEqual(stream.tellg(), 8) stream.resetPos() self.assertEqual(stream.readInt(), 3) self.assertEqual(stream.readInt(), 4)