This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch openformula
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 9bc678ecbc9fdb9999f4654ba7d99debe77c8e73
Author: Pedro Giffuni <[email protected]>
AuthorDate: Tue Nov 17 17:24:55 2026 -0500

    H.5.1: Priority 2 consistency fixes - calcval tests for H.1/H.2 functions
    
    - Add 40 calcval test cases:
      - SG.NUMVAL-01..10 (NUMBERVALUE: basic, European, group sep, percent, 
whitespace, empty, invalid, locale, cell ref)
      - SG.FINDB-01..10 (FINDB: basic, start pos, not found, case-sensitive, 
bounds, DBCS)
      - SG.SEARCHB-01..10 (SEARCHB: basic, case-insensitive, wildcards, regex, 
DBCS)
      - SG.REPLACEB-01..10 (REPLACEB: basic, append, multi-byte, DBCS, bounds, 
zero count)
    - Update function-semantic-test-plan.md to reflect implemented status
---
 .../function-semantic-test-plan.md                 | 73 ++++++++++++++++------
 test/odf-validate/calcval-cases14.tsv              | 40 ++++++++++++
 2 files changed, 93 insertions(+), 20 deletions(-)

diff --git a/audit/openformula-function-gaps/function-semantic-test-plan.md 
b/audit/openformula-function-gaps/function-semantic-test-plan.md
index 30f7d34a9e..2e3e31917c 100644
--- a/audit/openformula-function-gaps/function-semantic-test-plan.md
+++ b/audit/openformula-function-gaps/function-semantic-test-plan.md
@@ -25,40 +25,73 @@ claimed as verified.
 1. FINDB
 --------
 
-Not defined by ODF 1.4. Excel-specific byte-oriented find.
+Not defined by ODF 1.4. Excel-specific byte-oriented find (DBCS model).
 
-Test cases:
-  a) =FINDB("abc";"a") — parser rejection expected (unknown function)
-  b) =FINDB("abc";"b";1) — unknown function
-  c) XLS import of workbook containing FINDB — import failure expected
-  d) XLSX export of workbook containing FINDB — export failure expected
+Test cases (implemented as `SG.FINDB-*` in 
`test/odf-validate/calcval-cases14.tsv`):
+  a) =FINDB("b";"abc") — basic byte position (2)
+  b) =FINDB("b";"abc";2) — start position (2)
+  c) =FINDB("x";"abc") — not found (#VALUE!)
+  d) =FINDB("B";"abc") — case-sensitive (#VALUE!)
+  e) =FINDB("a";"abc";0) — start < 1 (#VALUE!)
+  f) =FINDB("a";"abc";10) — start > len (#VALUE!)
+  g) =FINDB("中";"中国") — DBCS first char (1, byte pos 1)
+  h) =FINDB("国";"中国") — DBCS second char (3)
+  i) =FINDB("b";"a中b") — mixed ASCII/DBCS (4)
+  j) =FINDB("国";"中国";3) — DBCS boundary start (3)
+
+Implemented: ScFindB() (interpr1.cxx:8155) uses AOO DBCS byte model
+  (DBCS=2 bytes, ASCII=1) via getLengthB, lcl_BytePosToCharIndex,
+  lcl_CharIndexToBytePos. Case-sensitive, no wildcards.
 
-Purpose: Confirm function is entirely absent (no opcode, no parser,
-         no evaluator).
+Purpose: Confirm FINDB byte-position semantics and DBCS handling.
 
 
 2. REPLACEB
 -----------
 
-Not defined by ODF 1.4. Excel-specific byte-oriented replace.
+Not defined by ODF 1.4. Excel-specific byte-oriented replace (DBCS model).
 
-Test cases:
-  a) =REPLACEB("abc";2;1;"x") — parser rejection expected
-  b) XLS import of workbook containing REPLACEB — import failure expected
+Test cases (implemented as `SG.REPLACEB-*` in 
`test/odf-validate/calcval-cases14.tsv`):
+  a) =REPLACEB("abc";2;1;"x") — basic replace (axc)
+  b) =REPLACEB("abc";4;0;"d") — append at end (abcd)
+  c) =REPLACEB("abcdef";2;2;"xy") — multi-byte (axydef)
+  d) =REPLACEB("中国";1;2;"中") — DBCS replace first char
+  e) =REPLACEB("abc";0;1;"x") — start < 1 (#VALUE!)
+  f) =REPLACEB("abc";2;-1;"x") — negative count (#VALUE!)
+  g) =REPLACEB("abc";10;1;"x") — start > len clamps (abcx)
+  h) =REPLACEB("中国";3;2;"国") — DBCS boundary (中国)
+  i) =REPLACEB("abc";1;3;"xyz") — replace all (xyz)
+  j) =REPLACEB("abc";2;0;"x") — zero count inserts (axbc)
+
+Implemented: ScReplaceB() (interpr1.cxx:8250) uses AOO DBCS byte model
+  via getLengthB, lcl_BytePosToCharIndex, lcl_CharIndexToBytePos.
+  Clamps position/count, handles DBCS boundaries.
 
