fixed Deserializer.alignToByte() and added test coverage

master
tgschultz 2019-06-01 12:25:57 +00:00 committed by Andrew Kelley
parent 6d73e5de05
commit 3eca5a42e6
2 changed files with 2 additions and 1 deletions

View File

@ -1131,7 +1131,7 @@ pub fn Deserializer(comptime endian: builtin.Endian, comptime packing: Packing,
}
pub fn alignToByte(self: *Self) void {
if (!is_packed) return;
if (packing == .Byte) return;
self.in_stream.alignToByte();
}

View File

@ -417,6 +417,7 @@ fn testIntSerializerDeserializerInfNaN(
const nan_check_f16 = try deserializer.deserialize(f16);
const inf_check_f16 = try deserializer.deserialize(f16);
const nan_check_f32 = try deserializer.deserialize(f32);
deserializer.alignToByte();
const inf_check_f32 = try deserializer.deserialize(f32);
const nan_check_f64 = try deserializer.deserialize(f64);
const inf_check_f64 = try deserializer.deserialize(f64);