introduce TDF_compare_debug, omit OBJ_TYPE_REF casts with it
[official-gcc.git] / libgo / misc / cgo / testcshared / main0.c
blob39ef7e30513f3ab5684eac58c279d67a9d9536c6
1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 #include <stdint.h>
6 #include <stdio.h>
8 #include "p.h"
9 #include "libgo.h"
11 // Tests libgo.so to export the following functions.
12 // int8_t DidInitRun();
13 // int8_t DidMainRun();
14 // int32_t FromPkg();
15 // uint32_t Divu(uint32_t, uint32_t);
16 int main(void) {
17 int8_t ran_init = DidInitRun();
18 if (!ran_init) {
19 fprintf(stderr, "ERROR: DidInitRun returned unexpected results: %d\n",
20 ran_init);
21 return 1;
23 int8_t ran_main = DidMainRun();
24 if (ran_main) {
25 fprintf(stderr, "ERROR: DidMainRun returned unexpected results: %d\n",
26 ran_main);
27 return 1;
29 int32_t from_pkg = FromPkg();
30 if (from_pkg != 1024) {
31 fprintf(stderr, "ERROR: FromPkg=%d, want %d\n", from_pkg, 1024);
32 return 1;
34 uint32_t divu = Divu(2264, 31);
35 if (divu != 73) {
36 fprintf(stderr, "ERROR: Divu(2264, 31)=%d, want %d\n", divu, 73);
37 return 1;
39 // test.bash looks for "PASS" to ensure this program has reached the end.
40 printf("PASS\n");
41 return 0;