aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_tone.cpp
diff options
context:
space:
mode:
authorMatthew Gregan <[email protected]>2016-11-10 15:48:17 +1300
committerMatthew Gregan <[email protected]>2016-11-11 09:44:29 +1300
commit55ed801cfd9063ea6f18fb7578866cee8ce474c7 (patch)
tree70c29c27faca586a79b3d1f9331922f915c089b5 /test/test_tone.cpp
parent0d45a294eed3a1631afb35ee2b41bfe64c44b67f (diff)
downloadcubeb-55ed801cfd9063ea6f18fb7578866cee8ce474c7.tar.gz
cubeb-55ed801cfd9063ea6f18fb7578866cee8ce474c7.zip
Convert tests to gtests.
Diffstat (limited to 'test/test_tone.cpp')
-rw-r--r--test/test_tone.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/test/test_tone.cpp b/test/test_tone.cpp
index 7a3c762..a66c20f 100644
--- a/test/test_tone.cpp
+++ b/test/test_tone.cpp
@@ -6,16 +6,12 @@
*/
/* libcubeb api/function test. Plays a simple tone. */
-#ifdef NDEBUG
-#undef NDEBUG
-#endif
#define _XOPEN_SOURCE 600
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
-#include <assert.h>
#include <limits.h>
-
+#include "gtest/gtest.h"
#include "cubeb/cubeb.h"
#include "common.h"
@@ -95,7 +91,7 @@ void state_cb(cubeb_stream *stream, void *user, cubeb_state state)
return;
}
-int main(int /*argc*/, char * /*argv*/[])
+TEST(tone, main)
{
cubeb *ctx;
cubeb_stream *stream;
@@ -106,7 +102,7 @@ int main(int /*argc*/, char * /*argv*/[])
r = cubeb_init(&ctx, "Cubeb tone example");
if (r != CUBEB_OK) {
fprintf(stderr, "Error initializing cubeb library\n");
- return r;
+ ASSERT_EQ(r, CUBEB_OK);
}
params.format = STREAM_FORMAT;
@@ -116,7 +112,7 @@ int main(int /*argc*/, char * /*argv*/[])
user_data = (struct cb_user_data *) malloc(sizeof(*user_data));
if (user_data == NULL) {
fprintf(stderr, "Error allocating user data\n");
- return CUBEB_ERROR;
+ ASSERT_EQ(r, CUBEB_OK);
}
user_data->position = 0;
@@ -124,7 +120,7 @@ int main(int /*argc*/, char * /*argv*/[])
4096, data_cb, state_cb, user_data);
if (r != CUBEB_OK) {
fprintf(stderr, "Error initializing cubeb stream\n");
- return r;
+ ASSERT_EQ(r, CUBEB_OK);
}
cubeb_stream_start(stream);
@@ -134,9 +130,7 @@ int main(int /*argc*/, char * /*argv*/[])
cubeb_stream_destroy(stream);
cubeb_destroy(ctx);
- assert(user_data->position);
+ ASSERT_TRUE(user_data->position);
free(user_data);
-
- return CUBEB_OK;
}