| 153 | // test_constructors ---------------------------------------------------------------// |
| 154 | |
| 155 | void test_constructors() |
| 156 | { |
| 157 | std::cout << "testing constructors..." << std::endl; |
| 158 | |
| 159 | path x0; // default constructor |
| 160 | PATH_IS(x0, L""); |
| 161 | BOOST_TEST_EQ(x0.native().size(), 0U); |
| 162 | |
| 163 | path x1(l.begin(), l.end()); // iterator range char |
| 164 | PATH_IS(x1, L"string"); |
| 165 | BOOST_TEST_EQ(x1.native().size(), 6U); |
| 166 | |
| 167 | path x2(x1); // copy constructor |
| 168 | PATH_IS(x2, L"string"); |
| 169 | BOOST_TEST_EQ(x2.native().size(), 6U); |
| 170 | |
| 171 | path x3(wl.begin(), wl.end()); // iterator range wchar_t |
| 172 | PATH_IS(x3, L"wstring"); |
| 173 | BOOST_TEST_EQ(x3.native().size(), 7U); |
| 174 | |
| 175 | // contiguous containers |
| 176 | path x4(string("std::string")); // std::string |
| 177 | PATH_IS(x4, L"std::string"); |
| 178 | BOOST_TEST_EQ(x4.native().size(), 11U); |
| 179 | |
| 180 | path x5(wstring(L"std::wstring")); // std::wstring |
| 181 | PATH_IS(x5, L"std::wstring"); |
| 182 | BOOST_TEST_EQ(x5.native().size(), 12U); |
| 183 | |
| 184 | path x6("array char"); // array char |
| 185 | PATH_IS(x6, L"array char"); |
| 186 | BOOST_TEST_EQ(x6.native().size(), 10U); |
| 187 | |
| 188 | path x7(L"array wchar_t"); // array wchar_t |
| 189 | PATH_IS(x7, L"array wchar_t"); |
| 190 | BOOST_TEST_EQ(x7.native().size(), 13U); |
| 191 | |
| 192 | char char_array[100]; |
| 193 | std::strcpy(char_array, "big array char"); |
| 194 | path x6o(char_array); // array char, only partially full |
| 195 | PATH_IS(x6o, L"big array char"); |
| 196 | BOOST_TEST_EQ(x6o.native().size(), 14U); |
| 197 | |
| 198 | wchar_t wchar_array[100]; |
| 199 | std::wcscpy(wchar_array, L"big array wchar_t"); |
| 200 | path x7o(wchar_array); // array char, only partially full |
| 201 | PATH_IS(x7o, L"big array wchar_t"); |
| 202 | BOOST_TEST_EQ(x7o.native().size(), 17U); |
| 203 | |
| 204 | path x8(s.c_str()); // const char* null terminated |
| 205 | PATH_IS(x8, L"string"); |
| 206 | BOOST_TEST_EQ(x8.native().size(), 6U); |
| 207 | |
| 208 | path x9(ws.c_str()); // const wchar_t* null terminated |
| 209 | PATH_IS(x9, L"wstring"); |
| 210 | BOOST_TEST_EQ(x9.native().size(), 7U); |
| 211 | |
| 212 | path x8nc(const_cast< char* >(s.c_str())); // char* null terminated |