Esempio n. 1
0
 public void GetSize()
 {
     Assert.AreEqual(0, _sut.GetSize());
     _sut.Add(1, 2);
     Assert.AreEqual(1, _sut.GetSize());
     _sut.Add(3, 5);
     Assert.AreEqual(2, _sut.GetSize());
     _sut.Add(4, 4);
     Assert.AreEqual(3, _sut.GetSize());
 }
Esempio n. 2
0
        public void GetSizeLarge()
        {
            _sut = new FlatHistogram(10);
            var r = new Random();

            for (var i = 0; i < 1000; i++)
            {
                var methodSize = r.Next(30);
                var bin        = r.Next(methodSize);
                // implementation is one-based
                _sut.Add(bin + 1, methodSize + 1);
            }
            Assert.AreEqual(1000, _sut.GetSize());
        }