コード例 #1
0
        public void Copy_retains_all_public_properties()
        {
            var source = Create(DefautltLowestDiscernibleValue, DefaultHighestTrackableValue, DefaultSignificantFigures);
            var copy   = source.Copy();

            HistogramAssert.AreValueEqual(source, copy);
        }
コード例 #2
0
        public void Given_a_Histogram_populated_with_full_range_of_values_When_encoded_and_decoded_with_compression_Then_data_is_preserved()
        {
            var source = Create(HighestTrackableValue, 3);

            LoadFullRange(source);
            var result = CompressedEncodeDecode(source);

            HistogramAssert.AreEqual(source, result);
        }
コード例 #3
0
        public void Given_a_populated_Histogram_When_encoded_and_decoded_Then_data_is_preserved()
        {
            var source = Create(HighestTrackableValue, 3);

            Load(source);
            var result = EncodeDecode(source);

            HistogramAssert.AreEqual(source, result);
        }
コード例 #4
0
        public void Given_a_Histogram_populated_with_full_range_of_values_When_encoded_and_decoded_Then_data_is_preserved()
        {
            var source = Create(DefaultHighestTrackableValue, DefaultSignificantFigures);

            LoadFullRange(source);
            var result = EncodeDecode(source);

            HistogramAssert.AreValueEqual(source, result);
        }
コード例 #5
0
        public void Given_a_populated_Histogram_When_encoded_and_decoded_with_compression_Then_data_is_preserved()
        {
            var source = Create(DefaultHighestTrackableValue, DefaultSignificantFigures);

            Load(source);
            var result = CompressedEncodeDecode(source);

            HistogramAssert.AreValueEqual(source, result);
        }
コード例 #6
0
        private void CreateAndAdd(HistogramBase source)
        {
            source.RecordValueWithCount(1, 100);
            source.RecordValueWithCount(int.MaxValue - 1, 1000);

            var target = Create(source.LowestTrackableValue, source.HighestTrackableValue, source.NumberOfSignificantValueDigits);

            target.Add(source);

            HistogramAssert.AreValueEqual(source, target);
        }
コード例 #7
0
        public void CanRoundTripSingleHsitogram()
        {
            var histogram        = CreatePopulatedHistogram(1000);
            var startTimeWritten = DateTime.Now;
            var endTimeWritten   = startTimeWritten.AddMinutes(30);

            histogram.StartTimeStamp = startTimeWritten.MillisecondsSinceUnixEpoch();
            histogram.EndTimeStamp   = endTimeWritten.MillisecondsSinceUnixEpoch();

            var data             = WriteLog(startTimeWritten, histogram);
            var actualHistograms = ReadHistograms(data);

            Assert.AreEqual(1, actualHistograms.Length);
            HistogramAssert.AreEqual(histogram, actualHistograms.Single());
        }