-Purpose: Confirm function is entirely absent.
+Purpose: Confirm REPLACEB byte-position replace and boundary handling.
 
 
 3. SEARCHB
 ----------
 
-Not defined by ODF 1.4. Excel-specific byte-oriented search.
-
-Test cases:
-  a) =SEARCHB("b";"abc") — parser rejection expected
-  b) XLS import of workbook containing SEARCHB — import failure expected
-
-Purpose: Confirm function is entirely absent.
+Not defined by ODF 1.4. Excel-specific byte-oriented search (DBCS model).
+
+Test cases (implemented as `SG.SEARCHB-*` in 
`test/odf-validate/calcval-cases14.tsv`):
+  a) =SEARCHB("b";"abc") — basic byte position (2)
+  b) =SEARCHB("B";"abc") — case-insensitive (2)
+  c) =SEARCHB("a?c";"abc") — wildcard ? (1)
+  d) =SEARCHB("a*c";"abc") — wildcard * (1)
+  e) =SEARCHB("b";"abc";2) — start position (2)
+  f) =SEARCHB("x";"abc") — not found (#VALUE!)
+  g) =SEARCHB("中";"中国") — DBCS first char (1)
+  h) =SEARCHB("国";"中国") — DBCS second char (3)
+  i) =SEARCHB("b";"a中b") — mixed ASCII/DBCS (4)
+  j) =SEARCHB("a.c";"abc") — regex dot (1)
+
+Implemented: ScSearchB() (interpr1.cxx:8197) uses AOO DBCS byte model
+  via getLengthB, lcl_BytePosToCharIndex, lcl_CharIndexToBytePos.
+  Case-insensitive, supports wildcards/regex via utl::TextSearch.
+
+Purpose: Confirm SEARCHB byte-position search and wildcard behavior.
 
 
 4. DATEDIF
