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

Method perform_test

dlib/test/clustering.cpp:352–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350 {}
351
352 void perform_test (
353 )
354 {
355 test_bottom_up_clustering();
356 test_segment_number_line();
357
358 dlib::rand rnd;
359
360 std::vector<sample_pair> edges;
361 std::vector<unsigned long> labels;
362 DLIB_TEST(newman_cluster(edges, labels) == 0);
363 DLIB_TEST(chinese_whispers(edges, labels) == 0);
364
365 edges.push_back(sample_pair(0,1,1));
366 DLIB_TEST(newman_cluster(edges, labels) == 1);
367 DLIB_TEST(labels.size() == 2);
368 DLIB_TEST(chinese_whispers(edges, labels) == 1);
369 DLIB_TEST(labels.size() == 2);
370
371 edges.clear();
372 edges.push_back(sample_pair(0,0,1));
373 DLIB_TEST(newman_cluster(edges, labels) == 1);
374 DLIB_TEST(labels.size() == 1);
375 DLIB_TEST(chinese_whispers(edges, labels) == 1);
376 DLIB_TEST(labels.size() == 1);
377
378 edges.clear();
379 edges.push_back(sample_pair(1,1,1));
380 DLIB_TEST(newman_cluster(edges, labels) == 1);
381 DLIB_TEST(labels.size() == 2);
382 DLIB_TEST(chinese_whispers(edges, labels) == 2);
383 DLIB_TEST(labels.size() == 2);
384
385 edges.push_back(sample_pair(0,0,1));
386 DLIB_TEST(newman_cluster(edges, labels) == 2);
387 DLIB_TEST(labels.size() == 2);
388 DLIB_TEST(chinese_whispers(edges, labels) == 2);
389 DLIB_TEST(labels.size() == 2);
390
391
392 for (int i = 0; i < 10; ++i)
393 test_modularity(rnd);
394
395 for (int i = 0; i < 10; ++i)
396 test_newman_clustering(rnd);
397
398 for (int i = 0; i < 10; ++i)
399 test_chinese_whispers(rnd);
400
401
402 }
403 } a;
404
405

Callers

nothing calls this directly

Calls 11

test_segment_number_lineFunction · 0.85
newman_clusterFunction · 0.85
chinese_whispersFunction · 0.85
test_modularityFunction · 0.85
test_newman_clusteringFunction · 0.85
test_chinese_whispersFunction · 0.70
sample_pairClass · 0.50
push_backMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected