1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

bitfield: add bf.from_bytes_lowest_bits_first/1 and a test for it

This commit is contained in:
Delyan Angelov
2020-12-18 21:58:42 +02:00
parent c5c310280f
commit f74ab3a52d
2 changed files with 20 additions and 2 deletions

View File

@@ -126,6 +126,14 @@ fn test_bf_from_bytes() {
assert newoutput == output
}
fn test_bf_from_bytes_lowest_bits_first() {
input := [byte(0x01), 0xF0]
output := bitfield.from_bytes_lowest_bits_first(input).str()
assert output == '10000000' + '00001111'
newoutput := bitfield.from_str(output).str()
assert newoutput == output
}
fn test_bf_from_str() {
len := 80
mut input := ''