Changeset 236f133 for tests


Ignore:
Timestamp:
Jul 11, 2024, 3:04:34 PM (5 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
9c447e2
Parents:
9d5eacb
Message:

Remove quasi_void for enums. The idea of quasi_void from Mike was to get around some resolution problem that enum pick function defines for Bounded over CfaEnum/TypedEnum?. But it is not clear that how often this can happen, and cfa might change the cast function scheme in the future. (change cost comparison scheme) Deprecate quasi_void for now so that enum traits looks cleaner without the dummy type for opaque enums

Location:
tests/enum_tests
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • tests/enum_tests/voidEnum.cfa

    r9d5eacb r236f133  
    11#include <fstream.hfa>
    22#include <enum.hfa>
    3 enum() voidEnum {
    4     a, b, c
    5     /***
    6     * ,d = 10 // Disable;
    7     * //error: Enumerator of enum(void) cannot have an explicit initial value.
    8     */
    9 };
    103
    11 char* a[voidEnum] = {
    12     "A",
    13     "B",
    14     "C"
    15 };
    16 
     4enum() E { A, B, C };
    175int main() {
    18     enum voidEnum v_1 = a;
    19     enum voidEnum v_2 = b;
    20     sout | "Two different Opague Enum Should not be the same:";
    21     if ( v_1 == v_2 ) {
    22         sout | "a and b are Equal" | nl;
    23     } else {
    24         sout | "a and b are Not Equal" | nl;
    25     }
    26     sout | "Default Output:";
    27     sout | a;
    28     sout | b;
    29    
    30     sout | label(v_1);
    31     sout | label(v_2);
     6    E e = A;
     7    sout | e | posn( e ) | label( e );
    328}
Note: See TracChangeset for help on using the changeset viewer.