MCPcopy Create free account
hub / github.com/davisking/dlib / test_copy

Function test_copy

dlib/test/directed_graph.cpp:448–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446
447
448 void test_copy()
449 {
450 {
451 directed_graph<int,int>::kernel_1a_c a,b;
452
453 a.set_number_of_nodes(3);
454 a.node(0).data = 1;
455 a.node(1).data = 2;
456 a.node(2).data = 3;
457 a.add_edge(0,1);
458 a.add_edge(1,0);
459 a.add_edge(0,2);
460 edge(a,0,1) = 4;
461 edge(a,1,0) = 3;
462 edge(a,0,2) = 5;
463
464 a.add_edge(0,0);
465 edge(a,0,0) = 9;
466 copy_graph(a, b);
467
468 DLIB_TEST(b.number_of_nodes() == 3);
469 DLIB_TEST(b.node(0).data == 1);
470 DLIB_TEST(b.node(1).data == 2);
471 DLIB_TEST(b.node(2).data == 3);
472 DLIB_TEST(edge(b,0,1) == 4);
473 DLIB_TEST(edge(b,1,0) == 3);
474 DLIB_TEST(edge(b,0,2) == 5);
475 DLIB_TEST(edge(b,0,0) == 9);
476 }
477 {
478 directed_graph<int,int>::kernel_1a_c a,b;
479
480 a.set_number_of_nodes(4);
481 a.node(0).data = 1;
482 a.node(1).data = 2;
483 a.node(2).data = 3;
484 a.node(3).data = 8;
485 a.add_edge(0,1);
486 a.add_edge(0,2);
487 a.add_edge(2,3);
488 a.add_edge(3,2);
489 edge(a,0,1) = 4;
490 edge(a,0,2) = 5;
491 edge(a,2,3) = 6;
492 edge(a,3,2) = 3;
493
494 copy_graph(a, b);
495
496 DLIB_TEST(b.number_of_nodes() == 4);
497 DLIB_TEST(b.node(0).data == 1);
498 DLIB_TEST(b.node(1).data == 2);
499 DLIB_TEST(b.node(2).data == 3);
500 DLIB_TEST(b.node(3).data == 8);
501 DLIB_TEST(edge(b,0,1) == 4);
502 DLIB_TEST(edge(b,0,2) == 5);
503 DLIB_TEST(edge(b,2,3) == 6);
504 DLIB_TEST(edge(b,3,2) == 3);
505 }

Callers 1

perform_testMethod · 0.70

Calls 2

copy_graphFunction · 0.85
number_of_nodesMethod · 0.45

Tested by

no test coverage detected