Ignore:
Timestamp:
Oct 5, 2023, 4:17:14 PM (9 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
4d860ea3
Parents:
b67b632
Message:

Fix read-to-variable-length-string cases when internal buffer fills.

Also fix read-to-cstring ability to give no-exception cases when an entire buffer fills.

The added test cases run, and fail, when run against prior libcfa.
Doing so illustrates a CFA-string-level bug.
Doing so illustrates a C-string-level changed semantics.

At the CFA-string level, the bug was, when reading strings of just the right length,
what should be two reads ("abc" then "def") gets mashed into one ("abcdef").
These cases are clearly bugs because a test program that just echoes chuncks of delimeted input would do so inaccurately.
They're just hard to drive because the relevant chunk lengths are implementation-dependent, and sometimes big.

At the C-string level, the semantic change concerns when to throw the cstring_length exception.
By this change, make the original semantics,
"An exception means the maximum number of characters was read," into
"An exception means that if the buffer were larger, then more characters would have been read."

The added test cases cover the respective stop conditions for manipulator state "%s", include, exclude, getline, and getline/delimiter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/io/.expect/manipulatorsInput.x86.txt

    rb67b632 r0860d9c  
    11pre1 "123456", canary ok
    2 pre2a "1234567", exception occurred, canary ok
    3 pre2b "89", canary ok
     2pre2 "1234567", canary ok
     3pre3a "1234567", exception occurred, canary ok
     4pre3b "8", canary ok
     5pre4a "1234567", exception occurred, canary ok
     6pre4b "89", canary ok
    471 yyyyyyyyyyyyyyyyyyyy
    582 abcxxx
Note: See TracChangeset for help on using the changeset viewer.