mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
tests: add test for s24/u24 swap
This commit is contained in:
parent
e1cb7c6fb2
commit
987784b629
1 changed files with 24 additions and 0 deletions
|
|
@ -604,6 +604,28 @@ static void test_lossless_u32(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_swaps(void)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
uint24_t v = U32_TO_U24(0x123456);
|
||||||
|
uint24_t t = U32_TO_U24(0x563412);
|
||||||
|
uint24_t s = bswap_u24(v);
|
||||||
|
spa_assert_se(memcmp(&s, &t, sizeof(t)) == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
int24_t v = S32_TO_S24(0xfffe1dc0);
|
||||||
|
int24_t t = S32_TO_S24(0xffc01dfe);
|
||||||
|
int24_t s = bswap_s24(v);
|
||||||
|
spa_assert_se(memcmp(&s, &t, sizeof(t)) == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
int24_t v = S32_TO_S24(0x123456);
|
||||||
|
int24_t t = S32_TO_S24(0x563412);
|
||||||
|
int24_t s = bswap_s24(v);
|
||||||
|
spa_assert_se(memcmp(&s, &t, sizeof(t)) == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
cpu_flags = get_cpu_flags();
|
cpu_flags = get_cpu_flags();
|
||||||
|
|
@ -640,5 +662,7 @@ int main(int argc, char *argv[])
|
||||||
test_lossless_u24();
|
test_lossless_u24();
|
||||||
test_lossless_s32();
|
test_lossless_s32();
|
||||||
test_lossless_u32();
|
test_lossless_u32();
|
||||||
|
|
||||||
|
test_swaps();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue