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

Function test_count_ranking_inversions

dlib/test/ranking.cpp:52–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50// ----------------------------------------------------------------------------------------
51
52 void test_count_ranking_inversions()
53 {
54 print_spinner();
55 dlog << LINFO << "in test_count_ranking_inversions()";
56
57 dlib::rand rnd;
58 std::vector<int> x, y;
59 std::vector<unsigned long> x_count, y_count;
60 std::vector<unsigned long> x_count2, y_count2;
61 for (int iter = 0; iter < 5000; ++iter)
62 {
63 x.resize(rnd.get_random_32bit_number()%10);
64 y.resize(rnd.get_random_32bit_number()%10);
65 for (unsigned long i = 0; i < x.size(); ++i)
66 x[i] = ((int)rnd.get_random_32bit_number()%10) - 5;
67 for (unsigned long i = 0; i < y.size(); ++i)
68 y[i] = ((int)rnd.get_random_32bit_number()%10) - 5;
69
70 count_ranking_inversions(x, y, x_count, y_count);
71 brute_force_count_ranking_inversions(x, y, x_count2, y_count2);
72
73 DLIB_TEST(mat(x_count) == mat(x_count2));
74 DLIB_TEST(mat(y_count) == mat(y_count2));
75 }
76 }
77
78// ----------------------------------------------------------------------------------------
79

Callers 1

perform_testMethod · 0.85

Calls 7

print_spinnerFunction · 0.85
count_ranking_inversionsFunction · 0.85
matFunction · 0.50
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected