| 324 | |
| 325 | |
| 326 | void test_copy() |
| 327 | { |
| 328 | { |
| 329 | graph<int,int>::kernel_1a_c a,b; |
| 330 | |
| 331 | a.set_number_of_nodes(3); |
| 332 | a.node(0).data = 1; |
| 333 | a.node(1).data = 2; |
| 334 | a.node(2).data = 3; |
| 335 | a.add_edge(0,1); |
| 336 | a.add_edge(0,2); |
| 337 | edge(a,0,1) = 4; |
| 338 | edge(a,0,2) = 5; |
| 339 | |
| 340 | a.add_edge(0,0); |
| 341 | edge(a,0,0) = 9; |
| 342 | copy_graph(a, b); |
| 343 | |
| 344 | DLIB_TEST(b.number_of_nodes() == 3); |
| 345 | DLIB_TEST(b.node(0).data == 1); |
| 346 | DLIB_TEST(b.node(1).data == 2); |
| 347 | DLIB_TEST(b.node(2).data == 3); |
| 348 | DLIB_TEST(edge(b,0,1) == 4); |
| 349 | DLIB_TEST(edge(b,0,2) == 5); |
| 350 | DLIB_TEST(edge(b,0,0) == 9); |
| 351 | } |
| 352 | { |
| 353 | graph<int,int>::kernel_1a_c a,b; |
| 354 | |
| 355 | a.set_number_of_nodes(4); |
| 356 | a.node(0).data = 1; |
| 357 | a.node(1).data = 2; |
| 358 | a.node(2).data = 3; |
| 359 | a.node(3).data = 8; |
| 360 | a.add_edge(0,1); |
| 361 | a.add_edge(0,2); |
| 362 | a.add_edge(2,3); |
| 363 | edge(a,0,1) = 4; |
| 364 | edge(a,0,2) = 5; |
| 365 | edge(a,2,3) = 6; |
| 366 | |
| 367 | copy_graph(a, b); |
| 368 | |
| 369 | DLIB_TEST(b.number_of_nodes() == 4); |
| 370 | DLIB_TEST(b.node(0).data == 1); |
| 371 | DLIB_TEST(b.node(1).data == 2); |
| 372 | DLIB_TEST(b.node(2).data == 3); |
| 373 | DLIB_TEST(b.node(3).data == 8); |
| 374 | DLIB_TEST(edge(b,0,1) == 4); |
| 375 | DLIB_TEST(edge(b,0,2) == 5); |
| 376 | DLIB_TEST(edge(b,2,3) == 6); |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | |
| 381 |
no test coverage detected