1 #include <gtest/gtest.h> 2 3 extern "C" { 4 #include "thread.h" 5 #include "osi.h" 6 } 7 8 TEST(ThreadTest, test_new_simple) { 9 thread_t *thread = thread_new("test_thread"); 10 ASSERT_TRUE(thread != NULL); 11 thread_free(thread); 12 } 13 14 TEST(ThreadTest, test_free_simple) { 15 thread_t *thread = thread_new("test_thread"); 16 thread_free(thread); 17 } 18 19 TEST(ThreadTest, test_name) { 20 thread_t *thread = thread_new("test_name"); 21 ASSERT_STREQ(thread_name(thread), "test_name"); 22 thread_free(thread); 23 } 24 25 TEST(ThreadTest, test_long_name) { 26 thread_t *thread = thread_new("0123456789abcdef"); 27 ASSERT_STREQ("0123456789abcdef", thread_name(thread)); 28 thread_free(thread); 29 } 30 31 TEST(ThreadTest, test_very_long_name) { 32 thread_t *thread = thread_new("0123456789abcdefg"); 33 ASSERT_STREQ("0123456789abcdef", thread_name(thread)); 34 thread_free(thread); 35 } 36