| 1 | #include <mil/PrecompiledHeaders.h>
|
|---|
| 2 | #include <boost/test/unit_test.hpp>
|
|---|
| 3 |
|
|---|
| 4 | /* ---------------------------------------
|
|---|
| 5 | select test
|
|---|
| 6 | --------------------------------------- */
|
|---|
| 7 |
|
|---|
| 8 | //#define def_test_FMTQueue
|
|---|
| 9 | //#define def_test_TSTL
|
|---|
| 10 | //#define def_test_fast_pool_allocator
|
|---|
| 11 | #define def_test_Module
|
|---|
| 12 | #define def_test_Thread
|
|---|
| 13 |
|
|---|
| 14 | /* ---------------------------------------
|
|---|
| 15 | test cases
|
|---|
| 16 | --------------------------------------- */
|
|---|
| 17 |
|
|---|
| 18 | #ifdef def_test_Module
|
|---|
| 19 |
|
|---|
| 20 | #include <mil/Module.h>
|
|---|
| 21 |
|
|---|
| 22 | #if defined(MIL_GUI_WINDOWS)
|
|---|
| 23 | # include <mil/gui-windows/GuiModule.h>
|
|---|
| 24 | #elif defined(MIL_GUI_COCOA)
|
|---|
| 25 | # include <mil/gui-cocoa/GuiModule.h>
|
|---|
| 26 | #else
|
|---|
| 27 | # include <mil/gui-cocoa/GuiModule.h>
|
|---|
| 28 | #endif
|
|---|
| 29 |
|
|---|
| 30 | namespace ns_test_Module
|
|---|
| 31 | {
|
|---|
| 32 | using namespace mil;
|
|---|
| 33 |
|
|---|
| 34 | struct FooEvent
|
|---|
| 35 | {
|
|---|
| 36 | int value;
|
|---|
| 37 | };
|
|---|
| 38 |
|
|---|
| 39 | struct BarEvent
|
|---|
| 40 | {
|
|---|
| 41 | int value;
|
|---|
| 42 | };
|
|---|
| 43 |
|
|---|
| 44 | struct InfinityIncEvent
|
|---|
| 45 | {
|
|---|
| 46 | };
|
|---|
| 47 |
|
|---|
| 48 | struct Plus5
|
|---|
| 49 | {
|
|---|
| 50 | };
|
|---|
| 51 |
|
|---|
| 52 | struct Minus3
|
|---|
| 53 | {
|
|---|
| 54 | };
|
|---|
| 55 |
|
|---|
| 56 | struct Plus5_3Times
|
|---|
| 57 | {
|
|---|
| 58 | int count;
|
|---|
| 59 | Plus5_3Times() : count(0)
|
|---|
| 60 | {
|
|---|
| 61 | }
|
|---|
| 62 | };
|
|---|
| 63 |
|
|---|
| 64 | struct Destroy
|
|---|
| 65 | {
|
|---|
| 66 | };
|
|---|
| 67 |
|
|---|
| 68 | struct AppendString
|
|---|
| 69 | {
|
|---|
| 70 | std::string* str;
|
|---|
| 71 | };
|
|---|
| 72 |
|
|---|
| 73 | int global = 0;
|
|---|
| 74 |
|
|---|
| 75 | struct FooModule : mil::Module<FooModule>
|
|---|
| 76 | {
|
|---|
| 77 | std::string str;
|
|---|
| 78 | void execute(AppendString& e)
|
|---|
| 79 | {
|
|---|
| 80 | str += *(e.str);
|
|---|
| 81 | delete e.str;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | void execute(FooEvent& e)
|
|---|
| 85 | {
|
|---|
| 86 | global = e.value;
|
|---|
| 87 | repostEvent();
|
|---|
| 88 | }
|
|---|
| 89 | void execute(BarEvent& e)
|
|---|
| 90 | {
|
|---|
| 91 | global = e.value;
|
|---|
| 92 | }
|
|---|
| 93 | void execute(InfinityIncEvent& i)
|
|---|
| 94 | {
|
|---|
| 95 | global++;
|
|---|
| 96 | repostEvent();
|
|---|
| 97 | }
|
|---|
| 98 | void execute(Plus5& e)
|
|---|
| 99 | {
|
|---|
| 100 | global += 5;
|
|---|
| 101 | }
|
|---|
| 102 | void execute(Minus3& e)
|
|---|
| 103 | {
|
|---|
| 104 | global -= 3;
|
|---|
| 105 | }
|
|---|
| 106 | void execute(Plus5_3Times& e)
|
|---|
| 107 | {
|
|---|
| 108 | e.count++;
|
|---|
| 109 | if (e.count <= 3)
|
|---|
| 110 | {
|
|---|
| 111 | global += 5;
|
|---|
| 112 | repostEvent();
|
|---|
| 113 | }
|
|---|
| 114 | }
|
|---|
| 115 | void execute(Destroy& e)
|
|---|
| 116 | {
|
|---|
| 117 | destroy();
|
|---|
| 118 | }
|
|---|
| 119 | };
|
|---|
| 120 | struct FooGuiModule : mil::GuiModule<FooGuiModule>
|
|---|
| 121 | {
|
|---|
| 122 | std::string str;
|
|---|
| 123 | void execute(AppendString& e)
|
|---|
| 124 | {
|
|---|
| 125 | str += *(e.str);
|
|---|
| 126 | delete e.str;
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 | void createUI()
|
|---|
| 130 | {
|
|---|
| 131 | }
|
|---|
| 132 | FooGuiModule()
|
|---|
| 133 | {
|
|---|
| 134 | #ifdef MIL_GUI_WINDOWS
|
|---|
| 135 | HINSTANCE hInstance = GetModuleHandle(NULL);
|
|---|
| 136 | const TCHAR ClassName[] = _T("GuiModuleTestajiodjrfau89a");
|
|---|
| 137 | int nCmdShow = SW_SHOW;
|
|---|
| 138 |
|
|---|
| 139 | WNDCLASSEX wc;
|
|---|
| 140 | wc.cbSize = sizeof(WNDCLASSEX);
|
|---|
| 141 | wc.style = CS_HREDRAW | CS_VREDRAW | WS_OVERLAPPED;
|
|---|
| 142 | wc.lpfnWndProc = DefWindowProc;
|
|---|
| 143 | wc.cbClsExtra = 0;
|
|---|
| 144 | wc.cbWndExtra = 0;
|
|---|
| 145 | wc.hInstance = hInstance;
|
|---|
| 146 | wc.hIcon = NULL;
|
|---|
| 147 | wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
|---|
| 148 | wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
|
|---|
| 149 | wc.lpszMenuName = NULL;
|
|---|
| 150 | wc.lpszClassName = ClassName;
|
|---|
| 151 | wc.hIconSm = NULL;
|
|---|
| 152 |
|
|---|
| 153 | RegisterClassEx(&wc);
|
|---|
| 154 |
|
|---|
| 155 | HWND hWnd = CreateWindowEx(
|
|---|
| 156 | 0, ClassName, _T("GuiModule Test"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
|
|---|
| 157 | CW_USEDEFAULT,200,50,NULL,NULL,hInstance,NULL
|
|---|
| 158 | );
|
|---|
| 159 | assert(IsWindow(hWnd));
|
|---|
| 160 | setWindow(hWnd);
|
|---|
| 161 |
|
|---|
| 162 | ShowWindow(hWnd, nCmdShow);
|
|---|
| 163 | UpdateWindow(hWnd);
|
|---|
| 164 | wndproc.set(hWnd);
|
|---|
| 165 | #endif
|
|---|
| 166 | createUI();
|
|---|
| 167 | }
|
|---|
| 168 | ~FooGuiModule()
|
|---|
| 169 | {
|
|---|
| 170 | destroy();
|
|---|
| 171 | execute_front();
|
|---|
| 172 | }
|
|---|
| 173 | void execute(FooEvent& e)
|
|---|
| 174 | {
|
|---|
| 175 | global = e.value;
|
|---|
| 176 | repostEvent();
|
|---|
| 177 | }
|
|---|
| 178 | void execute(BarEvent& e)
|
|---|
| 179 | {
|
|---|
| 180 | global = e.value;
|
|---|
| 181 | }
|
|---|
| 182 | void execute(InfinityIncEvent& i)
|
|---|
| 183 | {
|
|---|
| 184 | global++;
|
|---|
| 185 | repostEvent();
|
|---|
| 186 | }
|
|---|
| 187 | void execute(Plus5& e)
|
|---|
| 188 | {
|
|---|
| 189 | global += 5;
|
|---|
| 190 | }
|
|---|
| 191 | void execute(Minus3& e)
|
|---|
| 192 | {
|
|---|
| 193 | global -= 3;
|
|---|
| 194 | }
|
|---|
| 195 | void execute(Plus5_3Times& e)
|
|---|
| 196 | {
|
|---|
| 197 | e.count++;
|
|---|
| 198 | if (e.count <= 3)
|
|---|
| 199 | {
|
|---|
| 200 | global += 5;
|
|---|
| 201 | repostEvent();
|
|---|
| 202 | }
|
|---|
| 203 | }
|
|---|
| 204 | void execute(Destroy& e)
|
|---|
| 205 | {
|
|---|
| 206 | destroy();
|
|---|
| 207 | }
|
|---|
| 208 | };
|
|---|
| 209 | template <typename TestModuleType>
|
|---|
| 210 | void test()
|
|---|
| 211 | {
|
|---|
| 212 | {
|
|---|
| 213 | mil::Tls tls;
|
|---|
| 214 | TestModuleType m;
|
|---|
| 215 | FooEvent e = {100};
|
|---|
| 216 | m.post(e, tls);
|
|---|
| 217 | global = 0;
|
|---|
| 218 | m.execute_front();
|
|---|
| 219 | BOOST_REQUIRE(global == 100);
|
|---|
| 220 | global = 0;
|
|---|
| 221 | m.execute_front();
|
|---|
| 222 | BOOST_REQUIRE(global == 100);
|
|---|
| 223 | }
|
|---|
| 224 | {
|
|---|
| 225 | mil::Tls tls;
|
|---|
| 226 | global = 0;
|
|---|
| 227 | TestModuleType m;
|
|---|
| 228 | InfinityIncEvent i;
|
|---|
| 229 | m.post(i, tls);
|
|---|
| 230 | m.execute_front();
|
|---|
| 231 | m.execute_front();
|
|---|
| 232 | m.execute_front();
|
|---|
| 233 | BOOST_REQUIRE(global == 3);
|
|---|
| 234 | }
|
|---|
| 235 | {
|
|---|
| 236 | mil::Tls tls;
|
|---|
| 237 | global = 0;
|
|---|
| 238 | TestModuleType foo;
|
|---|
| 239 | Plus5 p;
|
|---|
| 240 | InfinityIncEvent i;
|
|---|
| 241 | Minus3 m;
|
|---|
| 242 | foo.post(p, tls);
|
|---|
| 243 | foo.post(p, tls);
|
|---|
| 244 | foo.post(m, tls);
|
|---|
| 245 | foo.post(i, tls);
|
|---|
| 246 | foo.post(p, tls);
|
|---|
| 247 | foo.post(i, tls);
|
|---|
| 248 |
|
|---|
| 249 | foo.execute_front();
|
|---|
| 250 | BOOST_REQUIRE(global == 5);
|
|---|
| 251 | foo.execute_front();
|
|---|
| 252 | BOOST_REQUIRE(global == 10);
|
|---|
| 253 | foo.execute_front();
|
|---|
| 254 | BOOST_REQUIRE(global == 7);
|
|---|
| 255 | foo.execute_front();
|
|---|
| 256 | BOOST_REQUIRE(global == 8);
|
|---|
| 257 | foo.execute_front();
|
|---|
| 258 | BOOST_REQUIRE(global == 13);
|
|---|
| 259 | foo.execute_front();
|
|---|
| 260 | BOOST_REQUIRE(global == 14);
|
|---|
| 261 | foo.execute_front();
|
|---|
| 262 | BOOST_REQUIRE(global == 15);
|
|---|
| 263 | foo.execute_front();
|
|---|
| 264 | BOOST_REQUIRE(global == 16);
|
|---|
| 265 | foo.execute_front();
|
|---|
| 266 | BOOST_REQUIRE(global == 17);
|
|---|
| 267 | }
|
|---|
| 268 | {
|
|---|
| 269 | mil::Tls tls;
|
|---|
| 270 | global = 3;
|
|---|
| 271 | TestModuleType foo;
|
|---|
| 272 |
|
|---|
| 273 | AppendString s1;
|
|---|
| 274 | s1.str = new std::string("foo");
|
|---|
| 275 | foo.post(s1, tls);
|
|---|
| 276 | foo.execute_front();
|
|---|
| 277 | BOOST_REQUIRE(foo.str == "foo");
|
|---|
| 278 | Plus5_3Times p5_3;
|
|---|
| 279 | foo.post(p5_3, tls);
|
|---|
| 280 | BOOST_REQUIRE(global == 3);
|
|---|
| 281 | foo.execute_front();
|
|---|
| 282 | BOOST_REQUIRE(global == 8);
|
|---|
| 283 | foo.execute_front();
|
|---|
| 284 | BOOST_REQUIRE(global == 13);
|
|---|
| 285 | foo.execute_front();
|
|---|
| 286 | BOOST_REQUIRE(global == 18);
|
|---|
| 287 | foo.execute_front();
|
|---|
| 288 | BOOST_REQUIRE(global == 18);
|
|---|
| 289 | foo.execute_front();
|
|---|
| 290 | BOOST_REQUIRE(global == 18);
|
|---|
| 291 | AppendString s2;
|
|---|
| 292 | s2.str = new std::string("bar");
|
|---|
| 293 | foo.post(s2, tls);
|
|---|
| 294 | foo.execute_front();
|
|---|
| 295 | BOOST_REQUIRE(foo.str == "foobar");
|
|---|
| 296 | }
|
|---|
| 297 | }
|
|---|
| 298 |
|
|---|
| 299 | }
|
|---|
| 300 | BOOST_AUTO_TEST_CASE(test_Module)
|
|---|
| 301 | {
|
|---|
| 302 | using namespace ns_test_Module;
|
|---|
| 303 | test<FooModule>();
|
|---|
| 304 | test<FooGuiModule>();
|
|---|
| 305 | }
|
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| 308 | #endif
|
|---|
| 309 |
|
|---|
| 310 | #ifdef def_test_Thread
|
|---|
| 311 | #include <mil/Thread.h>
|
|---|
| 312 |
|
|---|
| 313 | namespace ns_test_Thread
|
|---|
| 314 | {
|
|---|
| 315 | struct FooRunnableModule : public ns_test_Module::FooModule
|
|---|
| 316 | {
|
|---|
| 317 | void run()
|
|---|
| 318 | {
|
|---|
| 319 | loop();
|
|---|
| 320 | }
|
|---|
| 321 | };
|
|---|
| 322 | struct FooRunnableGuiModule : public ns_test_Module::FooGuiModule
|
|---|
| 323 | {
|
|---|
| 324 | void run()
|
|---|
| 325 | {
|
|---|
| 326 | loop();
|
|---|
| 327 | }
|
|---|
| 328 | };
|
|---|
| 329 | template <typename TestModuleType>
|
|---|
| 330 | void test()
|
|---|
| 331 | {
|
|---|
| 332 | using namespace mil;
|
|---|
| 333 | using namespace ns_test_Module;
|
|---|
| 334 | {
|
|---|
| 335 | TestModuleType t;
|
|---|
| 336 | }
|
|---|
| 337 | {
|
|---|
| 338 | TestModuleType t;
|
|---|
| 339 | t.start();
|
|---|
| 340 | }
|
|---|
| 341 | {
|
|---|
| 342 | mil::Tls tls;
|
|---|
| 343 | TestModuleType m;
|
|---|
| 344 | FooEvent e = {100};
|
|---|
| 345 | m.post(e, tls);
|
|---|
| 346 | global = 0;
|
|---|
| 347 | m.execute_front();
|
|---|
| 348 | BOOST_REQUIRE(global == 100);
|
|---|
| 349 | global = 0;
|
|---|
| 350 | m.execute_front();
|
|---|
| 351 | BOOST_REQUIRE(global == 100);
|
|---|
| 352 | }
|
|---|
| 353 | {
|
|---|
| 354 | mil::Tls tls;
|
|---|
| 355 | global = 0;
|
|---|
| 356 | TestModuleType m;
|
|---|
| 357 | InfinityIncEvent i;
|
|---|
| 358 | m.post(i, tls);
|
|---|
| 359 | m.execute_front();
|
|---|
| 360 | m.execute_front();
|
|---|
| 361 | m.execute_front();
|
|---|
| 362 | BOOST_REQUIRE(global == 3);
|
|---|
| 363 | }
|
|---|
| 364 | {
|
|---|
| 365 | mil::Tls tls;
|
|---|
| 366 | global = 0;
|
|---|
| 367 | TestModuleType foo;
|
|---|
| 368 | Plus5 p;
|
|---|
| 369 | InfinityIncEvent i;
|
|---|
| 370 | Minus3 m;
|
|---|
| 371 | foo.post(p, tls);
|
|---|
| 372 | foo.post(p, tls);
|
|---|
| 373 | foo.post(m, tls);
|
|---|
| 374 | foo.post(i, tls);
|
|---|
| 375 | foo.post(p, tls);
|
|---|
| 376 | foo.post(i, tls);
|
|---|
| 377 |
|
|---|
| 378 | foo.execute_front();
|
|---|
| 379 | BOOST_REQUIRE(global == 5);
|
|---|
| 380 | foo.execute_front();
|
|---|
| 381 | BOOST_REQUIRE(global == 10);
|
|---|
| 382 | foo.execute_front();
|
|---|
| 383 | BOOST_REQUIRE(global == 7);
|
|---|
| 384 | foo.execute_front();
|
|---|
| 385 | BOOST_REQUIRE(global == 8);
|
|---|
| 386 | foo.execute_front();
|
|---|
| 387 | BOOST_REQUIRE(global == 13);
|
|---|
| 388 | foo.execute_front();
|
|---|
| 389 | BOOST_REQUIRE(global == 14);
|
|---|
| 390 | foo.execute_front();
|
|---|
| 391 | BOOST_REQUIRE(global == 15);
|
|---|
| 392 | foo.execute_front();
|
|---|
| 393 | BOOST_REQUIRE(global == 16);
|
|---|
| 394 | foo.execute_front();
|
|---|
| 395 | BOOST_REQUIRE(global == 17);
|
|---|
| 396 | }
|
|---|
| 397 | {
|
|---|
| 398 | mil::Tls tls;
|
|---|
| 399 | global = 3;
|
|---|
| 400 | TestModuleType foo;
|
|---|
| 401 | Plus5_3Times p5_3;
|
|---|
| 402 | foo.post(p5_3, tls);
|
|---|
| 403 | BOOST_REQUIRE(global == 3);
|
|---|
| 404 | foo.execute_front();
|
|---|
| 405 | BOOST_REQUIRE(global == 8);
|
|---|
| 406 | foo.execute_front();
|
|---|
| 407 | BOOST_REQUIRE(global == 13);
|
|---|
| 408 | foo.execute_front();
|
|---|
| 409 | BOOST_REQUIRE(global == 18);
|
|---|
| 410 | foo.execute_front();
|
|---|
| 411 | BOOST_REQUIRE(global == 18);
|
|---|
| 412 | foo.execute_front();
|
|---|
| 413 | BOOST_REQUIRE(global == 18);
|
|---|
| 414 | }
|
|---|
| 415 | }
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 | BOOST_AUTO_TEST_CASE(test_Thread)
|
|---|
| 420 | {
|
|---|
| 421 | using namespace ns_test_Thread;
|
|---|
| 422 | test<FooRunnableModule>();
|
|---|
| 423 | test<FooRunnableGuiModule>();
|
|---|
| 424 | BOOST_CHECK(true);
|
|---|
| 425 | }
|
|---|
| 426 | #endif
|
|---|
| 427 |
|
|---|
| 428 | #ifdef def_test_fast_pool_allocator
|
|---|
| 429 | #include <boost/thread.hpp>
|
|---|
| 430 | #include <boost/thread/mutex.hpp>
|
|---|
| 431 | #include <boost/intrusive/slist.hpp>
|
|---|
| 432 | #include <boost/intrusive/slist_hook.hpp>
|
|---|
| 433 | #include <boost/intrusive/list.hpp>
|
|---|
| 434 | #include <boost/intrusive/list_hook.hpp>
|
|---|
| 435 | #include <boost/pool/object_pool.hpp>
|
|---|
| 436 | #include <boost/pool/pool.hpp>
|
|---|
| 437 | #include <boost/pool/singleton_pool.hpp>
|
|---|
| 438 | #include <boost/pool/pool_alloc.hpp>
|
|---|
| 439 |
|
|---|
| 440 | boost::details::pool::default_mutex m;
|
|---|
| 441 | boost::mutex m2;
|
|---|
| 442 |
|
|---|
| 443 | class Foo : public boost::intrusive::slist_base_hook<>
|
|---|
| 444 | {
|
|---|
| 445 | public:
|
|---|
| 446 | int value;
|
|---|
| 447 | };
|
|---|
| 448 | class MyObject
|
|---|
| 449 | : public boost::intrusive::slist_base_hook<>
|
|---|
| 450 | {
|
|---|
| 451 | public:
|
|---|
| 452 | MyObject(int v) : value(v) {}
|
|---|
| 453 | int value;
|
|---|
| 454 | };
|
|---|
| 455 | BOOST_AUTO_TEST_CASE(test_fast_pool_allocator)
|
|---|
| 456 | //int main()
|
|---|
| 457 | {
|
|---|
| 458 | //std::list<int, boost::fast_pool_allocator<int> > l;
|
|---|
| 459 | //l.push_back(100);
|
|---|
| 460 | //BOOST_CHECK(l.front() == 100);
|
|---|
| 461 | //int i = rand();
|
|---|
| 462 | //l.push_back(i);
|
|---|
| 463 | //BOOST_CHECK(l.back() == i);
|
|---|
| 464 | //BOOST_CHECK(l.front() == 100);
|
|---|
| 465 | //l.pop_back();
|
|---|
| 466 | //BOOST_CHECK(l.back() == 100);
|
|---|
| 467 |
|
|---|
| 468 | MyObject* pa;
|
|---|
| 469 | {
|
|---|
| 470 | boost::details::pool::guard<boost::details::pool::default_mutex> g(m);
|
|---|
| 471 | //boost::mutex::scoped_lock lk(m2);
|
|---|
| 472 | pa = new MyObject(100);
|
|---|
| 473 | }
|
|---|
| 474 | {
|
|---|
| 475 | boost::intrusive::slist<MyObject> l;
|
|---|
| 476 | l.push_front(*pa);
|
|---|
| 477 | //l.push_back(*f);
|
|---|
| 478 | char aaa[sizeof(l)+1] = {};
|
|---|
| 479 | memcpy(aaa, (char*)&l, sizeof(l));
|
|---|
| 480 | printf("TEST %s TEST\n", aaa);
|
|---|
| 481 | }
|
|---|
| 482 | {
|
|---|
| 483 | //boost::mutex::scoped_lock lk(m2);
|
|---|
| 484 | boost::details::pool::guard<boost::details::pool::default_mutex> g(m);
|
|---|
| 485 | delete pa;
|
|---|
| 486 | }
|
|---|
| 487 | }
|
|---|
| 488 | #endif
|
|---|
| 489 |
|
|---|
| 490 | #ifdef def_test_TSTL
|
|---|
| 491 |
|
|---|
| 492 | #include <TSTL/TSTL.h>
|
|---|
| 493 | #include <TSTL/queue.h>
|
|---|
| 494 |
|
|---|
| 495 | BOOST_AUTO_TEST_CASE(test_TSTL)
|
|---|
| 496 | {
|
|---|
| 497 | Queue<int> q;
|
|---|
| 498 | }
|
|---|
| 499 | #endif
|
|---|
| 500 |
|
|---|
| 501 | #ifdef def_test_FMTQueue
|
|---|
| 502 |
|
|---|
| 503 | #include <fecti/config.h>
|
|---|
| 504 | #include <fecti/Utility/FMTQueue.h>
|
|---|
| 505 |
|
|---|
| 506 | BOOST_AUTO_TEST_CASE(test_FMTQueue)
|
|---|
| 507 | {
|
|---|
| 508 | fecti::util::FMTQueue<int> queue(10);
|
|---|
| 509 | queue.push(100);
|
|---|
| 510 | int j = 0;
|
|---|
| 511 | queue.pop(&j);
|
|---|
| 512 | BOOST_CHECK(j == 100);
|
|---|
| 513 |
|
|---|
| 514 | int i = rand();
|
|---|
| 515 | queue.push(i);
|
|---|
| 516 | queue.pop(&j);
|
|---|
| 517 | BOOST_CHECK(j == i);
|
|---|
| 518 | }
|
|---|
| 519 |
|
|---|
| 520 | #endif
|
|---|