| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 | 
							- <?php
 
- /*
 
-  * By adding type hints and enabling strict type checking, code can become
 
-  * easier to read, self-documenting and reduce the number of potential bugs.
 
-  * By default, type declarations are non-strict, which means they will attempt
 
-  * to change the original type to match the type specified by the
 
-  * type-declaration.
 
-  *
 
-  * In other words, if you pass a string to a function requiring a float,
 
-  * it will attempt to convert the string value to a float.
 
-  *
 
-  * To enable strict mode, a single declare directive must be placed at the top
 
-  * of the file.
 
-  * This means that the strictness of typing is configured on a per-file basis.
 
-  * This directive not only affects the type declarations of parameters, but also
 
-  * a function's return type.
 
-  *
 
-  * For more info review the Concept on strict type checking in the PHP track
 
-  * <link>.
 
-  *
 
-  * To disable strict typing, comment out the directive below.
 
-  */
 
- declare(strict_types=1);
 
- class SieveTest extends PHPUnit\Framework\TestCase
 
- {
 
-     public static function setUpBeforeClass(): void
 
-     {
 
-         require_once 'Sieve.php';
 
-     }
 
-     public function testNoPrimesUnderTwo(): void
 
-     {
 
-         $this->assertEquals([], sieve(1));
 
-     }
 
-     public function testFindFirstPrime(): void
 
-     {
 
-         $this->assertEquals([2], sieve(2));
 
-     }
 
-     public function testFindPrimesUpTo10(): void
 
-     {
 
-         $this->assertEquals([2, 3, 5, 7], sieve(10));
 
-     }
 
-     public function testLimitIsPrime(): void
 
-     {
 
-         $this->assertEquals([2, 3, 5, 7, 11, 13], sieve(13));
 
-     }
 
-     public function testFindPrimesUpTo1000(): void
 
-     {
 
-         $this->assertEquals(
 
-             [
 
-                 2,
 
-                 3,
 
-                 5,
 
-                 7,
 
-                 11,
 
-                 13,
 
-                 17,
 
-                 19,
 
-                 23,
 
-                 29,
 
-                 31,
 
-                 37,
 
-                 41,
 
-                 43,
 
-                 47,
 
-                 53,
 
-                 59,
 
-                 61,
 
-                 67,
 
-                 71,
 
-                 73,
 
-                 79,
 
-                 83,
 
-                 89,
 
-                 97,
 
-                 101,
 
-                 103,
 
-                 107,
 
-                 109,
 
-                 113,
 
-                 127,
 
-                 131,
 
-                 137,
 
-                 139,
 
-                 149,
 
-                 151,
 
-                 157,
 
-                 163,
 
-                 167,
 
-                 173,
 
-                 179,
 
-                 181,
 
-                 191,
 
-                 193,
 
-                 197,
 
-                 199,
 
-                 211,
 
-                 223,
 
-                 227,
 
-                 229,
 
-                 233,
 
-                 239,
 
-                 241,
 
-                 251,
 
-                 257,
 
-                 263,
 
-                 269,
 
-                 271,
 
-                 277,
 
-                 281,
 
-                 283,
 
-                 293,
 
-                 307,
 
-                 311,
 
-                 313,
 
-                 317,
 
-                 331,
 
-                 337,
 
-                 347,
 
-                 349,
 
-                 353,
 
-                 359,
 
-                 367,
 
-                 373,
 
-                 379,
 
-                 383,
 
-                 389,
 
-                 397,
 
-                 401,
 
-                 409,
 
-                 419,
 
-                 421,
 
-                 431,
 
-                 433,
 
-                 439,
 
-                 443,
 
-                 449,
 
-                 457,
 
-                 461,
 
-                 463,
 
-                 467,
 
-                 479,
 
-                 487,
 
-                 491,
 
-                 499,
 
-                 503,
 
-                 509,
 
-                 521,
 
-                 523,
 
-                 541,
 
-                 547,
 
-                 557,
 
-                 563,
 
-                 569,
 
-                 571,
 
-                 577,
 
-                 587,
 
-                 593,
 
-                 599,
 
-                 601,
 
-                 607,
 
-                 613,
 
-                 617,
 
-                 619,
 
-                 631,
 
-                 641,
 
-                 643,
 
-                 647,
 
-                 653,
 
-                 659,
 
-                 661,
 
-                 673,
 
-                 677,
 
-                 683,
 
-                 691,
 
-                 701,
 
-                 709,
 
-                 719,
 
-                 727,
 
-                 733,
 
-                 739,
 
-                 743,
 
-                 751,
 
-                 757,
 
-                 761,
 
-                 769,
 
-                 773,
 
-                 787,
 
-                 797,
 
-                 809,
 
-                 811,
 
-                 821,
 
-                 823,
 
-                 827,
 
-                 829,
 
-                 839,
 
-                 853,
 
-                 857,
 
-                 859,
 
-                 863,
 
-                 877,
 
-                 881,
 
-                 883,
 
-                 887,
 
-                 907,
 
-                 911,
 
-                 919,
 
-                 929,
 
-                 937,
 
-                 941,
 
-                 947,
 
-                 953,
 
-                 967,
 
-                 971,
 
-                 977,
 
-                 983,
 
-                 991,
 
-                 997,
 
-             ],
 
-             sieve(1000)
 
-         );
 
-     }
 
- }
 
 
  |