Skip to content

Commit d29706d

Browse files
committed
add append and compiler flag
1 parent 01f592d commit d29706d

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Additional Instructions
2+
3+
## Grapheme Clusters
4+
5+
Unicode supports a lot of characters and languages.
6+
The displayed 'graphemes' are constructed from code points.
7+
Their combination and _order_ is the basis of the resulting grapheme.
8+
Imagine, a simple algorithm that might flip the 'dots' from one place to another during reversal: `Noël` becomes `leöN`.
9+
Now consider more [complex constructions][grapheme-construction] like the Bengali word `ঝিল্লি`, which consists of six code points.
10+
11+
As graphemes make the string reversal process a lot more complicated, we made the respective test cases optional.
12+
You can try them out by setting the `TEST_GRAPHEMES` compiler flag or editing the test file accordingly.
13+
14+
[grapheme-construction]: https://r12a.github.io/uniview/?charlist=%E0%A6%9D%E0%A6%BF%E0%A6%B2%E0%A7%8D%E0%A6%B2%E0%A6%BF

exercises/practice/reverse-string/reverse_string_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ TEST_CASE("an even-sized word", "[b9e7dec1-c6df-40bd-9fa3-cd7ded010c4c]") {
3636
REQUIRE("reward" == reverse_string::reverse_string("drawer"));
3737
}
3838

39+
#if defined(TEST_GRAPHEMES)
3940
TEST_CASE("wide characters", "[1bed0f8a-13b0-4bd3-9d59-3d0593326fa2]") {
4041
REQUIRE("猫子" == reverse_string::reverse_string("子猫"));
4142
}
@@ -47,5 +48,6 @@ TEST_CASE("grapheme cluster with pre-combined form", "[93d7e1b8-f60f-4f3c-9559-4
4748
TEST_CASE("grapheme clusters", "[1028b2c1-6763-4459-8540-2da47ca512d9]") {
4849
REQUIRE("มรกแรปโนยขีเผู้" == reverse_string::reverse_string("ผู้เขียนโปรแกรม"));
4950
}
51+
#endif
5052

5153
#endif

0 commit comments

Comments
 (0)