Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / native_client / tests / barebones / barebones_switch.c
1 /*
2  * Copyright 2010 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 /*
8  * NaCl test for super simple program not using newlib
9  */
10
11 #include "barebones.h"
12
13 /* NOTE: must not be const to prevent llvm optimizations */
14 int startval = 20;
15
16 static int switchme(int val) {
17   switch(val) {
18    case 1:
19     return val * val;
20    case 2:
21     myprint("hi");
22     return 0;
23    case 3:
24     return startval + 100;
25    case 4:
26     return 5;
27    case 5:
28     myprint("hi there");
29     return 66;
30    case 20:
31     return 55;
32    default:
33     myprint("error");
34     return 66;
35   }
36 }
37
38 int main(void) {
39   NACL_SYSCALL(exit)(switchme(startval));
40   /* UNREACHABLE */
41   return 0;
42 }