Changeset 1abcec9b for tests/collections


Ignore:
Timestamp:
Apr 13, 2026, 3:05:44 AM (2 weeks ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
5b21636b
Parents:
2581f1e
Message:

Add overlaid means to list perf histograms. Add 2nd-order graph to the paper and its discussion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/collections/string-overwrite.cfa

    r2581f1e r1abcec9b  
    7373*/
    7474
     75const char * OUT_DELIM = "------------------------------------------------------------------------";
    7576
    7677void showOneReplacement(string & s, int ms, int ml, int ws, int wl, const char* replaceWith) {
     
    232233    };
    233234    for ( i; sizeof(cases)/sizeof(cases[0]) ) {
    234         sout | "------------------------------------------------------------------------" | cases[i].label;
     235        sout | OUT_DELIM | cases[i].label;
    235236        string replaceIn = alphabetTemplate;
    236237        showOneReplacement( replaceIn, cases[i].ms, cases[i].ml, cases[i].ws, cases[i].wl, cases[i].replaceWith );
     
    246247
    247248
     249    runReplaceCases();
     250
     251
     252    // in `s(i, k) = sr`:
     253    // - whlln, whole-string length = len(s)
     254    // - sctln, selection length = k
     255    // - rplln, replacement length = len(sr)
     256
     257    // Extra cases via syntax that appears more direct.
     258    // Indirect, as drives the table:
     259    //    string replace = src(strt, len)`share;
     260    //    replace = "xyz";
     261    // Direct, following:
     262    //    src(strt, len) = "xyz";
     263    sout | OUT_DELIM | "syn-direct";
     264
    248265    //          0         1         2
    249266    //          01234567890123456789012345
     
    251268
    252269    s(5,5) = "qqqqq";  // start=5, end=10, len=5
    253 
    254270    sout | s;
    255271
    256 
    257272    s(5,0) = "-----";  // start=5, end=5, len=0
    258 
    259273    sout | s;
    260274
    261     runReplaceCases();
     275
     276    // Extra cases for at-/out-of-bound access
     277    // Every selection starts and ends at a position between characters, inclusive of before-first and after-last
     278    // Intended behaviour is
     279    // - negative start means "back from whlln;" i.e., -1 is before-last
     280    // - negative sctln menas "back from start;" i.e., -1 from middle selects 1 character before start
     281    // - squish inward at subject string's first/last character
     282    //   - start > whlln means same as start == whlln: after last character, with sctln >= 0 selecting zero characters
     283    //   - start < -whlln means same as start == -whlln: before first character, with sctln <= 0 selecting zero characters
     284    //   - (let xstart be the position in [0,whlln] equivalent to start, by the above, in the following...)
     285    //   - xstart + sctln > whlln means same as sctln = whlln - xstart  (significant when sctln is positive)
     286    //   - xstart + sctln < 0 means same as sctln = -xstart  (significant when sctln is negative)
     287    // - start = 0 means
     288    //   - before first, when sctln is zero or positive
     289    //   - after last, when sctln is negative
     290    // - start "outside the string" cases are:
     291    //   - start = 0 can select forward from first or backward from last (as just stated); note the asymmetric "sctln = 0" handling
     292    //   - (so, the following cases are available to specify front-v-back explicitly...)
     293    //   - start >= whlln can select only backward from last, i.e. selects final epsilon when sctln >= 0
     294    //   - start <= -whln can select only forward from first, i.e. selects initial epsilon when sctln <= 0
     295    // most selections have two equivalent representations
     296    sout | OUT_DELIM | "boundary";
     297/*
     298The test
     299
     300base = 01234
     301
     302
     303(Start|Step) is (just over|right on|just under) the (min|mid|max) value
     304|
     305whlln (>|=|<) rplln
     306|
     3070 (=|<) (whlln|rplln)
     308
     309Every case needs concrete & independent
     310whlln
     311rpln
     312start
     313step, aka sctln
     314
     315Constraint space is
     316sel[Start]
     317*
     318sel[Step]
     319*
     320lens1
     321*
     322lens2
     323,
     324excluding when the lens pair contradicts
     325=
     326972 concrete test cases (all combinations)
     327
     328Toward all pairs
     329Each case achieves up to 6 further pairings.
     330Best-case, achieved with 81 cases.  (162 permutations / 2 orderings of a pair)
     331
     332
     333
     334Start
     335just over the min value
     336just over the mid value
     337just over the max value
     338just over the min value
     339just over the mid value
     340just over the max value
     341just over the min value
     342just over the mid value
     343just over the max value
     344
     345
     346*/
     347
     348
     349    // Extra cases for modifying substring of substring.
     350    sout | OUT_DELIM | "compound";
     351
     352    s = "abcdefghijklmnopqrstuvwxyz";
     353    string sx = s(5,5)`share;
     354
    262355}
Note: See TracChangeset for help on using the changeset viewer.