def test_read_bool(self): r = MinecraftReader() d = r.read_bool() r.dataReceived("\x00") self.failUnlessEqual((yield d), False) d = r.read_bool() r.dataReceived("\x01") self.failUnlessEqual((yield d), True)
def test_read_double(self): r = MinecraftReader() d = r.read_double() r.dataReceived("\x00\x00\x00\x00\x00\x00\x00\x00") self.failUnlessEqual((yield d), 0)
def test_read_string_overflow(self): r = MinecraftReader() d = r.read_string() r.dataReceived("\x00\x09minecraft1234567890") self.failUnlessEqual((yield d), "minecraft")
def test_read_raw(self): r = MinecraftReader() d = r.read_raw(5) r.dataReceived("12345") self.failUnlessEqual((yield d), "12345")