Beispiel #1
0
        public void ObjectMethodsWrongDataullReferenceException()
        {
            P.Polynomial p = null;

            Assert.Throws <NullReferenceException>(() => p.ToString());
            Assert.Throws <NullReferenceException>(() => p.GetHashCode());
            Assert.Throws <NullReferenceException>(() => p.Equals(13));

            P.Polynomial p2 = new P.Polynomial(new double[] { 3, 4 });
            Assert.Throws <NullReferenceException>(() => p2.Equals(null));
        }
Beispiel #2
0
 public void ExpectedExceptionTest()
 {
     P.Polynomial p2 = new P.Polynomial(new double[] { 3, 4 });
     P.Polynomial p1 = null;
     Assert.Throws <NullReferenceException>(delegate()
     {
         P.Polynomial p3 = p1 + p2;
     });
     Assert.Throws <NullReferenceException>(delegate()
     {
         P.Polynomial p3 = p1 - p2;
     });
     Assert.Throws <NullReferenceException>(delegate()
     {
         P.Polynomial p3 = p1 * p2;
     });
 }
Beispiel #3
0
 public void MinusOverrideDefaultNumbCorrect(double[] arr1, double[] arr2, double[] result)
 {
     P.Polynomial poly1 = new P.Polynomial(arr1);
     P.Polynomial poly2 = new P.Polynomial(arr2);
     Assert.AreEqual((poly1 - poly2).Coef, result);
 }
Beispiel #4
0
 public void EquialDiffCoefFalse(double[] arr1, double[] arr2)
 {
     P.Polynomial poly1 = new P.Polynomial(arr1);
     P.Polynomial poly2 = new P.Polynomial(arr2);
     Assert.IsFalse(poly1.Equals(poly2));
 }
Beispiel #5
0
 public void EquialSameCoefTrue(double[] arr1, double[] arr2)
 {
     P.Polynomial poly1 = new P.Polynomial(arr1);
     P.Polynomial poly2 = new P.Polynomial(arr2);
     Assert.IsTrue(poly1.Equals(poly2));
 }
Beispiel #6
0
 public void MultiplyOverrideDefaultNumbCorrect(double[] arr1, double[] arr2, double[] result)
 {
     P.Polynomial poly1 = new P.Polynomial(arr1);
     P.Polynomial poly2 = new P.Polynomial(arr2);
     Assert.AreEqual(result, (poly1 * poly2).Coef);
 }