|
Packit Service |
db8eaa |
#ifndef TEST_H_INCLUDED
|
|
Packit Service |
db8eaa |
#define TEST_H_INCLUDED
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
#include <stdio.h>
|
|
Packit Service |
db8eaa |
#include <alsa/asoundlib.h>
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
/* XXX this variable definition does not belong in a header file */
|
|
Packit Service |
db8eaa |
static int any_test_failed;
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
#define TEST_CHECK(cond) do \
|
|
Packit Service |
db8eaa |
if (!(cond)) { \
|
|
Packit Service |
db8eaa |
fprintf(stderr, "%s:%d: test failed: %s\n", __FILE__, __LINE__, #cond); \
|
|
Packit Service |
db8eaa |
any_test_failed = 1; \
|
|
Packit Service |
db8eaa |
} \
|
|
Packit Service |
db8eaa |
while (0)
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
#define ALSA_CHECK(fn) ({ \
|
|
Packit Service |
db8eaa |
int err = fn; \
|
|
Packit Service |
db8eaa |
if (err < 0) { \
|
|
Packit Service |
db8eaa |
fprintf(stderr, "%s:%d: ALSA function call failed (%s): %s\n", \
|
|
Packit Service |
db8eaa |
__FILE__, __LINE__, snd_strerror(err), #fn); \
|
|
Packit Service |
db8eaa |
any_test_failed = 1; \
|
|
Packit Service |
db8eaa |
} \
|
|
Packit Service |
db8eaa |
err; \
|
|
Packit Service |
db8eaa |
})
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
#define TEST_EXIT_CODE() any_test_failed
|
|
Packit Service |
db8eaa |
|
|
Packit Service |
db8eaa |
#endif
|