def test_snd_discrete_histogram_random_time(self): interpolate = False removeTokens = False ts = randint(0, 5000) histo = {ts: 1} when = "snd" self.run_primitive(histo, removeTokens, interpolate, when) ts_l = self.extract_ts(self.proto_server.history['rcv']) iats = gu.map_to_each_n_elements_in_list(ts_l, gu.get_iats) mean_iat = mathutil.mean(iats) self.assertAlmostEqual(ts / const.SCALE, mean_iat, 2)
def test_rcv_discrete_histogram_random_time(self): interpolate = False removeTokens = False ts = randint(0, 5000) histo = {ts: 1} when = "rcv" self.run_primitive(histo, removeTokens, interpolate, when, endpoint=self.pt_server) padd_ts = self.extract_ts(self.proto_server.history['rcv'], isPadding) data_ts = self.extract_ts(self.proto_server.history['snd'], isData) ts_l = gu.combine_lists_alternate(data_ts, padd_ts) iats = gu.map_to_each_n_elements_in_list(ts_l, gu.get_iats) mean_iat = mathutil.mean(iats) self.assertAlmostEqual(ts / const.SCALE, mean_iat, 2)