public void BitStringRightAlign() { foreach (var td in BitStringAlignTestData) { var bs = new Parser.BitString { Bytes = td.In, BitLength = td.InLen }; var @out = bs.RightAlign(); Assert.Equal(td.Out, @out); } }
public void BitStringAt() { var bs = new Parser.BitString { Bytes = new byte[] { 0x82, 0x40 }, // 1000 0010 0100 0000 BitLength = 16, }; Assert.Equal(bs.At(0), 1); Assert.Equal(bs.At(1), 0); Assert.Equal(bs.At(6), 1); Assert.Equal(bs.At(9), 1); Assert.Equal(bs.At(-1), 0); Assert.Equal(bs.At(17), 0); }