1
mirror of https://github.com/mpv-player/mpv synced 2024-10-18 10:25:02 +02:00
mpv/test/chmap.c
wm4 00130651da audio: simplify further
Drop mp_chmap_diff() (which is unused too now), and implement
mp_chmap_diffn() in a slightly simpler way. (Too bad there is no
standard function for counting set bits.)
2015-05-08 21:22:39 +02:00

24 lines
552 B
C

#include "test_helpers.h"
#include "audio/chmap.h"
static void test_mp_chmap_diff(void **state) {
struct mp_chmap a;
struct mp_chmap b;
mp_chmap_from_str(&a, bstr0("3.1"));
mp_chmap_from_str(&b, bstr0("2.1"));
assert_int_equal(mp_chmap_diffn(&a, &b), 1);
mp_chmap_from_str(&b, bstr0("6.1(back)"));
assert_int_equal(mp_chmap_diffn(&a, &b), 0);
assert_int_equal(mp_chmap_diffn(&b, &a), 3);
}
int main(void) {
const UnitTest tests[] = {
unit_test(test_mp_chmap_diff),
};
return run_tests(tests);
}