| 463 | } |
| 464 | |
| 465 | void concurrent_proc(void* p) { |
| 466 | for (int i = 0; i < 10000; ++i) { |
| 467 | butil::EndPoint ep; |
| 468 | std::string str("127.0.0.1:8080"); |
| 469 | ASSERT_EQ(0, butil::str2endpoint(str.c_str(), &ep)); |
| 470 | ASSERT_EQ(str, butil::endpoint2str(ep).c_str()); |
| 471 | |
| 472 | str.assign("[::1]:8080"); |
| 473 | ASSERT_EQ(0, butil::str2endpoint(str.c_str(), &ep)); |
| 474 | ASSERT_EQ(str, butil::endpoint2str(ep).c_str()); |
| 475 | |
| 476 | str.assign("unix:test.sock"); |
| 477 | ASSERT_EQ(0, butil::str2endpoint(str.c_str(), &ep)); |
| 478 | ASSERT_EQ(str, butil::endpoint2str(ep).c_str()); |
| 479 | } |
| 480 | *(int*)p = 1; |
| 481 | } |
| 482 | |
| 483 | TEST(EndPointTest, endpoint_concurrency) { |
| 484 | const int T = 5; |
no test coverage detected