Skip to content

Commit 6a1c290

Browse files
committed
Switch openal ext tests to use btest_exit and asserts
1 parent c899e42 commit 6a1c290

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

test/openal_extensions.c

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,11 @@
1212

1313
#include <stdio.h>
1414
#include <stdlib.h>
15-
#ifdef __EMSCRIPTEN__
16-
#include <emscripten.h>
17-
#endif
15+
#include <assert.h>
1816
#include <AL/al.h>
1917
#include <AL/alc.h>
2018
#include <AL/alext.h>
2119

22-
static int result = EXIT_SUCCESS;
23-
24-
static void end_test() {
25-
#ifdef __EMSCRIPTEN__
26-
REPORT_RESULT(result);
27-
#endif
28-
exit(result);
29-
}
30-
3120
#define NUM_ALC_EXTENSIONS 2
3221
static const ALCchar *alc_extensions[NUM_ALC_EXTENSIONS] = {
3322
"ALC_SOFT_pause_device",
@@ -45,23 +34,13 @@ static const ALCchar *al_extensions[NUM_AL_EXTENSIONS] = {
4534

4635
static void check_alc_extension(const ALCchar *extension) {
4736
ALCdevice *device = alcOpenDevice(NULL);
48-
if (!device) {
49-
fprintf(stderr, "Failed to open default device.");
50-
result = EXIT_FAILURE;
51-
return;
52-
}
5337

54-
if (alcIsExtensionPresent(device, extension) != ALC_TRUE) {
55-
fprintf(stderr, "Extension %s was not present.", extension);
56-
result = EXIT_FAILURE;
57-
}
38+
assert(device);
39+
assert(alcIsExtensionPresent(device, extension) == ALC_TRUE);
5840
}
5941

6042
static void check_al_extension(const ALchar *extension) {
61-
if (alIsExtensionPresent(extension) != ALC_TRUE) {
62-
fprintf(stderr, "Extension %s was not present.", extension);
63-
result = EXIT_FAILURE;
64-
}
43+
assert(alIsExtensionPresent(extension) == ALC_TRUE);
6544
}
6645

6746
int main() {
@@ -74,5 +53,5 @@ int main() {
7453
check_al_extension(al_extensions[i]);
7554
}
7655

77-
end_test();
56+
return 0;
7857
}

test/test_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ def test_openal_capture_sanity(self):
22982298
self.btest('openal_capture_sanity.c', expected='0')
22992299

23002300
def test_openal_extensions(self):
2301-
self.btest('openal_extensions.c', expected='0')
2301+
self.btest_exit('openal_extensions.c')
23022302

23032303
def test_runtimelink(self):
23042304
create_file('header.h', r'''

0 commit comments

Comments
 (0)