Sha256: d109607525c4b0c242449b497930d0b0e48d8a0da764dd2b3257cd3441d3782f
Contents?: true
Size: 1.53 KB
Versions: 115
Compression:
Stored size: 1.53 KB
Contents
using System.Linq; using NUnit.Framework; public class PascalsTriangleTest { [Test] public void One_row() { var actual = PascalsTriangle.Calculate(1); Assert.That(actual, Is.EqualTo(new[] { new[] { 1 } })); } [Ignore("Remove to run test")] [Test] public void Two_rows() { var actual = PascalsTriangle.Calculate(2); Assert.That(actual, Is.EqualTo(new[] { new[] { 1 }, new[] { 1, 1 } })); } [Ignore("Remove to run test")] [Test] public void Three_rows() { var actual = PascalsTriangle.Calculate(3); Assert.That(actual, Is.EqualTo(new[] { new[] { 1 }, new[] { 1, 1 }, new[] { 1, 2, 1 } })); } [Ignore("Remove to run test")] [Test] public void Four_rows() { var actual = PascalsTriangle.Calculate(4); Assert.That(actual, Is.EqualTo(new[] { new[] { 1 }, new[] { 1, 1 }, new[] { 1, 2, 1 }, new[] { 1, 3, 3, 1 } })); } [Ignore("Remove to run test")] [Test] public void Five_rows() { var actual = PascalsTriangle.Calculate(5); Assert.That(actual, Is.EqualTo(new[] { new[] { 1 }, new[] { 1, 1 }, new[] { 1, 2, 1 }, new[] { 1, 3, 3, 1 }, new [] { 1, 4, 6, 4, 1 } })); } [Ignore("Remove to run test")] [Test] public void Twenty_rows() { var actual = PascalsTriangle.Calculate(20).Last(); Assert.That(actual, Is.EqualTo(new[] { 1, 19, 171, 969, 3876, 11628, 27132, 50388, 75582, 92378, 92378, 75582, 50388, 27132, 11628, 3876, 969, 171, 19, 1 })); } }
Version data entries
115 entries across 115 versions & 1 rubygems