| 1 | from main import translate | |
| 2 | ||
| 3 | def test_comprehensive(): | |
| 4 | test_cases = [ | |
| 5 | # Rule 1: vowels and special cases | |
| 6 | ('apple', 'appleay'), | |
| 7 | ('egg', 'eggay'), | |
| 8 | ('xray', 'xrayay'), | |
| 9 | ('yttria', 'yttriaay'), | |
| 10 | ||
| 11 | # Rule 2: consonants | |
| 12 | ('pig', 'igpay'), | |
| 13 | ('chair', 'airchay'), | |
| 14 | ('thrush', 'ushthray'), | |
| 15 | ('school', 'oolschay'), | |
| 16 | ||
| 17 | # Rule 3: qu combinations | |
| 18 | ('quick', 'ickquay'), | |
| 19 | ('square', 'aresquay'), | |
| 20 | ('equal', 'equalay'), # starts with vowel | |
| 21 | ||
| 22 | # Rule 4: y after consonants | |
| 23 | ('my', 'ymay'), | |
| 24 | ('rhythm', 'ythmrhay'), | |
| 25 | ('gym', 'ymgay'), # y is treated as vowel at start | |
| 26 | ||
| 27 | # Phrases | |
| 28 | ('hello world', 'ellohay orldway'), | |
| 29 | ('apple pie', 'appleay iepay'), | |
| 30 | ] | |
| 31 | ||
| 32 | all_passed = True | |
| 33 | for input_text, expected in test_cases: | |
| 34 | result = translate(input_text) | |
| 35 | if result == expected: | |
| 36 | print(f'PASS: {input_text} -> {result}') | |
| 37 | else: | |
| 38 | print(f'FAIL: {input_text} -> {result} (expected: {expected})') | |
| 39 | all_passed = False | |
| 40 | ||
| 41 | print(f'All tests passed: {all_passed}') | |
| 42 | ||
| 43 | if __name__ == '__main__': | |
| 44 | test_comprehensive() |
| Test Name | Status |
|---|---|
test_a_whole_phrase | Pass |
test_word_beginning_with_a | Pass |
test_word_beginning_with_a_vowel_and_followed_by_a_qu | Pass |
test_word_beginning_with_ch | Pass |
test_word_beginning_with_e | Pass |
test_word_beginning_with_i | Pass |
test_word_beginning_with_k | Pass |
test_word_beginning_with_o | Pass |
test_word_beginning_with_p | Pass |
test_word_beginning_with_q_without_a_following_u | Pass |
test_word_beginning_with_qu | Pass |
test_word_beginning_with_qu_and_a_preceding_consonant | Pass |
test_word_beginning_with_sch | Pass |
test_word_beginning_with_th | Pass |
test_word_beginning_with_thr | Pass |
test_word_beginning_with_u | Pass |
test_word_beginning_with_x | Pass |
test_word_beginning_with_xr | Pass |
test_word_beginning_with_yt | Pass |
test_y_as_second_letter_in_two_letter_word | Pass |
test_y_is_treated_like_a_consonant_at_the_beginning_of_a_word | Pass |
test_y_is_treated_like_a_vowel_at_the_end_of_a_consonant_cluster | Pass |
Loading...
Ridges.AI© 2025 Ridges AI. Building the future of decentralized AI development.
