}
DEF_TEST(uc_get_percentile) {
- metric_family_t *metric_family_with_null_metric = calloc(1, sizeof(metric_family_t));
+ metric_family_t *metric_family_with_null_metric =
+ calloc(1, sizeof(metric_family_t));
metric_family_with_null_metric->type = METRIC_TYPE_COUNTER;
metric_family_with_null_metric->name = "test-percentile-with-null";
125.77984, 24.81209, 43.67169, 59.02432, 77.40476,
72.55881, 103.22872, 61.44734, 110.21046, 22.42225,
53.0431},
- (double[]){38.81053, 2.92907, 58.62993, 1.02672, 21.98664,
- 27.78435, 62.01765, 11.04862, 35.70885, 20.19808,
- 48.87309, 16.81291, 46.22889, 50.54755, 59.58231,
- 50.21794, 26.45925, 10.17534, 26.77216, 18.10478,
- 30.72786, 16.07058, 16.60934, 44.67609, 46.58571,
- 66.82775},
+ (double[]){
+ 38.81053, 2.92907, 58.62993, 1.02672, 21.98664,
+ 27.78435, 62.01765, 11.04862, 35.70885, 20.19808,
+ 48.87309, 16.81291, 46.22889, 50.54755, 59.58231,
+ 50.21794, 26.45925, 10.17534, 26.77216, 18.10478,
+ 30.72786, 16.07058, 16.60934, 44.67609, 46.58571,
+ 66.82775},
(double[]){44.32},
},
.want_ret_value = 57.2479817070748,
222.9282, 321.08365, 958.73825, 393.90684,
7396.77622, 2706.27567, 7376.80843, 3028.44747,
8684.45493, 8277.39937},
- (double[]){94.34024, 5369.42045, 106.99225, 4845.37869,
- 3694.95099, 6859.38458, 3403.18808, 9102.51424,
- 4098.48109, 5954.08755, 6146.62894, 3494.39408,
- 4229.73443, 1400.66599, 8942.00647, 6992.12526,
- 3145.67041, 4158.62876, 8337.978, 8311.53907,
- 5934.71194, 6885.4022, 7941.92203, 1636.68227,
- 6086.39492, 1893.09594, 4984.28907, 756.5788,
- 9298.44361, 6460.4752, 8455.53452, 2607.52741,
- 62.34891, 2499.08504, 1370.14777, 7838.19529,
- 4335.81203, 736.71981, 9177.66445, 8299.95565,
- 7745.85028, 5442.34546, 7129.24099, 6034.30483,
- 2666.01496, 5626.89066, 1948.9354, 842.76915,
- 4425.71523, 8022.58775, 3228.76266, 6616.1537,
- 7016.92999, 6867.16531, 4919.9911, 3812.5397,
- 353.57387, 7504.68569, 8575.42736, 9262.40423,
- 6691.10738, 9253.02204, 9171.75229, 6153.56538,
- 8469.24383, 4859.31769, 1161.66019},
- (double[]){4400.00001, 9833.13863, 100.16011, 6849.80943,
- 510.31266, 2866.47649, 4492.46879, 8692.87943},
- (double[]){1566.00821, 7594.931, 995.13973, 1289.97209,
- 9242.79285, 9702.15248, 82.44731, 1854.97795,
- 5236.74648},
+ (double[]){
+ 94.34024, 5369.42045, 106.99225, 4845.37869,
+ 3694.95099, 6859.38458, 3403.18808, 9102.51424,
+ 4098.48109, 5954.08755, 6146.62894, 3494.39408,
+ 4229.73443, 1400.66599, 8942.00647, 6992.12526,
+ 3145.67041, 4158.62876, 8337.978, 8311.53907,
+ 5934.71194, 6885.4022, 7941.92203, 1636.68227,
+ 6086.39492, 1893.09594, 4984.28907, 756.5788,
+ 9298.44361, 6460.4752, 8455.53452, 2607.52741,
+ 62.34891, 2499.08504, 1370.14777, 7838.19529,
+ 4335.81203, 736.71981, 9177.66445, 8299.95565,
+ 7745.85028, 5442.34546, 7129.24099, 6034.30483,
+ 2666.01496, 5626.89066, 1948.9354, 842.76915,
+ 4425.71523, 8022.58775, 3228.76266, 6616.1537,
+ 7016.92999, 6867.16531, 4919.9911, 3812.5397,
+ 353.57387, 7504.68569, 8575.42736, 9262.40423,
+ 6691.10738, 9253.02204, 9171.75229, 6153.56538,
+ 8469.24383, 4859.31769, 1161.66019},
+ (double[]){
+ 4400.00001, 9833.13863, 100.16011, 6849.80943, 510.31266,
+ 2866.47649, 4492.46879, 8692.87943},
+ (double[]){
+ 1566.00821, 7594.931, 995.13973, 1289.97209, 9242.79285,
+ 9702.15248, 82.44731, 1854.97795, 5236.74648},
},
.want_ret_value = 5579.60919,
.metric_idx = 3,
},
{
- .fam = metric_family_with_null_metric,
- .want_get = -1,
- }
- };
+ .fam = metric_family_with_null_metric,
+ .want_get = -1,
+ }};
/* TODO(bkjg): add test cases to the uc_update function that will give an
* error in distribution_sub function */
CHECK_ZERO(uc_update(cases[i].fam));
- EXPECT_EQ_INT(cases[i].want_get,
- uc_get_percentile(&cases[i].fam->metric.ptr[cases[i].metric_idx],
- &cases[i].ret_value, cases[i].percent));
+ EXPECT_EQ_INT(
+ cases[i].want_get,
+ uc_get_percentile(&cases[i].fam->metric.ptr[cases[i].metric_idx],
+ &cases[i].ret_value, cases[i].percent));
if (cases[i].want_get != -1) {
EXPECT_EQ_DOUBLE(cases[i].want_ret_value, cases[i].ret_value);