|
| 1 | +unit TestCases; |
| 2 | + |
| 3 | +{$mode ObjFPC}{$H+} |
| 4 | + |
| 5 | +interface |
| 6 | + |
| 7 | +uses Classes, SysUtils, FPCUnit, TestRegistry, FPCUnitTestUtils; |
| 8 | + |
| 9 | +type |
| 10 | + AllFailTest = class(TTestCase) |
| 11 | + published |
| 12 | + procedure basic; |
| 13 | + procedure lowercase_words; |
| 14 | + procedure punctuation; |
| 15 | + procedure all_caps_word; |
| 16 | + procedure punctuation_without_whitespace; |
| 17 | + procedure very_long_abbreviation; |
| 18 | + procedure consecutive_delimiters; |
| 19 | + procedure apostrophes; |
| 20 | + procedure underscore_emphasis; |
| 21 | + end; |
| 22 | + |
| 23 | +implementation |
| 24 | + |
| 25 | +uses AllFail; |
| 26 | + |
| 27 | +// 1e22cceb-c5e4-4562-9afe-aef07ad1eaf4 |
| 28 | +procedure AllFailTest.basic; |
| 29 | +begin |
| 30 | + TapAssertTrue( |
| 31 | + Self, |
| 32 | + 'basic', |
| 33 | + 'PNG', |
| 34 | + AllFail.abbreviate('Portable Network Graphics') |
| 35 | + ); |
| 36 | +end; |
| 37 | + |
| 38 | +// 79ae3889-a5c0-4b01-baf0-232d31180c08 |
| 39 | +procedure AllFailTest.lowercase_words; |
| 40 | +begin |
| 41 | + TapAssertTrue(Self, 'lowercase words', 'ROR', AllFail.abbreviate('Ruby on Rails')); |
| 42 | +end; |
| 43 | + |
| 44 | +// ec7000a7-3931-4a17-890e-33ca2073a548 |
| 45 | +procedure AllFailTest.punctuation; |
| 46 | +begin |
| 47 | + TapAssertTrue(Self, 'punctuation', 'FIFO', AllFail.abbreviate('First In, First Out')); |
| 48 | +end; |
| 49 | + |
| 50 | +// 32dd261c-0c92-469a-9c5c-b192e94a63b0 |
| 51 | +procedure AllFailTest.all_caps_word; |
| 52 | +begin |
| 53 | + TapAssertTrue(Self, 'all caps word', 'GIMP', AllFail.abbreviate('GNU Image Manipulation Program')); |
| 54 | +end; |
| 55 | + |
| 56 | +// ae2ac9fa-a606-4d05-8244-3bcc4659c1d4 |
| 57 | +procedure AllFailTest.punctuation_without_whitespace; |
| 58 | +begin |
| 59 | + TapAssertTrue(Self, 'punctuation without whitespace', 'CMOS', AllFail.abbreviate('Complementary metal-oxide semiconductor')); |
| 60 | +end; |
| 61 | + |
| 62 | +// 0e4b1e7c-1a6d-48fb-81a7-bf65eb9e69f9 |
| 63 | +procedure AllFailTest.very_long_abbreviation; |
| 64 | +begin |
| 65 | + TapAssertTrue(Self, 'very long abbreviation', 'ROTFLSHTMDCOALM', AllFail.abbreviate('Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me')); |
| 66 | +end; |
| 67 | + |
| 68 | +// 6a078f49-c68d-4b7b-89af-33a1a98c28cc |
| 69 | +procedure AllFailTest.consecutive_delimiters; |
| 70 | +begin |
| 71 | + TapAssertTrue(Self, 'consecutive delimiters', 'SIMUFTA', AllFail.abbreviate('Something - I made up from thin air')); |
| 72 | +end; |
| 73 | + |
| 74 | +// 5118b4b1-4572-434c-8d57-5b762e57973e |
| 75 | +procedure AllFailTest.apostrophes; |
| 76 | +begin |
| 77 | + TapAssertTrue(Self, 'apostrophes', 'HC', AllFail.abbreviate('Halley''s Comet')); |
| 78 | +end; |
| 79 | + |
| 80 | +// adc12eab-ec2d-414f-b48c-66a4fc06cdef |
| 81 | +procedure AllFailTest.underscore_emphasis; |
| 82 | +begin |
| 83 | + TapAssertTrue(Self, 'underscore emphasis', 'TRNT', AllFail.abbreviate('The Road _Not_ Taken')); |
| 84 | +end; |
| 85 | + |
| 86 | +initialization |
| 87 | +RegisterTest(AllFailTest); |
| 88 | + |
| 89 | +end. |
0 commit comments