New upstream version 26.1.0+dfsg1

This commit is contained in:
Sebastian Ramacher 2020-12-22 18:32:50 +01:00
parent 040dcc3fc2
commit 013818c4af
594 changed files with 19576 additions and 4478 deletions

View file

@ -37,3 +37,10 @@ target_link_libraries(test_darray ${CMOCKA_LIBRARIES} libobs)
add_test(test_darray ${CMAKE_CURRENT_BINARY_DIR}/test_darray)
fixLink(test_darray)
# bitstream test
add_executable(test_bitstream test_bitstream.c)
target_link_libraries(test_bitstream ${CMOCKA_LIBRARIES} libobs)
add_test(test_bitstream ${CMAKE_CURRENT_BINARY_DIR}/test_bitstream)
fixLink(test_bitstream)

View file

@ -0,0 +1,34 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <util/bitstream.h>
static void bitstream_test(void **state)
{
struct bitstream_reader reader;
uint8_t data[6] = {0x34, 0xff, 0xe1, 0x23, 0x91, 0x45};
// set len to one less than the array to show that we stop reading at that len
bitstream_reader_init(&reader, data, 5);
assert_int_equal(bitstream_reader_read_bits(&reader, 8), 0x34);
assert_int_equal(bitstream_reader_read_bits(&reader, 1), 1);
assert_int_equal(bitstream_reader_read_bits(&reader, 3), 7);
assert_int_equal(bitstream_reader_read_bits(&reader, 4), 0xF);
assert_int_equal(bitstream_reader_r8(&reader), 0xe1);
assert_int_equal(bitstream_reader_r16(&reader), 0x2391);
// test reached end
assert_int_equal(bitstream_reader_r8(&reader), 0);
}
int main()
{
const struct CMUnitTest tests[] = {
cmocka_unit_test(bitstream_test),
};
return cmocka_run_group_tests(tests, NULL, NULL);
}

View file

@ -7,6 +7,7 @@
static void serialize_test(void **state)
{
UNUSED_PARAMETER(state);
struct array_output_data output;
struct serializer s;