Changeset 1e28e05


Ignore:
Timestamp:
May 18, 2025, 11:24:01 AM (4 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
e25b30b
Parents:
0528d79
Message:

update enumerator input test

Location:
tests/enum_tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tests/enum_tests/.expect/input.txt

    r0528d79 r1e28e05  
    1 BBB = 3
    2 AB = 6
    3 AAA = 4
    4 AB = 6
    5 BBB = 3
    6 AAA = 4
    7 AB = 6
    8 AA = 5
    9 B = 7
    10 BBB = 3
    11 AAA = 4
    12 AA = 5
    13 AB = 6
    14 B = 7
    15 BBB = 3
    16 AAA = 4
    17 AA = 5
    18 AB = 6
    19 B = 7
    20 AAA = 4
    21 B = 7
    22 CB = 8
    23 AC = 9
    24 CB = 8
    25 AC = 9
    26 BBB = 3
    27 AAA = 4
    28 AA = 5
    29 missing data
    30 AAA = 4
    31 B = 7
    32 CB = 8
    33 AC = 9
    34 CB = 8
    35 AC = 9
    36 BBB = 3
    37 AAA = 4
    38 AA = 5
    39 missing data
     1BBB AAA AA AB B BBB AAA AAA missing data
     2BBB AAA AAA AB B
     3
     4BBB AAA AA AB B BBB AAA AAA missing data
     5BBB AAA AAA AB B
     6
     7A B BB AB BA AA AAA ABA AAB BBB BBA BAB
     8BAB BBA BBB AAB ABA AAA AA BA AB BB B A
     9BAB BBA BB AAB ABA AA AAA BA AB B A BBB
     10
     11A B BB AB BA AA AAA ABA AAB BBB BBA BAB
     12BAB BBA BBB AAB ABA AAA AA BA AB BB B A
     13BAB BBA BB AAB ABA AA AAA BA AB B A BBB
     14
     15BBB = 3 AB = 6 AAA = 4 AB = 6 BBB = 3 AAA = 4 AB = 6 AA = 5 B = 7 BBB = 3 AAA = 4 AA = 5 AB = 6 B = 7 BBB = 3 AAA = 4 AA = 5 AB = 6 B = 7 AAA = 4 B = 7 CB = 8 AC = 9 CB = 8 AC = 9 BBB = 3 AAA = 4 AA = 5 missing data
     16AAA = 4 B = 7 CB = 8 AC = 9 CB = 8 AC = 9 BBB = 3 AAA = 4 AA = 5 missing data
  • tests/enum_tests/.in/input.txt

    r0528d79 r1e28e05  
     1BBB AAA AA AB B
     2BBBAAAAAABB
     3BBBAAAAAAABB
     4
     5BBB AAA AA AB B
     6BBBAAAAAABB
     7BBBAAAAAAABB
     8
     9A B BB AB BA AA AAA ABA AAB BBB BBA BAB
     10BAB BBA BBB AAB ABA AAA AA BA AB BB B A
     11BAB BBA BB AAB ABA AA AAA BA AB B A BBB
     12
     13A B BB AB BA AA AAA ABA AAB BBB BBA BAB
     14BAB BBA BBB AAB ABA AAA AA BA AB BB B A
     15BAB BBA BB AAB ABA AA AAA BA AB B A BBB
     16
    117BBBABAAAAB
    218BBBAAAABAAB
  • tests/enum_tests/input.cfa

    r0528d79 r1e28e05  
    22
    33int main() {
    4         enum(int) E { BBB = 3, AAA, AA, AB, B, CB, AC };
    5         E e;
     4        { // enumerators small to large
     5                enum(int) E { B, AB, AA, AAA, BBB };
     6                E e;
    67
    7         try {
    8                 for () {
    9                         try {
    10                                 sin | e;
    11                         } catch( missing_data * ) {
    12                                 sout | "missing data";
    13                                 continue;                                                               // try again
    14                         } // try
    15                         sout | e | "= " | value( e );
    16                 } // for
    17         } catch( end_of_file * ) {
    18         } // try
     8                try {
     9                        for ( 14 ) {                                                            // eums in input
     10                                try {
     11                                        sin | e;
     12                                } catch( missing_data * ) {
     13                                        sout | "missing data";
     14                                        continue;                                                       // try again
     15                                } // try
     16                                sout | e | nonl;
     17                        } // for
     18                } catch( end_of_file * ) {
     19                        abort( "enum test failure" );
     20                } // try
     21                sout | nl;
     22        }
     23        sout | nl;
     24        { // enumerators large to small
     25                enum(int) E { BBB, AAA, AA, AB, B };
     26                E e;
     27
     28                try {
     29                        for ( 14 ) {                                                            // eums in input
     30                                try {
     31                                        sin | e;
     32                                } catch( missing_data * ) {
     33                                        sout | "missing data";
     34                                        continue;                                                       // try again
     35                                } // try
     36                                sout | e | nonl;
     37                        } // for
     38                } catch( end_of_file * ) {
     39                        abort( "enum test failure" );
     40                } // try
     41                sout | nl | nl;
     42        }
     43        { // enumerators small to large, overlapping patterns
     44                enum(int) E { A, B, BB, AB, BA, AA, AAA, ABA, AAB, BBB, BBA, BAB };
     45                E e;
     46
     47                try {
     48                        for ( 3 ) {                                                                     // N rows
     49                                for ( countof( E ) ) {                                  // eums in input
     50                                        try {
     51                                                sin | e;
     52                                        } catch( missing_data * ) {
     53                                                sout | "missing data";
     54                                                continue;                                               // try again
     55                                        } // try
     56                                        sout | e | nonl;
     57                                } // for
     58                                sout | nl;
     59                        } // for
     60                } catch( end_of_file * ) {
     61                        abort( "enum test failure" );
     62                } // try
     63                sout | nl;
     64        }
     65        { // enumerators large to small, overlapping patterns
     66                enum(int) E { BAB, BBA, BBB, AAB, ABA, AAA, AA, BA, AB, BB, B, A };
     67                E e;
     68
     69                try {
     70                        for ( 3 ) {                                                                     // N rows
     71                                for ( countof( E ) ) {                                  // eums in input
     72                                        try {
     73                                                sin | e;
     74                                        } catch( missing_data * ) {
     75                                                sout | "missing data";
     76                                                continue;                                               // try again
     77                                        } // try
     78                                        sout | e | nonl;
     79                                } // for
     80                                sout | nl;
     81                        } // for
     82                } catch( end_of_file * ) {
     83                        abort( "enum test failure" );
     84                } // try
     85                sout | nl;
     86        }
     87        { // general, end of file
     88                enum(int) E { BBB = 3, AAA, AA, AB, B, CB, AC };
     89                E e;
     90
     91                try {
     92                        for () {
     93                                try {
     94                                        sin | e;
     95                                } catch( missing_data * ) {
     96                                        sout | "missing data";
     97                                        continue;                                                       // try again
     98                                } // try
     99                                sout | e | "= " | value( e ) | nonl;
     100                        } // for
     101                } catch( end_of_file * ) {
     102                } // try
     103        }
    19104} // main
Note: See TracChangeset for help on using the changeset viewer.