diff options
| author | Zach Johnson <zachoverflow@google.com> | 2014-08-25 23:22:24 -0700 |
|---|---|---|
| committer | Andre Eisenbach <eisenbach@google.com> | 2015-03-16 16:51:30 -0700 |
| commit | 384f8a948e9837475c4f504a626205334522df2a (patch) | |
| tree | 75db903b551055688f319e6acb988a2cd9bf0f8a /osi/test/thread_test.cpp | |
| parent | ad3067b83e4d309b4027a4e9b44b0a614f267da8 (diff) | |
| download | android_system_bt-384f8a948e9837475c4f504a626205334522df2a.tar.gz android_system_bt-384f8a948e9837475c4f504a626205334522df2a.tar.bz2 android_system_bt-384f8a948e9837475c4f504a626205334522df2a.zip | |
Move some of osi to use the allocation interfaces
Also changes some tests to ensure all memory freed.
Diffstat (limited to 'osi/test/thread_test.cpp')
| -rw-r--r-- | osi/test/thread_test.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/osi/test/thread_test.cpp b/osi/test/thread_test.cpp index 32f8c287f..d692f5a30 100644 --- a/osi/test/thread_test.cpp +++ b/osi/test/thread_test.cpp @@ -1,5 +1,7 @@ #include <gtest/gtest.h> +#include "AllocationTestHarness.h" + extern "C" { #include <sys/select.h> #include <utils/Log.h> @@ -10,30 +12,32 @@ extern "C" { #include "osi.h" } -TEST(ThreadTest, test_new_simple) { +class ThreadTest : public AllocationTestHarness {}; + +TEST_F(ThreadTest, test_new_simple) { thread_t *thread = thread_new("test_thread"); ASSERT_TRUE(thread != NULL); thread_free(thread); } -TEST(ThreadTest, test_free_simple) { +TEST_F(ThreadTest, test_free_simple) { thread_t *thread = thread_new("test_thread"); thread_free(thread); } -TEST(ThreadTest, test_name) { +TEST_F(ThreadTest, test_name) { thread_t *thread = thread_new("test_name"); ASSERT_STREQ(thread_name(thread), "test_name"); thread_free(thread); } -TEST(ThreadTest, test_long_name) { +TEST_F(ThreadTest, test_long_name) { thread_t *thread = thread_new("0123456789abcdef"); ASSERT_STREQ("0123456789abcdef", thread_name(thread)); thread_free(thread); } -TEST(ThreadTest, test_very_long_name) { +TEST_F(ThreadTest, test_very_long_name) { thread_t *thread = thread_new("0123456789abcdefg"); ASSERT_STREQ("0123456789abcdef", thread_name(thread)); thread_free(thread); @@ -44,13 +48,13 @@ static void thread_is_self_fn(void *context) { EXPECT_TRUE(thread_is_self(thread)); } -TEST(ThreadTest, test_thread_is_self) { +TEST_F(ThreadTest, test_thread_is_self) { thread_t *thread = thread_new("test_thread"); thread_post(thread, thread_is_self_fn, thread); thread_free(thread); } -TEST(ThreadTest, test_thread_is_not_self) { +TEST_F(ThreadTest, test_thread_is_not_self) { thread_t *thread = thread_new("test_thread"); EXPECT_FALSE(thread_is_self(thread)); thread_free(thread); |
