summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-07-08 08:50:19 +0200
committerClemens Ladisch <clemens@ladisch.de>2009-07-08 08:50:19 +0200
commit61f5b8438bf8945de0581719422b679b490da44b (patch)
treeea25c61d9a62a98c154dbbaf92d66bbc3ed481ad /test
parent746930616565caedb9acc89ee6da20c5709879d2 (diff)
test/lsb/midi_event.c: abort on fatal errors
If snd_midi_event_fails(), we cannot use the object and must abort the current test. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'test')
-rw-r--r--test/lsb/midi_event.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/lsb/midi_event.c b/test/lsb/midi_event.c
index 3a4d7fa1..32d71cc0 100644
--- a/test/lsb/midi_event.c
+++ b/test/lsb/midi_event.c
@@ -38,7 +38,8 @@ static void test_decode(void)
unsigned char buf[50];
int count;
- ALSA_CHECK(snd_midi_event_new(256 /* ? */, &midi_event));
+ if (ALSA_CHECK(snd_midi_event_new(256 /* ? */, &midi_event)) < 0)
+ return;
#define DECODE() snd_midi_event_decode(midi_event, buf, sizeof(buf), &ev)
#define BUF_MATCHES(str) midi_matches_regex(buf, count, str)
@@ -154,7 +155,8 @@ static void test_reset_decode(void)
unsigned char buf[50];
int count;
- ALSA_CHECK(snd_midi_event_new(256 /* ? */, &midi_event));
+ if (ALSA_CHECK(snd_midi_event_new(256 /* ? */, &midi_event)) < 0)
+ return;
snd_seq_ev_clear(&ev);
@@ -173,7 +175,8 @@ static void test_encode(void)
snd_midi_event_t *midi_event;
snd_seq_event_t ev;
- ALSA_CHECK(snd_midi_event_new(256, &midi_event));
+ if (ALSA_CHECK(snd_midi_event_new(256, &midi_event)) < 0)
+ return;
#define ENCODE(str) snd_midi_event_encode(midi_event, \
(const unsigned char *)str, \
@@ -283,7 +286,8 @@ static void test_reset_encode(void)
snd_midi_event_t *midi_event;
snd_seq_event_t ev;
- ALSA_CHECK(snd_midi_event_new(256, &midi_event));
+ if (ALSA_CHECK(snd_midi_event_new(256, &midi_event)) < 0)
+ return;
TEST_CHECK(ENCODE("\x91\x02") == 2);
TEST_CHECK(ev.type == SND_SEQ_EVENT_NONE);
@@ -303,7 +307,8 @@ static void test_init(void)
unsigned char buf[50];
int count;
- ALSA_CHECK(snd_midi_event_new(256, &midi_event));
+ if (ALSA_CHECK(snd_midi_event_new(256, &midi_event)) < 0)
+ return;
snd_seq_ev_set_noteon(&ev, 1, 2, 3);
TEST_CHECK(DECODES_TO("910203"));
@@ -327,7 +332,8 @@ static void test_encode_byte(void)
snd_midi_event_t *midi_event;
snd_seq_event_t ev;
- ALSA_CHECK(snd_midi_event_new(256, &midi_event));
+ if (ALSA_CHECK(snd_midi_event_new(256, &midi_event)) < 0)
+ return;
#define ENCODE_BYTE(c) snd_midi_event_encode_byte(midi_event, c, &ev)
TEST_CHECK(ENCODE_BYTE(0x81) == 0);