Algorithmix.UnitTest.UtilityTest.TestDistance C# (CSharp) Method

TestDistance() private method

private TestDistance ( ) : void
return void
        public void TestDistance()
        {
            // First Test the Regular Colors Distance function
            Console.WriteLine("Generating Cartesian Differences between Colors");
            double red_blue = Utility.Distance(Color.Red, Color.Blue);
            double red_black = Utility.Distance(Color.Red, Color.Black);
            double black_white = Utility.Distance(Color.Black, Color.White);

            Assert.AreEqual(red_blue, Math.Sqrt((255*255 + 255*255)));
            Assert.AreEqual(red_black, Math.Sqrt((255*255)));
            Assert.AreEqual(black_white, Math.Sqrt((255*255 + 255*255 + 255*255)));
            Console.WriteLine("Algorithmix.Preprocessing.Utility.Distance for colors test Successful");

            Console.WriteLine("Generating Cartesian Differences between Bgr Colors");
            double red_blue_bgr = Utility.Distance(new Bgr(Color.Red), new Bgr(Color.Blue));
            double red_black_bgr = Utility.Distance(new Bgr(Color.Red), new Bgr(Color.Black));
            double black_white_bgr = Utility.Distance(new Bgr(Color.Black), new Bgr(Color.White));

            Assert.AreEqual(red_blue_bgr, Math.Sqrt((255*255 + 255*255)));
            Assert.AreEqual(red_black_bgr, Math.Sqrt((255*255)));
            Assert.AreEqual(black_white_bgr, Math.Sqrt((255*255 + 255*255 + 255*255)));
            Console.WriteLine("Picasso.Utility.Distance for Bgr Colors Test Successful");
        }