Add tests to pig-latin exercise

This may happen because not all solutions use split and translate. This is why.

I am going to give up on space-preserving test because I haven’t seen any interest on this one.

But can prepare a pull request to add my first extra test or keraville’s test as reimplementantation of “quick fast run” test if you find this appropriate.

IsaacG, the example solution transforms all words, not just one, it just picks a wrong (vowel) pattern to translate them, and that pattern doesn’t work on words starting with consonants.

On the contrary, one can say that the example solution checks for one word to translate all words.

Please do not open any PRs until you have buy in of at least three maintainers.

keiraville proposed a multi-word test that contains all rules in one test. That should be used to replace the existing phrase test. Whitespace should not be added.

1 Like

Understood.

A short summary of discussion:

What is discussed

While mentioning a student’s solution, I noticed that his/her solution makes a wrong assumption that phrase always consists of words with the same type (all words starting with consonants or all words starting with vowels).

Then I tried to lead student towards a canonical solution, but to my suprise, the canonical solution have the same bug.

Why this happened

Almost all tests in the suite tests a single word (for which the incorrect assumption that phrase always contains words of one type always holds). Due to the unfortunate decision the only test that contains several words contain only words of the same type (the ones starting with consonants).

A proposal

To help students catch the bug, a test is proposed which contains not only words starting with consonants, but also words starting with vowels. This helps to ensure that the decision for each word is taken individually, not like “oh, I see a word starting with vowel, let us translate all words using a vowel pattern”, or the same assumption for consonants.

Here are proposed variants:

"quick afternoon run"
"my quick afternoon xray scan"

(keraville)

Both variants contain words of both kinds, so they should help to catch the bug.

"why do squids enjoy xrays" => "ywhay oday idssquay enjoyay xraysay"

;)

4 Likes

Hey nice :)

+1 for “why do squids enjoy xrays”

+1 from me, too

IsaacG, taking into account there is already at least three maintainers in the thread, we probably can come to consensus now?

Two explicit approvals and two implicit.
I’ll give a +1 here so there are three explicit approvals. Please do open a PR!

2 Likes

Great! Going to work on PR now.

Just want to make one thing clear before moving on: which variant to use? If I will use glennj variant, is that ok?

That’s the one with explicit approvals, yes.

Good, I will use glennj variant.

The pull request is ready: Pig-latin exercise specification update - a reimplementation of whole-phrase test by Aksima · Pull Request #2697 · exercism/problem-specifications · GitHub

2 Likes

The PR is now merged.

3 Likes

Sorry for not spotting this during the review.

The expectation needs correcting

-ywhay oday idssquay enjoyay xrayay
+ywhay oday idssquay enjoyay xraysay
2 Likes

Added a new pull request to resolve the issue: [pig-latin] reimplement a test which had an incorrect value by Aksima · Pull Request #2699 · exercism/problem-specifications · GitHub

For the future work, I am curious if you have any idea to retrieve a text from forum discussion using only basic tools (curl, wget) and no graphical interface.

Since development machines usually do not have any GUI.

Got an idea with the help of AI. It actually turned out to be very simple.

According to the information provided, forum at forum.exercism.org runs on Discourse software, which automatically exposes a structured JSON API for its content. The key is to find the topic ID from the URL of the discussion.

For example, let us take URL of current discussion:

https://forum.exercism.org/t/add-tests-to-pig-latin-exercise/95998

The number at the end (95998) is the topic ID.

We can then use this topic ID to fetch the JSON representation. This includes the first 20 posts by default.

curl -s "https://forum.exercism.org/t/95998.json"