Exemplo n.º 1
0
        public void TestBins4()
        {
            //Test that values equal to the specified maximum get included in the final bin
            double[] data = { 1, 2, 3, 4, 6, 5, 7, 2 };
            Histogram hist = new Histogram(data, 1, 6, 6);

            uint[] expected = { 1, 2, 1, 1, 1, 1 };
            CollectionAssert.AreEqual(expected, hist.Bins);
        }
Exemplo n.º 2
0
        public void TestBins2()
        {
            //Test that values below the specified minimum get ignored
            double[] data = { 0, 1, 2, 3, 4, 5, 0, 0, 7, 2 };
            Histogram hist = new Histogram(data, 1, 7, 7);

            uint[] expected = { 1, 2, 1, 1, 1, 0, 1 };
            CollectionAssert.AreEqual(expected, hist.Bins);
        }
Exemplo n.º 3
0
        public void TestBins3()
        {
            //Test that values above the sepcified maximum get ignored
            double[] data = { 1, 2, 3, 4, 5, 7, 2 };
            Histogram hist = new Histogram(data, 1, 6, 6);

            uint[] expected = { 1, 2, 1, 1, 1, 0 };
            CollectionAssert.AreEqual(expected, hist.Bins);
        }
Exemplo n.º 4
0
        public void TestData1()
        {
            //Test you get the same data back that you put in
            double[] data = { 0, 2.3, 4.7 };
            Histogram hist = new Histogram(data);

            double[] expected = { 0, 2.3, 4.7 };
            CollectionAssert.AreEqual(expected, (ICollection)hist.Data);
        }
Exemplo n.º 5
0
        public void TestBins1()
        {
            //Test that data gets put into the correct bins
            double[] data = { 1, 2, 3, 4, 5, 7, 2 };
            Histogram hist = new Histogram(data, 7);

            uint[] expected = { 1, 2, 1, 1, 1, 0, 1 };
            CollectionAssert.AreEqual(expected, hist.Bins);
        }
Exemplo n.º 6
0
        public void TestNumBins2()
        {
            //Test that NumBins can be set and the actual bins will be updated
            double[] data = { 1, 2, 3, 4, 5, 7, 2 };
            Histogram hist = new Histogram(data, 7);

            //Check the initial bins
            uint[] expected = { 1, 2, 1, 1, 1, 0, 1 };
            CollectionAssert.AreEqual(expected, hist.Bins);

            //Update the number of bins
            hist.NumBins = 1;
            uint[] newBinsExpected = { (uint)data.Length };
            CollectionAssert.AreEqual(newBinsExpected, hist.Bins);
        }
Exemplo n.º 7
0
        public void TestNumBins1()
        {
            //Test that the Number of Bins reported is equal to the actual number of Bins 
            double[] data = { 1, 2, 3, 132412, 124, 124, 12, 32, 13, 412, 645, 76, 7, 2 };
            Histogram hist = new Histogram(data);

            Assert.AreEqual(hist.Bins.Length, hist.NumBins);
        }
Exemplo n.º 8
0
        public void TestConstructor1()
        {
            //Histogram must be initialised on *some* data
            double[] data = { };

            try
            {
                Histogram hist = new Histogram(data);
                Assert.Fail(); //No exception thrown
            }
            catch
            {
                //Exception - pass
            }
        }
Exemplo n.º 9
0
        public void TestConstructor2()
        {
            //Constructor must accept lists
            List<double> data = new List<double>(new double[] { 5, 4, 6 });

            Histogram hist = new Histogram(data);
        }
Exemplo n.º 10
0
        public void TestBinWidth2()
        {
            //Test that the Bin width is as expected when it's a non-integer value
            double[] data = { 1, 2, 3, 4, 5, 7, 2 };
            Histogram hist = new Histogram(data, 3, 4, 7);

            double expected = 1d / 7d;
            Assert.AreEqual(expected, hist.BinWidth);
        }
Exemplo n.º 11
0
        public void TestBinWidth1()
        {
            //Test that the Bin width is as expected
            double[] data = { 0, 1, 2, 3, 4, 5, 7, 2 };
            Histogram hist = new Histogram(data, 7);

            double expected = 1;
            Assert.AreEqual(expected, hist.BinWidth);
        }
Exemplo n.º 12
0
        public void TestNumValues3()
        {
            //Test Num Values is 0 when all values are outside the specified Histogram range
            double[] data = { 1, 2, 3 };
            Histogram hist = new Histogram(data, -1, 0);

            Assert.AreEqual(0u, hist.NumValues);
        }
Exemplo n.º 13
0
        public void TestNumValues2()
        {
            //Test that Num Values is as expected when some values aren't in range
            double[] data = { 1, 2, 3 };
            Histogram hist = new Histogram(data, 1, 2);

            Assert.AreEqual(2u, hist.NumValues);
        }
Exemplo n.º 14
0
        public void TestNumValues1()
        {
            //Test that Num Values is as expected when all values are in range
            double[] data = { 1, 2, 3 };
            Histogram hist = new Histogram(data);

            Assert.AreEqual((uint)data.Length, hist.NumValues);
        }