Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating tests for Reverse-String exercise #1037

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jagdish-15
Copy link
Contributor

Pull Request: Update Test Suite for Reverse-String Exercise

This pull request updates the test suite for the Reverse-String exercise, bringing it in line with the latest problem specification. With this update, all tests for the exercise are now fully synchronized.

@siebenschlaefer
Copy link
Contributor

Did you write an example solution in C that deals with unicode and grapheme clusters?
Do we really expect our students to do that?

@wolf99
Copy link
Contributor

wolf99 commented Jan 9, 2025

The current tests and example implementation do not handle wide characters, grapheme clusters, UTF, etc. It only handles 8-bit ASCII characters.

So unless this exercise is radically changed then these tests should be marked as not implemented and the failing tests removed.

It mat be a good addition to the track to have an exercise that handles such characters (I don't think we have any other such exercise). But I don't know if this should be that exercise, and I don't think such a change is within the scope of the simple update that was intended.

@jagdish-15
Copy link
Contributor Author

jagdish-15 commented Jan 17, 2025

Hi @wolf99,

I've temporarily commented out these tests for now. If there's a more standardized or preferred approach, please let me know, and I'll make the necessary adjustments.

I was considering using TEST_IGNORE() as an alternative—do you think that would be the right way to proceed?

Apologies for the delay in revisiting this; I was tied up with exams.

Copy link
Contributor

@wolf99 wolf99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jagdish-15

Unfortunately TEST_IGNORE() is not suitable as we use this in valid tests that are expected to succeed as a student enables each one in turn (enabling them to use TDD loop to develop a solution).

Instead, because in this track we do not want to include these cases for this exercise, the tests need to be removed completely.
However, we need some way to mark that we have explicitly decided not to include these tests.
Luckily the .meta/tests.tomlfile format allows this 😄

You can see the format details here: https://exercism.org/docs/building/tracks/practice-exercises#h-file-meta-tests-toml
My review suggestions here implement this.

@@ -19,3 +26,12 @@ description = "a palindrome"

[b9e7dec1-c6df-40bd-9fa3-cd7ded010c4c]
description = "an even-sized word"

[1bed0f8a-13b0-4bd3-9d59-3d0593326fa2]
description = "wide characters"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description = "wide characters"
description = "wide characters"
include = false
comment = "track decision to only handle ASCII strings for this exercise"

description = "wide characters"

[93d7e1b8-f60f-4f3c-9559-4056e10d2ead]
description = "grapheme cluster with pre-combined form"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description = "grapheme cluster with pre-combined form"
description = "grapheme cluster with pre-combined form"
include = false
comment = "track decision to only handle ASCII strings for this exercise"

description = "grapheme cluster with pre-combined form"

[1028b2c1-6763-4459-8540-2da47ca512d9]
description = "grapheme clusters"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description = "grapheme clusters"
description = "grapheme clusters"
include = false
comment = "track decision to only handle ASCII strings for this exercise"

Comment on lines +53 to +69
#if 0
static void test_wide_characters(void)
{
test_reverse("子猫", "猫子");
}

static void test_grapheme_cluster_with_pre_combined_form(void)
{
test_reverse("Würstchenstand", "dnatsnehctsrüW");
}

static void test_grapheme_clusters(void)
{
test_reverse("ผู้เขียนโปรแกรม", "มรกแรปโนยขีเผู้");
}
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if 0
static void test_wide_characters(void)
{
test_reverse("子猫", "猫子");
}
static void test_grapheme_cluster_with_pre_combined_form(void)
{
test_reverse("Würstchenstand", "dnatsnehctsrüW");
}
static void test_grapheme_clusters(void)
{
test_reverse("ผู้เขียนโปรแกรม", "มรกแรปโนยขีเผู้");
}
#endif

Comment on lines +81 to +93
/*
* Commenting out the following tests for now because the current
* implementation does not support handling wide characters, grapheme
* clusters, or UTF characters. The implementation currently only handles
* 8-bit ASCII characters, so these tests will cause failures when executed.
* Once support for wider character sets is added, these tests can be
* re-enabled for proper validation.
*/

// RUN_TEST(test_wide_characters);
// RUN_TEST(test_grapheme_cluster_with_pre_combined_form);
// RUN_TEST(test_grapheme_clusters);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/*
* Commenting out the following tests for now because the current
* implementation does not support handling wide characters, grapheme
* clusters, or UTF characters. The implementation currently only handles
* 8-bit ASCII characters, so these tests will cause failures when executed.
* Once support for wider character sets is added, these tests can be
* re-enabled for proper validation.
*/
// RUN_TEST(test_wide_characters);
// RUN_TEST(test_grapheme_cluster_with_pre_combined_form);
// RUN_TEST(test_grapheme_clusters);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants