예제 #1
0
        public void CalcPerimetrTest2()
        {
            Point[] pt = new Point[2];
            pt[0].x = 0; pt[0].y = 0;
            pt[1].x = 3; pt[1].y = 4;
            float res = PolygonClass.CalcPerimeter(pt);

            Assert.Fail();
        }
예제 #2
0
        public void CalcPerimetrTest1()
        {
            Point[] pt = new Point[3];
            pt[0].x = 0; pt[0].y = 0;
            pt[1].x = 3; pt[1].y = 4;
            pt[2].x = 3; pt[2].y = 0;
            float exp = 12;
            float res = PolygonClass.CalcPerimeter(pt);

            Assert.AreEqual(exp, res);
        }
예제 #3
0
        public void CalcPerimetrTest3()
        {
            Point[] pt = new Point[6];
            pt[0].x = 0; pt[0].y = 0;
            pt[1].x = 4; pt[1].y = 0;
            pt[2].x = 7; pt[2].y = 5;
            pt[3].x = 5; pt[3].y = 12;
            pt[4].x = -1; pt[4].y = 12;
            pt[5].x = -5; pt[5].y = 6;
            string exp = "38,13";
            string res = PolygonClass.CalcPerimeter(pt).ToString("N2");

            Assert.AreEqual(exp, res);
        }