| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 | 2 |
| 3 #include "v8.h" | 3 #include "v8.h" |
| 4 #include "platform.h" | 4 #include "platform.h" |
| 5 #include "cctest.h" | 5 #include "cctest.h" |
| 6 | 6 |
| 7 | 7 |
| 8 using namespace ::v8::internal; | 8 using namespace ::v8::internal; |
| 9 | 9 |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // Wait until data is received. | 99 // Wait until data is received. |
| 100 listener->Join(); | 100 listener->Join(); |
| 101 | 101 |
| 102 // Check that data received is the same as data send. | 102 // Check that data received is the same as data send. |
| 103 for (int i = 0; i < len; i++) { | 103 for (int i = 0; i < len; i++) { |
| 104 CHECK(data[i] == listener->data()[i]); | 104 CHECK(data[i] == listener->data()[i]); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Close the client before the listener to avoid TIME_WAIT issues. | 107 // Close the client before the listener to avoid TIME_WAIT issues. |
| 108 client->Close(); | 108 client->Shutdown(); |
| 109 delete client; | 109 delete client; |
| 110 delete listener; | 110 delete listener; |
| 111 } | 111 } |
| 112 | 112 |
| 113 | 113 |
| 114 TEST(Socket) { | 114 TEST(Socket) { |
| 115 bool ok; | 115 bool ok; |
| 116 | 116 |
| 117 // Initialize socket support. | 117 // Initialize socket support. |
| 118 ok = Socket::Setup(); | 118 ok = Socket::Setup(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 | 145 |
| 146 TEST(HToNNToH) { | 146 TEST(HToNNToH) { |
| 147 uint16_t x = 1234; | 147 uint16_t x = 1234; |
| 148 CHECK_EQ(x, Socket::NToH(Socket::HToN(x))); | 148 CHECK_EQ(x, Socket::NToH(Socket::HToN(x))); |
| 149 | 149 |
| 150 uint32_t y = 12345678; | 150 uint32_t y = 12345678; |
| 151 CHECK(y == Socket::NToH(Socket::HToN(y))); | 151 CHECK(y == Socket::NToH(Socket::HToN(y))); |
| 152 } | 152 } |
| OLD | NEW |