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

Function dotest6

dlib/test/bsp.cpp:500–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498 }
499
500 void dotest6()
501 {
502 dlog << LINFO << "start dotest6()";
503 print_spinner();
504 bool error_occurred = false;
505 {
506 dlib::pipe<unsigned short> ports(5);
507 thread_function t1(callfunct(bsp_job_other_nodes, 0, error_occurred, ports));
508 thread_function t2(callfunct(bsp_job_other_nodes, 0, error_occurred, ports));
509 thread_function t3(callfunct(bsp_job_other_nodes, 0, error_occurred, ports));
510
511
512 try
513 {
514 std::vector<network_address> hosts;
515 unsigned short port;
516 ports.dequeue(port); hosts.push_back(network_address("127.0.0.1",port)); dlog << LINFO << "PORT: " << port;
517 ports.dequeue(port); hosts.push_back(network_address("127.0.0.1",port)); dlog << LINFO << "PORT: " << port;
518 ports.dequeue(port); hosts.push_back(network_address("127.0.0.1",port)); dlog << LINFO << "PORT: " << port;
519 double min_value = 10, optimal_x = 0;
520 bsp_connect(hosts, bsp_job_node_0, dlib::ref(min_value), dlib::ref(optimal_x));
521
522 dlog << LINFO << "min_value: " << min_value;
523 dlog << LINFO << "optimal_x: " << optimal_x;
524 DLIB_TEST(std::abs(min_value - 0) < 1e-14);
525 DLIB_TEST(std::abs(optimal_x - 2) < 1e-14);
526 }
527 catch (std::exception& e)
528 {
529 dlog << LERROR << "error during bsp_context: " << e.what();
530 DLIB_TEST(false);
531 }
532
533 }
534 DLIB_TEST(error_occurred == false);
535 }
536// ----------------------------------------------------------------------------------------
537
538 class bsp_tester : public tester

Callers 1

perform_testMethod · 0.85

Calls 8

print_spinnerFunction · 0.85
callfunctFunction · 0.85
bsp_connectFunction · 0.85
refFunction · 0.85
absFunction · 0.85
network_addressClass · 0.50
push_backMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected