source: tests/enum_tests/position.cfa @ 33807a1e

Last change on this file since 33807a1e was c17dc80, checked in by JiadaL <j82liang@…>, 10 months ago

Add position.cfa test file

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#include <fstream.hfa>
2#include <stdlib.hfa>
3#include <stdio.h>
4
5enum(char *) Colour {
6    Red = "red", Green = "green", Blue = "blue"
7};
8
9// enum( signed char ) srgb { Red = -1, Green = 0, Blue = 1 };
10
11enum Plain { A, B, C = 10 };
12
13int main () {
14    Colour fishy; // posE()
15    fishy = Colour.Green; // value(fishy) = Colour.Green;
16    fishy; // valueE( fishy );
17
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 );
22    Colour.Red;
23    char * ao = Colour.Red;
24    char * ko = fishy;
25    printf( "ao is %s\n", ao );
26    printf( "ko is %s\n", ko );
27
28    printf( "%d, %d, %d, \n", A, B, C );
29    Plain a = B;
30    printf( "%d \n", a );
31}
Note: See TracBrowser for help on using the repository browser.