mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
tests: modify volume_test to use new 'check' framework
This commit is contained in:
parent
9197c0323e
commit
3db18c27d2
2 changed files with 29 additions and 9 deletions
|
|
@ -415,9 +415,9 @@ close_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore-@PA_MAJORMINOR@.la l
|
|||
close_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
|
||||
|
||||
volume_test_SOURCES = tests/volume-test.c
|
||||
volume_test_CFLAGS = $(AM_CFLAGS)
|
||||
volume_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
|
||||
volume_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon-@PA_MAJORMINOR@.la
|
||||
volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
|
||||
volume_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
|
||||
|
||||
channelmap_test_SOURCES = tests/channelmap-test.c
|
||||
channelmap_test_CFLAGS = $(AM_CFLAGS)
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <check.h>
|
||||
|
||||
#include <pulse/volume.h>
|
||||
|
||||
#include <pulsecore/log.h>
|
||||
#include <pulsecore/macro.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
START_TEST (volume_test) {
|
||||
pa_volume_t v;
|
||||
pa_cvolume cv;
|
||||
float b;
|
||||
|
|
@ -95,8 +97,8 @@ int main(int argc, char *argv[]) {
|
|||
pa_volume_t r = pa_sw_volume_from_dB(db);
|
||||
pa_volume_t w;
|
||||
|
||||
pa_assert(k == v);
|
||||
pa_assert(r == v);
|
||||
fail_unless(k == v);
|
||||
fail_unless(r == v);
|
||||
|
||||
for (w = PA_VOLUME_MUTED; w < PA_VOLUME_NORM*2; w += 37) {
|
||||
|
||||
|
|
@ -127,8 +129,26 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
pa_log("max deviation: %lu n=%lu", (unsigned long) md, (unsigned long) mdn);
|
||||
|
||||
pa_assert(md <= 1);
|
||||
pa_assert(mdn <= 251);
|
||||
|
||||
return 0;
|
||||
fail_unless(md <= 1);
|
||||
fail_unless(mdn <= 251);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int failed = 0;
|
||||
Suite *s;
|
||||
TCase *tc;
|
||||
SRunner *sr;
|
||||
|
||||
s = suite_create("Volume");
|
||||
tc = tcase_create("volume");
|
||||
tcase_add_test(tc, volume_test);
|
||||
suite_add_tcase(s, tc);
|
||||
|
||||
sr = srunner_create(s);
|
||||
srunner_run_all(sr, CK_NORMAL);
|
||||
failed = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
|
||||
return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue