aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_llvmswitch.in
blob: b3f871e4196e5ff4080a73c355bb18e8d6f228a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <string.h>

int switcher(int p) {
  switch (p) {
    case 'a':
    case 'b':
    case 'c':
      return p - 1;
    case -15:
      return p + 1;
  }
  return p;
}

int main(int argc, const char *argv[]) {
  unsigned int x = 0xfffffff1;
  x >>= (argc - 1);  // force it to be unsigned for purpose of checking our
                     // switch comparison in signed/unsigned
  printf("*%d,%d,%d,%d,%d,%d*\n", switcher('a'), switcher('b'), switcher('c'),
         switcher(x), switcher(-15), switcher('e'));
  return 0;
}