diff --git a/test/odf-validate/calcval-cases14.tsv 
b/test/odf-validate/calcval-cases14.tsv
index 6f01b9a3fc..7080bd8231 100644
--- a/test/odf-validate/calcval-cases14.tsv
+++ b/test/odf-validate/calcval-cases14.tsv
@@ -377,3 +377,43 @@ SG.ISO-22-dec28-2020       =ISOWEEKNUM(DATE(2020;12;28))   
cell    53      ISO 8601 week 53 (Mon
 SG.ISO-23-jan1-2026    =ISOWEEKNUM(DATE(2026;1;1))     cell    53      ISO 
8601 week 53 of 2025 (Thursday Jan 1 2026)
 SG.ISO-24-jan4-2023    =ISOWEEKNUM(DATE(2023;1;4))     cell    1       ISO 
8601 week 1 (first Thursday)
 SG.ISO-25-dec28-2023   =ISOWEEKNUM(DATE(2023;12;28))   cell    52      ISO 
8601 week 52 (Thursday Dec 28 2023)
+SG.NUMVAL-01-basic     =NUMBERVALUE("1.234")   cell    1.234   6.13.28 basic 
decimal parsing
+SG.NUMVAL-02-european  =NUMBERVALUE("1.234,56";",";".")        cell    1234.56 
6.13.28 European format with comma decimal
+SG.NUMVAL-03-group-sep =NUMBERVALUE("1 234.56";".";" ")        cell    1234.56 
6.13.28 space group separator
+SG.NUMVAL-04-percent   =NUMBERVALUE("123%")    cell    1.23    6.13.28 single 
percent divides by 100
+SG.NUMVAL-05-multi-percent     =NUMBERVALUE("100%%")   cell    0.01    6.13.28 
double percent divides by 10000
+SG.NUMVAL-06-whitespace        =NUMBERVALUE("  123  ") cell    123     6.13.28 
leading/trailing whitespace removed
+SG.NUMVAL-07-empty     =NUMBERVALUE("")        cell    #ERR    6.13.28 empty 
string is error
+SG.NUMVAL-08-invalid-decimal   =NUMBERVALUE("1.2.3")   cell    #ERR    6.13.28 
multiple decimal separators error
+SG.NUMVAL-09-locale-default    =NUMBERVALUE("1234,56") cell    1234.56 6.13.28 
locale default decimal comma (if locale uses comma)
+SG.NUMVAL-10-cell-ref  =NUMBERVALUE(N(D1))     cell    123     6.13.28 
reference dereference (D1=123)
+SG.FINDB-01-basic      =FINDB("b";"abc")       cell    2       FINDB basic 
find byte position
+SG.FINDB-02-start-pos  =FINDB("b";"abc";2)     cell    2       FINDB start 
position
+SG.FINDB-03-not-found  =FINDB("x";"abc")       cell    #VALUE! FINDB not found 
returns #VALUE!
+SG.FINDB-04-case-sensitive     =FINDB("B";"abc")       cell    #VALUE! FINDB 
case sensitive
+SG.FINDB-05-start-lt-1 =FINDB("a";"abc";0)     cell    #VALUE! FINDB start < 1 
error
+SG.FINDB-06-start-gt-len       =FINDB("a";"abc";10)    cell    #VALUE! FINDB 
start > length error
+SG.FINDB-07-dbcs       =FINDB("中";"中国")        cell    1       FINDB DBCS 
first char 2 bytes
+SG.FINDB-08-dbcs-second        =FINDB("国";"中国")        cell    3       FINDB 
DBCS second char at byte 3
+SG.FINDB-09-mixed      =FINDB("b";"a中b")       cell    4       FINDB mixed 
ASCII/DBCS byte count
+SG.FINDB-10-dbcs-start =FINDB("国";"中国";3)      cell    3       FINDB start at 
DBCS boundary
+SG.SEARCHB-01-basic    =SEARCHB("b";"abc")     cell    2       SEARCHB basic 
search byte position
+SG.SEARCHB-02-case-insensitive =SEARCHB("B";"abc")     cell    2       SEARCHB 
case insensitive
+SG.SEARCHB-03-wildcard =SEARCHB("a?c";"abc")   cell    1       SEARCHB 
wildcard ? single char
+SG.SEARCHB-04-wildcard-star    =SEARCHB("a*c";"abc")   cell    1       SEARCHB 
wildcard * sequence
+SG.SEARCHB-05-start-pos        =SEARCHB("b";"abc";2)   cell    2       SEARCHB 
start position
+SG.SEARCHB-06-not-found        =SEARCHB("x";"abc")     cell    #VALUE! SEARCHB 
not found
+SG.SEARCHB-07-dbcs     =SEARCHB("中";"中国")      cell    1       SEARCHB DBCS 
first char
+SG.SEARCHB-08-dbcs-second      =SEARCHB("国";"中国")      cell    3       SEARCHB 
DBCS second char
+SG.SEARCHB-09-mixed    =SEARCHB("b";"a中b")     cell    4       SEARCHB mixed 
ASCII/DBCS
+SG.SEARCHB-10-regex    =SEARCHB("a.c";"abc")   cell    1       SEARCHB regex 
dot matches any
+SG.REPLACEB-01-basic   =REPLACEB("abc";2;1;"x")        cell    axc     
REPLACEB basic replace 1 byte
+SG.REPLACEB-02-append  =REPLACEB("abc";4;0;"d")        cell    abcd    
REPLACEB append at end
+SG.REPLACEB-03-multi-byte      =REPLACEB("abcdef";2;2;"xy")    cell    axydef  
REPLACEB replace multiple bytes
+SG.REPLACEB-04-dbcs    =REPLACEB("中国";1;2;"中") cell    中国      REPLACEB DBCS 
replace first char
+SG.REPLACEB-05-start-lt-1      =REPLACEB("abc";0;1;"x")        cell    #VALUE! 
REPLACEB start < 1 error
+SG.REPLACEB-06-count-negative  =REPLACEB("abc";2;-1;"x")       cell    #VALUE! 
REPLACEB negative count error
+SG.REPLACEB-07-start-gt-len    =REPLACEB("abc";10;1;"x")       cell    abcx    
REPLACEB start > len clamps to append
+SG.REPLACEB-08-dbcs-boundary   =REPLACEB("中国";3;2;"国") cell    中国      
REPLACEB DBCS boundary replace
+SG.REPLACEB-09-replace-all     =REPLACEB("abc";1;3;"xyz")      cell    xyz     
REPLACEB replace entire string
+SG.REPLACEB-10-zero-count      =REPLACEB("abc";2;0;"x")        cell    axbc    
REPLACEB zero count inserts

Reply via email to