Changeset 69867ad9 for tests/enum_tests


Ignore:
Timestamp:
Apr 30, 2024, 12:08:46 PM (21 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
35897fb
Parents:
caaf424 (diff), 0153dbd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
tests/enum_tests
Files:
2 added
6 edited

Legend:

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

    rcaaf424 r69867ad9  
    11zero: zero, one: one
     2zero: 0, one: 1
  • tests/enum_tests/anonymous.cfa

    rcaaf424 r69867ad9  
    1 #include <stdio.h>
     1#include <fstream.hfa>
    22enum(unsigned long int ) { nthreads = 17 };
    33
    44int main() {
    5     printf("%lu", nthreads);
     5    sout | nthreads;
    66}
    77
  • tests/enum_tests/enumInlineValue.cfa

    rcaaf424 r69867ad9  
    1212    enum enumB val = A;
    1313    sout | "enumB.A is" | val;
    14     enum enumB val2= enumB.B;
     14    enum enumB val2 = enumB.B;
    1515    sout | "enumB.B is" | val2;
    1616    sout | "enumB.D is" | enumB.D;
  • tests/enum_tests/position.cfa

    rcaaf424 r69867ad9  
    1212
    1313int main () {
    14     Colour fishy; // posE()
    15     fishy = Colour.Green; // value(fishy) = Colour.Green;
    16     fishy; // valueE( fishy );
     14    Colour fishy;
     15    fishy = Colour.Green;
     16    fishy;
     17    Colour c2 = fishy;
    1718
    18     printf( "Compile Time: blue value: %s, position: %d, label: %s, default return value: %s \n", valueE(Colour.Blue), posE(Colour.Blue), labelE(Colour.Blue), Colour.Blue );
    19     printf( "Runtime: fishy value: %s, position: %d, label: %s, default return value: %s\n", valueE(fishy), posE(fishy), labelE(fishy), fishy );
    20     Colour c2 = fishy;
    21     printf( "Runtime: C2 value: %s, position: %d, label: %s, default return value: %s\n", valueE(c2), posE(c2), labelE(c2), c2 );
     19    sout | "Compile Time: blue value: " | valueE(Colour.Blue) | ", position: " | posE(Colour.Blue) | ", label: " | labelE(Colour.Blue) | ", default return value: " | Colour.Blue;
     20    sout | "Runtime: fishy value: " | valueE(fishy) | ", position: " | posE(fishy) | ", label: " | labelE(fishy) | ", default return value: " | fishy;
     21    sout | "Runtime: C2 value: " | valueE(c2) | ", position: " | posE(c2) | ", label: " | labelE(c2) | ", default return value: " | c2;
    2222    Colour.Red;
    2323    char * ao = Colour.Red;
     
    2929    Plain a = B;
    3030    printf( "%d \n", a );
     31   
    3132}
  • tests/enum_tests/stringEnum.cfa

    rcaaf424 r69867ad9  
     1#include <fstream.hfa>
    12#include <stdio.h>
    23
     
    78
    89int main() {
    9     printf("zero: %s, one: %s\n", zero, one);
     10    sout | "zero: "| zero | ", one: " | one;
     11    printf("zero: %d, one: %d\n", zero, one);
    1012    return 0;
    1113}
  • tests/enum_tests/typedIntEnum.cfa

    rcaaf424 r69867ad9  
    1 #include <stdio.h>
     1#include <fstream.hfa>
    22
    33enum(int) IntEnum {
     
    1212
    1313int main() {
    14     printf("0=%d\n", zero);
    15     printf("1=%d\n", one);
    16     printf("1000=%d\n", thousand);
    17     printf("1001=%d\n", thousand_one);
    18     printf("2000=%d\n", two_thousand);
    19     printf("2001=%d\n", two_thousand_one);
    20     printf("2002=%d\n", two_thousand_two);
     14    sout | "0=" | zero;
     15    sout | "1=" | one;
     16    sout | "1000=" | thousand;
     17    sout | "1001=" | thousand_one;
     18    sout | "2000=" | two_thousand;
     19    sout | "2001=" | two_thousand_one;
     20    sout | "2002=" | two_thousand_two;
    2121    return 0;
    2222}
Note: See TracChangeset for help on using the changeset viewer.