MCPcopy Create free account
hub / github.com/PDAL/PDAL / TEST

Function TEST

test/unit/UtilsTest.cpp:54–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52{
53
54TEST(UtilsTest, test_random)
55{
56 const double rangeMin = 0.0;
57 const double rangeMax = 100.0;
58 const double avg = (rangeMax - rangeMin) / 2.0;
59 const int iters = 1000;
60
61 Utils::random_seed(17);
62
63 // make sure we treat the bounds as inclusive
64 double sum=0;
65 for (int i=0; i<iters; i++)
66 {
67 const double x = Utils::random(rangeMin, rangeMax);
68 EXPECT_TRUE(x >= rangeMin);
69 EXPECT_TRUE(x <= rangeMax);
70
71 sum += x;
72 }
73
74 sum = sum / iters;
75
76 EXPECT_TRUE(sum <= avg + 0.1*avg);
77 EXPECT_TRUE(sum >= avg - 0.1*avg);
78}
79
80
81TEST(UtilsTest, test_comparators)

Callers

nothing calls this directly

Calls 15

compare_approxFunction · 0.85
base64_encodeFunction · 0.85
splitFunction · 0.85
toupperFunction · 0.85
tolowerFunction · 0.85
startsWithFunction · 0.85
iequalsFunction · 0.85
numericCastFunction · 0.85
strMethod · 0.80
codeMethod · 0.80
toStringFunction · 0.50
fromStringFunction · 0.50

Tested by

no test coverage detected