DifferenceOfSquaresTest.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. declare(strict_types=1);
  3. class DifferenceOfSquaresTest extends PHPUnit\Framework\TestCase
  4. {
  5. public static function setUpBeforeClass(): void
  6. {
  7. require_once 'DifferenceOfSquares.php';
  8. }
  9. /**
  10. * uuid e46c542b-31fc-4506-bcae-6b62b3268537
  11. * @testdox Square of sum 1
  12. */
  13. public function testSquareOfSumTo1(): void
  14. {
  15. $this->assertEquals(1, squareOfSum(1));
  16. }
  17. /**
  18. * uuid 9b3f96cb-638d-41ee-99b7-b4f9c0622948
  19. * @testdox Square of sum 5
  20. */
  21. public function testSquareOfSumTo5(): void
  22. {
  23. $this->assertEquals(225, squareOfSum(5));
  24. }
  25. /**
  26. * uuid 54ba043f-3c35-4d43-86ff-3a41625d5e86
  27. * @testdox Square of sum 100
  28. */
  29. public function testSquareOfSumTo100(): void
  30. {
  31. $this->assertEquals(25502500, squareOfSum(100));
  32. }
  33. /**
  34. * uuid 01d84507-b03e-4238-9395-dd61d03074b5
  35. * @testdox Sum of squares 1
  36. */
  37. public function testSumOfSquaresTo1(): void
  38. {
  39. $this->assertEquals(1, sumOfSquares(1));
  40. }
  41. /**
  42. * uuid c93900cd-8cc2-4ca4-917b-dd3027023499
  43. * @testdox Sum of squares 5
  44. */
  45. public function testSumOfSquaresTo5(): void
  46. {
  47. $this->assertEquals(55, sumOfSquares(5));
  48. }
  49. /**
  50. * uuid 94807386-73e4-4d9e-8dec-69eb135b19e4
  51. * @testdox Sum of squares 100
  52. */
  53. public function testSumOfSquaresTo100(): void
  54. {
  55. $this->assertEquals(338350, sumOfSquares(100));
  56. }
  57. /**
  58. * uuid 44f72ae6-31a7-437f-858d-2c0837adabb6
  59. * @testdox Difference of squares 1
  60. */
  61. public function testDifferenceOfSumTo1(): void
  62. {
  63. $this->assertEquals(0, difference(1));
  64. }
  65. /**
  66. * uuid 005cb2bf-a0c8-46f3-ae25-924029f8b00b
  67. * @testdox Difference of squares 5
  68. */
  69. public function testDifferenceOfSumTo5(): void
  70. {
  71. $this->assertEquals(170, difference(5));
  72. }
  73. /**
  74. * uuid b1bf19de-9a16-41c0-a62b-1f02ecc0b036
  75. * @testdox Difference of squares 100
  76. */
  77. public function testDifferenceOfSumTo100(): void
  78. {
  79. $this->assertEquals(25164150, difference(100));
  80. }
  81. }