aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-20 11:01:52 +0000
committer_ov4 <ov4@ov4.org>2026-10-20 11:01:52 +0000
commita1ba45b28c94244d2e1c6f00372d51d294cc3edc (patch)
treeec93c86d6476aa8f612028f63582c95a55fd77ed /tests
parent65599524f5b41ffb6d8d55664611612c0b57ad47 (diff)
feat(library): add experimental string LCASE overloads
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/library/exp-string/expected.txt5
-rw-r--r--tests/library/exp-string/notes.md2
-rw-r--r--tests/library/exp-string/program.cps14
3 files changed, 21 insertions, 0 deletions
diff --git a/tests/library/exp-string/expected.txt b/tests/library/exp-string/expected.txt
index a3ce792..f5eda62 100644
--- a/tests/library/exp-string/expected.txt
+++ b/tests/library/exp-string/expected.txt
@@ -22,3 +22,8 @@ GH
0:0
0:0
4
+abc@19
+AbC@19
+w:w:@
+0:8
+abc
diff --git a/tests/library/exp-string/notes.md b/tests/library/exp-string/notes.md
index c05d6d7..47fb6ca 100644
--- a/tests/library/exp-string/notes.md
+++ b/tests/library/exp-string/notes.md
@@ -11,3 +11,5 @@ RIGHT keeps FGH, returns zero bytes for an empty source or nonpositive count, an
The added checks use separate procedures to keep generated temporary-object cleanup small enough for the ordinary runner timeout.
MID positions 2..4 give BCD. The minimum INTEGER start clamps to 1 and gives AB; a maximum count from position 7 gives GH. Empty input, a maximum start, and nonpositive counts give length zero. Four bytes starting at the second of three NULs retain two NULs and AB.
+
+LCASE converts AbC@19 to abc@19 without modifying the source. Its CHAR overload returns CHAR w for W or w and preserves @, as in guide section 5.5. Empty length stays zero; two leading NULs survive conversion and letters after them still become abc.
diff --git a/tests/library/exp-string/program.cps b/tests/library/exp-string/program.cps
index 0b6c977..2e041ec 100644
--- a/tests/library/exp-string/program.cps
+++ b/tests/library/exp-string/program.cps
@@ -42,6 +42,7 @@ DELETE Heap
CALL CheckLeft()
CALL CheckRight()
CALL CheckMid()
+CALL CheckLCase()
PROCEDURE CheckLeft()
DECLARE Letters : _EXP_STRING((C_STRING)"ABCDEFGH")
@@ -76,3 +77,16 @@ PROCEDURE CheckMid()
OUTPUT _EXP_STRING_LENGTH(_EXP_STRING_MID(Letters, 2, 0)), ":", _EXP_STRING_LENGTH(_EXP_STRING_MID(Letters, 2, -1))
OUTPUT _EXP_STRING_LENGTH(_EXP_STRING_MID(Nuls & Letters, 2, 4))
ENDPROCEDURE
+
+PROCEDURE CheckLCase()
+ DECLARE Mixed : _EXP_STRING((C_STRING)"AbC@19")
+ DECLARE Empty : _EXP_STRING
+ DECLARE Nuls : _EXP_STRING(2, (C_CHAR)'\0')
+ CALL _EXP_STRING_OUTPUT(_EXP_STRING_LCASE(Mixed))
+ CALL _EXP_STRING_OUTPUT(Mixed)
+ DECLARE Lower : CHAR
+ Lower <- _EXP_STRING_LCASE('W')
+ OUTPUT Lower, ":", _EXP_STRING_LCASE('w'), ":", _EXP_STRING_LCASE('@')
+ OUTPUT _EXP_STRING_LENGTH(_EXP_STRING_LCASE(Empty)), ":", _EXP_STRING_LENGTH(_EXP_STRING_LCASE(Nuls & Mixed))
+ CALL _EXP_STRING_OUTPUT(_EXP_STRING_MID(_EXP_STRING_LCASE(Nuls & Mixed), 3, 3))
+ENDPROCEDURE