Esempio n. 1
0
 public void TestAdd()
 {
     Assert.Equal(20, Math.Add(10, 10));
 }
Esempio n. 2
0
        public void Add_WhenCalled_ReturnTheSumOfArguments()
        {
            var result = _math.Add(1, 2);

            Assert.That(_math, Is.Not.Null);
        }
Esempio n. 3
0
 public double Add(double x, double y)
 {
     return(_math.Add(x, y));
 }
Esempio n. 4
0
        public void Add_WhenCalled_ReturnSumOfArguments()
        {
            var result = _math.Add(10, 30);

            Assert.That(result, Is.EqualTo(40));
        }
Esempio n. 5
0
        public void Add_WhenCalled_ReturnsSumOfValues()
        {
            var result = _math.Add(1, 2);

            Assert.AreEqual(result, 3);
        }
Esempio n. 6
0
 public static PointF Bezier(PointF _Start, PointF _Control, PointF _End, float _Percent)
 {
     return(Math.Add(Math.Add(Math.Multiply(_Start, ((1 - _Percent) * (1 - _Percent))),
                              Math.Multiply(_Control, (2 * _Percent * (1 - _Percent)))),
                     Math.Multiply(_End, (_Percent * _Percent))));
 }
        public void Add_WhenCalled_ReturnSumOfArguments()
        {
            var result = _math.Add(1, 2); //pouzivat jednoduche argumenty, aby neboli metuce

            Assert.That(result, Is.EqualTo(3));
        }
Esempio n. 8
0
        public void Add_OnePlusOne_ReturnsTwo()
        {
            var result = _math.Add(1, 1);

            Assert.That(result, Is.EqualTo(2));
        }
Esempio n. 9
0
 public void Add_AddsTwoNumbers(int a, int b)
 {
     Assert.Equal(a + b, Math.Add(a, b));
 }
Esempio n. 10
0
 public Property Adding_is_commutative(int x, int y)
 {
     return((Math.Add(x, y) == Math.Add(y, x)).ToProperty());
 }
Esempio n. 11
0
 public static Number <T> operator +(Number <T> x, Number <T> y)
 {
     return(math.Add(x.Value, y.Value));
 }
Esempio n. 12
0
 public Property Add0_is_invariant(int x)
 {
     return((Math.Add(x, 0) == x).ToProperty());
 }
Esempio n. 13
0
 public Property Subtract1_after_Add1_is_invariant(int x)
 {
     return((Math.Add(Math.Add(x, 1), -1) == x).ToProperty());
 }
Esempio n. 14
0
        public void Add_WhenCalled_ReturnSumOfArguments(int a, int b, int expectedResult)
        {
            var result = _math.Add(a, b);

            Assert.AreEqual(result, expectedResult);
        }
Esempio n. 15
0
        //[Ignore("I don't want any doctor pass the trust level :)")]
        public void CheckTrustLevelOfDoctor()
        {
            var result = _math.Add(5, 6);

            Assert.That(result, Is.EqualTo(11));
        }
