|
|
|
@ -41,6 +41,32 @@ public class Av1BitStreamTests |
|
|
|
Assert.Equal(expected, actual); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void ReadLiteral32BitsWithMsbSet() |
|
|
|
{ |
|
|
|
// arrange
|
|
|
|
// Three 32-bit values with MSB set.
|
|
|
|
byte[] buffer = { |
|
|
|
0xff, 0xff, 0xff, 0xff, // 4294967295
|
|
|
|
0x80, 0xff, 0xee, 0xdd, // 2164256477
|
|
|
|
0xa0, 0xaa, 0xbb, 0xcc // 2695543756
|
|
|
|
}; |
|
|
|
uint expected0 = 4294967295; |
|
|
|
uint expected1 = 2164256477; |
|
|
|
uint expected2 = 2695543756; |
|
|
|
Av1BitStreamReader reader = new(buffer); |
|
|
|
|
|
|
|
// act
|
|
|
|
uint actual0 = reader.ReadLiteral(32); |
|
|
|
uint actual1 = reader.ReadLiteral(32); |
|
|
|
uint actual2 = reader.ReadLiteral(32); |
|
|
|
|
|
|
|
// assert
|
|
|
|
Assert.Equal(expected0, actual0); |
|
|
|
Assert.Equal(expected1, actual1); |
|
|
|
Assert.Equal(expected2, actual2); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[InlineData(new bool[] { false, false, true, false, true, false, true, false })] |
|
|
|
[InlineData(new bool[] { false, true, false, true })] |
|
|
|
|