コード例 #1
0
ファイル: SumOfSquares_Test.cs プロジェクト: rarevans/Euler
        public void Result_Correct(
            [Values(1, 2, 1, 1, 1, 4)] int low,
            [Values(1, 1, 2, 3, 10, 9)] int high,
            [Values(1, 0, 5, 14, 385, 271)] int expectedResult)
        {
            SumOfSquares sumSq = new SumOfSquares(low, high);

            var result = sumSq.Result();

            Assert.That(result, Is.EqualTo(expectedResult));
        }
コード例 #2
0
ファイル: SumSquareDiff_Test.cs プロジェクト: rarevans/Euler
        public void SquareSum_SumSquare_Diff(
            [Values(1, 3, 1, 1, 1, 1, 1)] int low,
            [Values(1, 1, 2, 3, 4, 10, 100)] int high,
            [Values(0, 0, 4, 22, 70, 2640, 25164150)] int diff
            )
        {
            SumOfSquares sumSq = new SumOfSquares(low, high);
            SquareOfSum  sqSum = new SquareOfSum(low, high);

            var result = sqSum.Result() - sumSq.Result();

            Assert.That(result, Is.EqualTo(diff));
        }