Esempio n. 16
0
        /// <summary>
        /// Add a pixel to the quadtree.
        /// </summary>
        /// <param name="IPixel">A pixel of type T.</param>
        public void Add(IPixel <T> IPixel)
        {
            if (this.Contains(IPixel))
            {
                #region Check subtrees...

                if (Subtree1 != null && Subtree1.Contains(IPixel))
                {
                    Subtree1.Add(IPixel);
                }

                else if (Subtree2 != null && Subtree2.Contains(IPixel))
                {
                    Subtree2.Add(IPixel);
                }

                else if (Subtree3 != null && Subtree3.Contains(IPixel))
                {
                    Subtree3.Add(IPixel);
                }

                else if (Subtree4 != null && Subtree4.Contains(IPixel))
                {
                    Subtree4.Add(IPixel);
                }

                #endregion

                #region ...or the embedded data.

                else if (EmbeddedPixels.Count < MaxNumberOfEmbeddedPixels)
                {
                    EmbeddedPixels.Add(IPixel);
                }

                #endregion

                #region If necessary create subtrees...

                else
                {
                    #region Create Subtrees

                    if (Subtree1 == null)
                    {
                        Subtree1 = new Quadtree <T>(Left,
                                                    Top,
                                                    Math.Add(Left, Math.Div2(Width)),
                                                    Math.Add(Top, Math.Div2(Height)),
                                                    MaxNumberOfEmbeddedPixels);
                        Subtree1.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree2 == null)
                    {
                        Subtree2 = new Quadtree <T>(Math.Add(Left, Math.Div2(Width)),
                                                    Top,
                                                    Right,
                                                    Math.Add(Top, Math.Div2(Height)),
                                                    MaxNumberOfEmbeddedPixels);
                        Subtree2.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree3 == null)
                    {
                        Subtree3 = new Quadtree <T>(Left,
                                                    Math.Add(Top, Math.Div2(Height)),
                                                    Math.Add(Left, Math.Div2(Width)),
                                                    Bottom,
                                                    MaxNumberOfEmbeddedPixels);
                        Subtree3.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree4 == null)
                    {
                        Subtree4 = new Quadtree <T>(Math.Add(Left, Math.Div2(Width)),
                                                    Math.Add(Top, Math.Div2(Height)),
                                                    Right,
                                                    Bottom,
                                                    MaxNumberOfEmbeddedPixels);
                        Subtree4.OnTreeSplit += OnTreeSplit;
                    }

                    #endregion

                    #region Fire QuadtreeSplit event

                    if (OnTreeSplit != null)
                    {
                        OnTreeSplit(this, IPixel);
                    }

                    #endregion

                    #region Move all embedded data into the subtrees

                    EmbeddedPixels.Add(IPixel);

                    foreach (var _Pixel in EmbeddedPixels)
                    {
                        if (Subtree1.Contains(_Pixel))
                        {
                            Subtree1.Add(_Pixel);
                        }

                        else if (Subtree2.Contains(_Pixel))
                        {
                            Subtree2.Add(_Pixel);
                        }

                        else if (Subtree3.Contains(_Pixel))
                        {
                            Subtree3.Add(_Pixel);
                        }

                        else if (Subtree4.Contains(_Pixel))
                        {
                            Subtree4.Add(_Pixel);
                        }

                        else
                        {
                            throw new Exception("Mist!");
                        }
                    }

                    EmbeddedPixels.Clear();

                    #endregion
                }

                #endregion
            }

            else
            {
                throw new QT_OutOfBoundsException <T>(this, IPixel);
            }
        }
Esempio n. 17
0
        //[Fact(Skip = "reason")] ignoring
        public void Add_WhenCalled_ReturnSumOfArguments()
        {
            var result = _math.Add(1, 2);

            Assert.Equal(3, result);
        }
        [TestCase(2, 1, 3)]                                                                  // test methoduna parametre yolladık
        public void Add_WhenCalled_ReturnTheSumOfArguments(int a, int b, int expectedResult) // testi parametize ettik
        {
            var result = _math.Add(a, b);

            Assert.That(result, Is.EqualTo(expectedResult)); // gelen result 3 olmalı dedik
        }
        public void Add_WhenCalled_ReturnArgSum()
        {
            var result = _math.Add(1, 2);

            Assert.That(result, Is.EqualTo(3));
        }
Esempio n. 20
0
        public void Add_WhenCalled_ReturnSumOfTheArguments()
        {
            var sum = _math.Add(1, 2);

            Assert.That(sum, Is.EqualTo(3));
        }
Esempio n. 21
0
        public void Add_WhenCalled_ReturnsSumOfTwoNumbers()
        {
            var result = _math.Add(1, 3);

            Assert.That(result, Is.EqualTo(4));
        }
Esempio n. 22
0
        public void Add_ShouldAddTwoNumbers_ShouldReturnTrue()
        {
            var result = math.Add(1, 2);

            Assert.That(result, Is.EqualTo(3));
        }
