public void TestProductofArrayExceptSelf() { var res = ProductofArrayExceptSelf.Calc(new int[] { 1, 2, 3, 4 }); Assert.AreEqual(res[0], 24); Assert.AreEqual(res[1], 12); Assert.AreEqual(res[2], 8); Assert.AreEqual(res[3], 6); }
public void ProductofArrayExceptSelfSuccess() { int[] nums = new int[] { 1, 2, 3, 4 }; var expectedResult = new int[] { 24, 12, 8, 6 }; var result = new ProductofArrayExceptSelf().ProductExceptSelf(nums); var isEqual = ArrayEquivalence.sequencesEqual(result, expectedResult); Assert.IsTrue(isEqual); }
public void RotateTests() { ProductofArrayExceptSelf obj = new ProductofArrayExceptSelf(); int[] nums = new[] { 1, 2, 3, 4 }; var x = obj.ProductExceptSelf(nums);//[24,12,8,6] nums = new[] { 2, 2, 2, 2 }; x = obj.ProductExceptSelf(nums);//[24,12,8,6] nums = new[] { 2 }; x = obj.ProductExceptSelf(nums); nums = new[] { 2, 2 }; x = obj.ProductExceptSelf(nums); nums = new int[] { }; x = obj.ProductExceptSelf(nums); }