Changeset 570e7ad for tests/collections


Ignore:
Timestamp:
Apr 11, 2025, 12:29:56 AM (8 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
d03a386
Parents:
3f631d6
Message:

Make string operator-overload costs match their intuitively equivalent arithmetics.

Replace many by-reference string args with by-value args to work around noise from the reference-cost column.

Use a special arithmetic type for the factor argument of ?*? to match conversion cost of (char*int=int).

Removes cost-function noise of char-arithmetic operators being preferred over their string-concatenation equivalents in the reference-cost column.

Notably, all former Spanish-A and numeric outputs have become ambiguous or been associated with a reproducible bug.

Location:
tests/collections
Files:
12 added
2 edited

Legend:

Unmodified
Added
Removed
  • tests/collections/.expect/string-operator.txt

    r3f631d6 r570e7ad  
    33
    44------------- Initialization
    5 Ã
     5(skip)
    66ab
    77ab
    88ab
    99
    10 Ãx
     10(skip)
    1111abx
    1212abx
     
    2323axb
    2424
    25 aaa
     25(skip)
    2626bbb
    27 ÃÃÃ
     27585
    2828cdcdcd
    2929
    30 291
     30(skip)
    3131bbb
    32 ababab
     32585
    3333cdcdcd
    3434
    3535------------- Assignment
    36 Ã
     36(skip)
    3737ab
    3838ab
    3939ab
    4040
    41 Ã
    42 abÃ
    43 ababÃ
    44 abababÃ
     41(skip)
     42ab
     43abab
     44ababab
    4545
    4646ab
     
    5454aaaabbbb
    5555
    56 aaa
     56(skip)
    5757bbb
    58 ÃÃÃ
     58585
    5959cdcdcd
    6060
    61 291
     61(skip)
    6262bbb
    63 ababab
     63585
    6464cdcdcd
    6565
     
    7070ab
    7171
    72 Ãx
     72(skip)
    7373abx
    7474abx
     
    8585axb
    8686
    87 291
     87(skip)
    8888bbb
    8989585
    9090cdcdcd
    9191
    92 291
     92(skip)
    9393bbb
    9494585
     
    9797------------- Miscellany
    9898(skip)
    99 291
     99(skip)
    1001000x2a 0x2d
  • tests/collections/string-operator.cfa

    r3f631d6 r570e7ad  
    99
    1010// These MR points do reject in the current revision, so they have satellite "-ERR" cases:
     11// MR01
     12// MR02
     13// MR03
     14// MR04
     15// MR05
     16// MR06
     17// MR07
     18// MR08
    1119// MR09
     20// MR10
     21// MR11
     22// MR13
    1223// MR15
     24// MR16
    1325
    1426// These MR points do not reject in the current revision, so they join the "happy run":
    15 #define TRY_MR01
    16 #define TRY_MR02
    17 #define TRY_MR03
    18 #define TRY_MR04
    19 #define TRY_MR05
    20 #define TRY_MR06
    21 #define TRY_MR07
    22 #define TRY_MR08
    23 #define TRY_MR10
    24 #define TRY_MR11
    2527#define TRY_MR12
    26 #define TRY_MR13
    2728#define TRY_MR14
    28 #define TRY_MR16
    2929
    3030
     
    137137
    138138        sout | "------------- Initialization";
    139 MR01(  {string s = 'a' + 'b';           // Ãb
     139MR01(  {string s = 'a' + 'b';           // (ambiguous)
    140140        sout | s;}              )
    141141       {string s = 'a' + "b";           // ab
     
    149149        string s0 = "x";
    150150
    151 MR02(  {string s = 'a' + 'b' + s0;      // Ãx
     151MR02(  {string s = 'a' + 'b' + s0;      // (ambiguous)
    152152        sout | s;}              )
    153153       {string s = 'a' + "b" + s0;      // abx
     
    179179        sout | nl;                      //
    180180
    181 MR03(  {string s = 'a' * 3;             // aaa
     181MR03(  {string s = 'a' * 3;             // (ambiguous)
    182182        sout | s;}              )
    183183       {string s = "b" * 3;             // bbb
    184184        sout | s;}
    185        {string s = ('a' + 'b') * 3;     // ÃÃÃ
     185       {string s = ('a' + 'b') * 3;     // ÃÃà(expecting ambiguous, likely from #309)
    186186        sout | s;}
    187187       {string s = ('c' + "d") * 3;     // cdcdcd
     
    189189        sout | nl;                      //
    190190
    191 MR04(  {string s = 3 * 'a';             // 291
     191MR04(  {string s = 3 * 'a';             // (ambiguous)
    192192        sout | s;}              )
    193193       {string s = 3 * "b";             // bbb
     
    205205
    206206        s = "";
    207 MR05(   s = 'a' + 'b';          // Ã
     207MR05(   s = 'a' + 'b';          // (ambiguous)
    208208        sout | s;              )
    209209        s = 'a' + "b";          // ab
     
    216216
    217217        s = "";
    218 MR06(   s = 'a' + 'b' + s;      // Ã
     218MR06(   s = 'a' + 'b' + s;      // (ambiguous)
    219219        sout | s;              )
    220         s = 'a' + "b" + s;      // abÃ
    221         sout | s;
    222         s = "a" + 'b' + s;      // ababÃ
    223         sout | s;
    224         s = "a" + "b" + s;      // abababÃ
     220        s = 'a' + "b" + s;      // ab
     221        sout | s;
     222        s = "a" + 'b' + s;      // abab
     223        sout | s;
     224        s = "a" + "b" + s;      // ababab
    225225        sout | s;
    226226        sout | nl;              //
     
    249249
    250250        s = "";
    251 MR07(   s = 'a' * 3;            // aaa
     251MR07(   s = 'a' * 3;            // (ambiguous)
    252252        sout | s;              )
    253253        s = "b" * 3;            // bbb
    254254        sout | s;
    255         s = ('a' + 'b') * 3;    // ÃÃÃ
     255        s = ('a' + 'b') * 3;    // ÃÃà(expecting ambiguous, likely from #309)
    256256        sout | s;
    257257        s = ('c' + "d") * 3;    // cdcdcd
     
    260260
    261261        s = "";
    262 MR08(   s = 3 * 'a';            // 291
     262MR08(   s = 3 * 'a';            // (ambiguous)
    263263        sout | s;              )
    264264        s = 3 * "b";            // bbb
     
    281281        sout | nl;                  //
    282282
    283 MR10(   sout | 'a' + 'b' + s;  )    // Ãx
     283MR10(   sout | 'a' + 'b' + s;  )    // (ambiguous)
    284284        sout | 'a' + "b" + s;       // abx
    285285        sout | "a" + 'b' + s;       // abx
     
    299299        sout | nl;                  //
    300300
    301 MR11(   sout | 'a' * 3;          )  // 291
     301MR11(   sout | 'a' * 3;          )  // (ambiguous)
    302302        sout | "b" * 3;             // bbb
    303 MR12(   sout | ('a' + 'b') * 3;  )  // 585
     303MR12(   sout | ('a' + 'b') * 3;  )  // 585 (expecting ambiguous, likely from #309)
    304304        sout | ('c' + "d") * 3;     // cdcdcd
    305305        sout | nl;                  //
    306306
    307 MR13(   sout | 3 * 'a';          )  // 291
     307MR13(   sout | 3 * 'a';          )  // (ambiguous)
    308308        sout | 3 * "b";             // bbb
    309 MR14(   sout | 3 * ('a' + 'b');  )  // 585
     309MR14(   sout | 3 * ('a' + 'b');  )  // 585 (expecting ambiguous, likely from #309)
    310310        sout | 3 * ('c' + "d");     // cdcdcd
    311311        sout | nl;                  //
     
    316316
    317317MR15(   printf( "%c\n", 'a' + 'b'); )    // (ambiguous)
    318 MR16(   printf( "%d\n", 'a' * 3 );  )    // 291
     318MR16(   printf( "%d\n", 'a' * 3 );  )    // (ambiguous)
    319319
    320320        {   // (picks arithmetic; there is no interpretation of `_ + 3` that's string)
Note: See TracChangeset for help on using the changeset viewer.