Esempio n. 23
0
        /// <summary>
        /// Add a voxel to the octree.
        /// </summary>
        /// <param name="Voxel">A voxel of type T.</param>
        public void Add(IVoxel <T> Voxel)
        {
            if (this.Contains(Voxel))
            {
                #region Check subtrees...

                if (Subtree1 != null && Subtree1.Contains(Voxel))
                {
                    Subtree1.Add(Voxel);
                }

                else if (Subtree2 != null && Subtree2.Contains(Voxel))
                {
                    Subtree2.Add(Voxel);
                }

                else if (Subtree3 != null && Subtree3.Contains(Voxel))
                {
                    Subtree3.Add(Voxel);
                }

                else if (Subtree4 != null && Subtree4.Contains(Voxel))
                {
                    Subtree4.Add(Voxel);
                }

                else if (Subtree5 != null && Subtree5.Contains(Voxel))
                {
                    Subtree5.Add(Voxel);
                }

                else if (Subtree6 != null && Subtree6.Contains(Voxel))
                {
                    Subtree6.Add(Voxel);
                }

                else if (Subtree7 != null && Subtree7.Contains(Voxel))
                {
                    Subtree7.Add(Voxel);
                }

                else if (Subtree8 != null && Subtree8.Contains(Voxel))
                {
                    Subtree8.Add(Voxel);
                }

                #endregion

                #region ...or the embedded data.

                else if (EmbeddedVoxels.Count < MaxNumberOfEmbeddedVoxels)
                {
                    EmbeddedVoxels.Add(Voxel);
                }

                #endregion

                #region If necessary create subtrees...

                else
                {
                    #region Create Subtrees

                    if (Subtree1 == null)
                    {
                        Subtree1 = new Octree <T>(Left,
                                                  Top,
                                                  Front,
                                                  Math.Add(Left, Math.Div2(Width)),
                                                  Math.Add(Top, Math.Div2(Height)),
                                                  Math.Add(Front, Math.Div2(Depth)),
                                                  MaxNumberOfEmbeddedVoxels);
                        Subtree1.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree2 == null)
                    {
                        Subtree2 = new Octree <T>(Math.Add(Left, Math.Div2(Width)),
                                                  Top,
                                                  Front,
                                                  Right,
                                                  Math.Add(Top, Math.Div2(Height)),
                                                  Math.Add(Front, Math.Div2(Depth)),
                                                  MaxNumberOfEmbeddedVoxels);
                        Subtree2.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree3 == null)
                    {
                        Subtree3 = new Octree <T>(Left,
                                                  Math.Add(Top, Math.Div2(Height)),
                                                  Front,
                                                  Math.Add(Left, Math.Div2(Width)),
                                                  Bottom,
                                                  Math.Add(Front, Math.Div2(Depth)),
                                                  MaxNumberOfEmbeddedVoxels);
                        Subtree3.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree4 == null)
                    {
                        Subtree4 = new Octree <T>(Math.Add(Left, Math.Div2(Width)),
                                                  Math.Add(Top, Math.Div2(Height)),
                                                  Front,
                                                  Right,
                                                  Bottom,
                                                  Math.Add(Front, Math.Div2(Depth)),
                                                  MaxNumberOfEmbeddedVoxels);
                        Subtree4.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree5 == null)
                    {
                        Subtree5 = new Octree <T>(Left,
                                                  Top,
                                                  Math.Add(Front, Math.Div2(Depth)),
                                                  Math.Add(Left, Math.Div2(Width)),
                                                  Math.Add(Top, Math.Div2(Height)),
                                                  Behind,
                                                  MaxNumberOfEmbeddedVoxels);
                        Subtree5.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree6 == null)
                    {
                        Subtree6 = new Octree <T>(Math.Add(Left, Math.Div2(Width)),
                                                  Top,
                                                  Math.Add(Front, Math.Div2(Depth)),
                                                  Right,
                                                  Math.Add(Top, Math.Div2(Height)),
                                                  Behind,
                                                  MaxNumberOfEmbeddedVoxels);
                        Subtree6.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree7 == null)
                    {
                        Subtree7 = new Octree <T>(Left,
                                                  Math.Add(Top, Math.Div2(Height)),
                                                  Math.Add(Front, Math.Div2(Depth)),
                                                  Math.Add(Left, Math.Div2(Width)),
                                                  Bottom,
                                                  Behind,
                                                  MaxNumberOfEmbeddedVoxels);
                        Subtree7.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree8 == null)
                    {
                        Subtree8 = new Octree <T>(Math.Add(Left, Math.Div2(Width)),
                                                  Math.Add(Top, Math.Div2(Height)),
                                                  Math.Add(Front, Math.Div2(Depth)),
                                                  Right,
                                                  Bottom,
                                                  Behind,
                                                  MaxNumberOfEmbeddedVoxels);
                        Subtree8.OnTreeSplit += OnTreeSplit;
                    }

                    #endregion

                    #region Fire OctreeSplit event

                    if (OnTreeSplit != null)
                    {
                        OnTreeSplit(this, Voxel);
                    }

                    #endregion

                    #region Move all embedded data into the subtrees

                    EmbeddedVoxels.Add(Voxel);

                    foreach (var _Voxel in EmbeddedVoxels)
                    {
                        if (Subtree1.Contains(_Voxel))
                        {
                            Subtree1.Add(_Voxel);
                        }

                        else if (Subtree2.Contains(_Voxel))
                        {
                            Subtree2.Add(_Voxel);
                        }

                        else if (Subtree3.Contains(_Voxel))
                        {
                            Subtree3.Add(_Voxel);
                        }

                        else if (Subtree4.Contains(_Voxel))
                        {
                            Subtree4.Add(_Voxel);
                        }

                        else if (Subtree5.Contains(_Voxel))
                        {
                            Subtree5.Add(_Voxel);
                        }

                        else if (Subtree6.Contains(_Voxel))
                        {
                            Subtree6.Add(_Voxel);
                        }

                        else if (Subtree7.Contains(_Voxel))
                        {
                            Subtree7.Add(_Voxel);
                        }

                        else if (Subtree8.Contains(_Voxel))
                        {
                            Subtree8.Add(_Voxel);
                        }

                        else
                        {
                            throw new Exception("Mist!");
                        }
                    }

                    EmbeddedVoxels.Clear();

                    #endregion
                }

                #endregion
            }

            else
            {
                throw new OT_OutOfBoundsException <T>(this, Voxel);
            }
        }
