PangramTest.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. declare(strict_types=1);
  3. class PangramTest extends PHPUnit\Framework\TestCase
  4. {
  5. public static function setUpBeforeClass(): void
  6. {
  7. require_once 'Pangram.php';
  8. }
  9. /**
  10. * uuid 64f61791-508e-4f5c-83ab-05de042b0149
  11. * @testdox Empty sentence
  12. */
  13. public function testSentenceEmpty(): void
  14. {
  15. $this->assertFalse(isPangram(''));
  16. }
  17. /**
  18. * uuid 74858f80-4a4d-478b-8a5e-c6477e4e4e84
  19. * @testdox Perfect lower case
  20. */
  21. public function testPerfectLowerCase(): void
  22. {
  23. $this->assertTrue(isPangram('abcdefghijklmnopqrstuvwxyz'));
  24. }
  25. /**
  26. * uuid 61288860-35ca-4abe-ba08-f5df76ecbdcd
  27. * @testdox Only lower case
  28. */
  29. public function testPangramWithOnlyLowerCase(): void
  30. {
  31. $this->assertTrue(isPangram('the quick brown fox jumps over the lazy dog'));
  32. }
  33. /**
  34. * uuid 6564267d-8ac5-4d29-baf2-e7d2e304a743
  35. * @testdox Missing the letter 'x'
  36. */
  37. public function testMissingCharacterX(): void
  38. {
  39. $this->assertFalse(isPangram('a quick movement of the enemy will jeopardize five gunboats'));
  40. }
  41. /**
  42. * uuid c79af1be-d715-4cdb-a5f2-b2fa3e7e0de0
  43. * @testdox Missing the letter 'h'
  44. */
  45. public function testMissingCharacterH(): void
  46. {
  47. $this->assertFalse(isPangram('five boxing wizards jump quickly at it'));
  48. }
  49. /**
  50. * uuid d835ec38-bc8f-48e4-9e36-eb232427b1df
  51. * @testdox With underscores
  52. */
  53. public function testPangramWithUnderscores(): void
  54. {
  55. $this->assertTrue(isPangram('the_quick_brown_fox_jumps_over_the_lazy_dog'));
  56. }
  57. /**
  58. * uuid 8cc1e080-a178-4494-b4b3-06982c9be2a8
  59. * @testdox With numbers
  60. */
  61. public function testPangramWithNumbers(): void
  62. {
  63. $this->assertTrue(isPangram('the 1 quick brown fox jumps over the 2 lazy dogs'));
  64. }
  65. /**
  66. * uuid bed96b1c-ff95-45b8-9731-fdbdcb6ede9a
  67. * @testdox Missing letters replaced by numbers
  68. */
  69. public function testMissingLettersReplacedByNumbers(): void
  70. {
  71. $this->assertFalse(isPangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog'));
  72. }
  73. /**
  74. * uuid 938bd5d8-ade5-40e2-a2d9-55a338a01030
  75. * @testdox Mixed case and punctuation
  76. */
  77. public function testPangramWithMixedCaseAndPunctuation(): void
  78. {
  79. $this->assertTrue(isPangram('"Five quacking Zephyrs jolt my wax bed."'));
  80. }
  81. /**
  82. * uuid 7138e389-83e4-4c6e-8413-1e40a0076951
  83. * @testdox a-m and A-M are 26 different characters but not a pangram
  84. */
  85. public function testEnoughDifferentCharsButOnlyCaseDiffers(): void
  86. {
  87. $this->assertFalse(isPangram('abcdefghijklm ABCDEFGHIJKLM'));
  88. }
  89. /*
  90. * PHP track addons
  91. */
  92. /**
  93. * @testdox Unicode mixed into pangram
  94. */
  95. public function testPangramMixedWithUnicode(): void
  96. {
  97. $this->assertTrue(isPangram('Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.'));
  98. }
  99. }