public void VeryLongNumbersCanBeCreatedFromAString(string s) { var i = new VeryLong(s); Assert.Equal(s, i); Assert.Equal(s, i.ToString()); }
public void VeryLongNumbersCanBeConvertedToAString(int n, string expected) { var i = new VeryLong(n); Assert.Equal(expected, i); Assert.Equal(expected, i.ToString()); }
public void RemoveLeadingZeros_When0000_Then0() { VeryLong number = new VeryLong("0000"); number.RemoveLeadingZeros(); Assert.AreEqual("0", number.ToString()); }
public void RemoveLeadingZeros_When23_Then23() { VeryLong number = new VeryLong("23"); number.RemoveLeadingZeros(); Assert.AreEqual("23", number.ToString()); }
public void Add_WhenSumCalculatedOf_511111_77777555555_ThenSumIs_77778066666() { VeryLong number1 = new VeryLong("511111"); VeryLong number2 = new VeryLong("77777555555"); VeryLong sum = number1.Add(number2); Assert.AreEqual("77778066666", sum.ToString()); }
public void Multiply_When_7_x_81_Then_567() { VeryLong number1 = new VeryLong("7"); VeryLong number2 = new VeryLong("81"); VeryLong sum = number1.Multiply(number2); Assert.AreEqual("567", sum.ToString()); }
public void Add_WhenSumCalculatedOf_100_977_ThenSumIs_1077() { VeryLong number1 = new VeryLong("100"); VeryLong number2 = new VeryLong("977"); VeryLong sum = number1.Add(number2); Assert.AreEqual("1077", sum.ToString()); }
public void Multiply_When_9_x_99_Then_891() { VeryLong number1 = new VeryLong("9"); VeryLong number2 = new VeryLong("99"); VeryLong sum = number1.Multiply(number2); Assert.AreEqual("891", sum.ToString()); }
public void Add_WhenDecimalIs1And9_ThenSumIsCorrect() { VeryLong number1 = new VeryLong("2.1111"); VeryLong number2 = new VeryLong("1.9"); VeryLong sum = number1.Add(number2); Assert.AreEqual("4.0111", sum.ToString()); }
public void Add_WhenSumCalculatedOf_1_17_ThenSumIs_18() { VeryLong number1 = new VeryLong("1"); VeryLong number2 = new VeryLong("17"); VeryLong sum = number1.Add(number2); Assert.AreEqual("18", sum.ToString()); }
public void Multiply_When_0_x_56789_Then_0() { VeryLong number1 = new VeryLong("0"); VeryLong number2 = new VeryLong("56789"); VeryLong sum = number1.Multiply(number2); Assert.AreEqual("0", sum.ToString()); }
public void Add_WhenTwoSumandContainsDot_ThenSumHasMaxDecimalPlaces() { VeryLong number1 = new VeryLong("1.3"); VeryLong number2 = new VeryLong("2.1111"); VeryLong sum = number1.Add(number2); Assert.AreEqual("3.4111", sum.ToString()); }
public void Multiply_When_10_x_2_Then_20() { VeryLong number1 = new VeryLong("10"); VeryLong number2 = new VeryLong("2"); VeryLong sum = number1.Multiply(number2); Assert.AreEqual("20", sum.ToString()); }
public void Multiply_When_1234_x_56789_Then_70077626() { VeryLong number1 = new VeryLong("1234"); VeryLong number2 = new VeryLong("56789"); VeryLong sum = number1.Multiply(number2); Assert.AreEqual("70077626", sum.ToString()); }
public void Add_WhenSumCalculatedOf_111111111111111111111111111111_1988888888888888888888888888888_ThenSumIs_1077() { VeryLong number1 = new VeryLong("111111111111111111111111111111"); VeryLong number2 = new VeryLong("1988888888888888888888888888888"); VeryLong sum = number1.Add(number2); Assert.AreEqual("2099999999999999999999999999999", sum.ToString()); }
public void Multiply_When_0_1_x_0_9_Then_0_09() { VeryLong number1 = new VeryLong("0.1"); VeryLong number2 = new VeryLong("0.9"); VeryLong sum = number1.Multiply(number2); Assert.AreEqual("0.09", sum.ToString()); }
public void Multiply_When_7_x_12_Then_84() { VeryLong number1 = new VeryLong("7"); VeryLong number2 = new VeryLong("12"); VeryLong sum = number1.Multiply(number2); Assert.AreEqual("84", sum.ToString()); }
public void Multiply_When_1_x_1_Then_1() { VeryLong number1 = new VeryLong("1"); VeryLong number2 = new VeryLong("1"); VeryLong sum = number1.Multiply(number2); Assert.AreEqual("1", sum.ToString()); }
public void DivideBy_When_1_d_3_And10Digits_Then_0point3333333333() { int numberOfDigits = 10; VeryLong number1 = new VeryLong("1"); VeryLong number2 = new VeryLong("3"); VeryLong quotient = number1.DivideBy(number2, numberOfDigits); Assert.AreEqual("0.3333333333", quotient.ToString()); }
public void DivideBy_When_1_d_4_And10Digits_Then_0point25() { int numberOfDigits = 10; VeryLong number1 = new VeryLong(1.ToString()); VeryLong number2 = new VeryLong(4.ToString()); VeryLong quotient = number1.DivideBy(number2, numberOfDigits); Assert.AreEqual("0.2500000000", quotient.ToString()); }
public void DivideBy_When_1_24_d_0_2_And10Digits_Then_0point062() { int numberOfDigits = 10; VeryLong number1 = new VeryLong("1.24"); VeryLong number2 = new VeryLong("0.2"); VeryLong quotient = number1.DivideBy(number2, numberOfDigits); Assert.AreEqual("6.2000000000", quotient.ToString()); }
public void DivideBy_When_1_00000_d_1_5000_And10Digits_Then_0point02500() { int numberOfDigits = 10; VeryLong number1 = new VeryLong("1.00000"); VeryLong number2 = new VeryLong("1.50000"); VeryLong quotient = number1.DivideBy(number2, numberOfDigits); Assert.AreEqual("0.6666666666", quotient.ToString()); }
public void Divide_When_12345_d_53_Then_232_R49() { VeryLong remainder; VeryLong number1 = new VeryLong("12345"); VeryLong number2 = new VeryLong("53"); VeryLong quotient = number1.DivideBy(number2, out remainder); Assert.AreEqual("232", quotient.ToString()); Assert.AreEqual("49", remainder.ToString()); }
public void Divide_When_9_d_2_Then_4_R1() { VeryLong remainder; VeryLong number1 = new VeryLong("9"); VeryLong number2 = new VeryLong("2"); VeryLong quotient = number1.DivideBy(number2, out remainder); Assert.AreEqual("4", quotient.ToString()); Assert.AreEqual("1", remainder.ToString()); }
public void Divide_When_30000_d_3_Then_10000_R0() { VeryLong remainder; VeryLong number1 = new VeryLong("30000"); VeryLong number2 = new VeryLong("3"); VeryLong quotient = number1.DivideBy(number2, out remainder); Assert.AreEqual("10000", quotient.ToString()); Assert.AreEqual("0", remainder.ToString()); }