Esempio n. 24
0
 public int Add(int num1, int num2)
 {
     return(_math.Add(num1, num2));
 }
        public void Add_WhenCall_SumOfArguments(int a, int b, int expect)
        {
            var result = _math.Add(a, b);

            Assert.That(result, Is.EqualTo(expect));
        }
Esempio n. 26
0
        /// <summary>
        /// Add an element to the bintree.
        /// </summary>
        /// <param name="Element">A element of type T.</param>
        public void Add(T Element)
        {
            if (this.Contains(Element))
            {
                #region Check subtrees...

                if (Subtree1 != null && Subtree1.Contains(Element))
                {
                    Subtree1.Add(Element);
                }

                else if (Subtree2 != null && Subtree2.Contains(Element))
                {
                    Subtree2.Add(Element);
                }

                #endregion

                #region ...or the embedded data.

                else if (EmbeddedData.Count < MaxNumberOfEmbeddedElements)
                {
                    EmbeddedData.Add(Element);
                }

                #endregion

                #region If necessary create subtrees...

                else
                {
                    #region Create Subtrees

                    if (Subtree1 == null)
                    {
                        Subtree1 = new Bintree <T>(Left,
                                                   Math.Add(Left, Math.Div2(Length)),
                                                   MaxNumberOfEmbeddedElements);
                        Subtree1.OnTreeSplit += OnTreeSplit;
                    }

                    if (Subtree2 == null)
                    {
                        Subtree2 = new Bintree <T>(Math.Add(Left, Math.Div2(Length)),
                                                   Right,
                                                   MaxNumberOfEmbeddedElements);
                        Subtree2.OnTreeSplit += OnTreeSplit;
                    }

                    #endregion

                    #region Fire BintreeSplit event

                    if (OnTreeSplit != null)
                    {
                        OnTreeSplit(this, Element);
                    }

                    #endregion

                    #region Move all embedded data into the subtrees

                    EmbeddedData.Add(Element);

                    foreach (var _Element in EmbeddedData)
                    {
                        if (Subtree1.Contains(_Element))
                        {
                            Subtree1.Add(_Element);
                        }

                        else if (Subtree2.Contains(_Element))
                        {
                            Subtree2.Add(_Element);
                        }

                        else
                        {
                            throw new Exception("Mist!");
                        }
                    }

                    EmbeddedData.Clear();

                    #endregion
                }

                #endregion
            }

            else
            {
                throw new BT_OutOfBoundsException <T>(this, Element);
            }
        }
Esempio n. 27
0
        public void Add_WhenCalled_ReturnsTheSumOfArguments(int a, int b, int result)
        {
            var sum = _math.Add(a, b);

            Assert.That(sum, Is.EqualTo(result));
        }
Esempio n. 28
0
 public void Add2ParamCorrectResult()
 {
     Assert.AreEqual(5, Math.Add(2, 3));
 }
Esempio n. 29
0
        public void Add_WhenCalled_ReturnTheSumOfArguments()
        {
            var result = _math.Add(1, 2);

            Assert.That(result, Is.EqualTo(3));
        }
Esempio n. 30
0
 public double Add(double a, double b)
 {
     return(math.Add(a, b));
 }