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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 // Wait until data is received. | 97 // Wait until data is received. |
98 listener->Join(); | 98 listener->Join(); |
99 | 99 |
100 // Check that data received is the same as data send. | 100 // Check that data received is the same as data send. |
101 for (int i = 0; i < len; i++) { | 101 for (int i = 0; i < len; i++) { |
102 CHECK(data[i] == listener->data()[i]); | 102 CHECK(data[i] == listener->data()[i]); |
103 } | 103 } |
104 | 104 |
105 // Close the client before the listener to avoid TIME_WAIT issues. | 105 // Close the client before the listener to avoid TIME_WAIT issues. |
| 106 client->Close(); |
106 delete client; | 107 delete client; |
107 delete listener; | 108 delete listener; |
108 } | 109 } |
109 | 110 |
110 | 111 |
111 TEST(Socket) { | 112 TEST(Socket) { |
112 bool ok; | 113 bool ok; |
113 | 114 |
114 // Initialize socket support. | 115 // Initialize socket support. |
115 ok = Socket::Setup(); | 116 ok = Socket::Setup(); |
(...skipping 22 matching lines...) Expand all Loading... |
138 } | 139 } |
139 | 140 |
140 | 141 |
141 TEST(HToNNToH) { | 142 TEST(HToNNToH) { |
142 uint16_t x = 1234; | 143 uint16_t x = 1234; |
143 CHECK_EQ(x, Socket::NToH(Socket::HToN(x))); | 144 CHECK_EQ(x, Socket::NToH(Socket::HToN(x))); |
144 | 145 |
145 uint32_t y = 12345678; | 146 uint32_t y = 12345678; |
146 CHECK(y == Socket::NToH(Socket::HToN(y))); | 147 CHECK(y == Socket::NToH(Socket::HToN(y))); |
147 } | 148 } |
OLD | NEW |