diff options
author | Chun-Min Chang <[email protected]> | 2017-04-06 15:17:38 +0800 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2017-04-06 20:14:00 +1200 |
commit | 61aaac299d00b803452193ccffdee83dcce7cec4 (patch) | |
tree | 8983c84410a1b1770266cb88564436a805440d2d /test/test_devices.cpp | |
parent | 7d68ec269de45ed791b44398d9893ccdbadc8871 (diff) | |
download | cubeb-61aaac299d00b803452193ccffdee83dcce7cec4.tar.gz cubeb-61aaac299d00b803452193ccffdee83dcce7cec4.zip |
assert everywhere rather than returning a result
Diffstat (limited to 'test/test_devices.cpp')
-rw-r--r-- | test/test_devices.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/test/test_devices.cpp b/test/test_devices.cpp index 0c93ea1..a6ae0b4 100644 --- a/test/test_devices.cpp +++ b/test/test_devices.cpp @@ -104,17 +104,14 @@ print_device_collection(cubeb_device_collection * collection, FILE * f) print_device_info(collection->device[i], f); } -int run_enumerating_devices_test() +TEST(cubeb, enumerate_devices) { int r; cubeb * ctx = NULL; cubeb_device_collection * collection = NULL; r = cubeb_init(&ctx, "Cubeb audio test", NULL); - if (r != CUBEB_OK) { - fprintf(stderr, "Error initializing cubeb library\n"); - return r; - } + ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library"; std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit(ctx, cubeb_destroy); @@ -126,12 +123,9 @@ int run_enumerating_devices_test() if (r == CUBEB_ERROR_NOT_SUPPORTED) { fprintf(stderr, "Device enumeration not supported" " for this backend, skipping this test.\n"); - return CUBEB_OK; - } - if (r != CUBEB_OK) { - fprintf(stderr, "Error enumerating devices %d\n", r); - return r; + r = CUBEB_OK; } + ASSERT_EQ(r, CUBEB_OK) << "Error enumerating devices " << r; fprintf(stdout, "Found %u input devices\n", collection->count); print_device_collection(collection, stdout); @@ -141,19 +135,9 @@ int run_enumerating_devices_test() cubeb_get_backend_id(ctx)); r = cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection); - if (r != CUBEB_OK) { - fprintf(stderr, "Error enumerating devices %d\n", r); - return r; - } + ASSERT_EQ(r, CUBEB_OK) << "Error enumerating devices " << r; fprintf(stdout, "Found %u output devices\n", collection->count); print_device_collection(collection, stdout); cubeb_device_collection_destroy(collection); - - return r; -} - -TEST(cubeb, enumerate_devices) -{ - ASSERT_EQ(run_enumerating_devices_test(), CUBEB_OK); } |