1 | /* $Id: tst-3.c 2 2007-11-16 16:07:14Z bird $ */
|
---|
2 | /** @file
|
---|
3 | * kLdr - Dynamic Loader testcase no. 3, Driver.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (c) 2006-2007 knut st. osmundsen <[email protected]>
|
---|
8 | *
|
---|
9 | * This file is part of kStuff.
|
---|
10 | *
|
---|
11 | * kStuff is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU Lesser General Public
|
---|
13 | * License as published by the Free Software Foundation; either
|
---|
14 | * version 2.1 of the License, or (at your option) any later version.
|
---|
15 | *
|
---|
16 | * kStuff is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * Lesser General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU Lesser General Public
|
---|
22 | * License along with kStuff; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
24 | *
|
---|
25 | */
|
---|
26 |
|
---|
27 | #include "tst.h"
|
---|
28 |
|
---|
29 |
|
---|
30 | int g_i1 = 1;
|
---|
31 | int g_i2 = 2;
|
---|
32 | int *g_pi1 = &g_i1;
|
---|
33 |
|
---|
34 | extern int Tst3Sub(int);
|
---|
35 | int (*g_pfnTst3Sub)(int) = &Tst3Sub;
|
---|
36 |
|
---|
37 | MY_IMPORT(int) Tst3Ext(int);
|
---|
38 | int (*g_pfnTst3Ext)(int) = &Tst3Ext;
|
---|
39 |
|
---|
40 | char g_achBss[256];
|
---|
41 |
|
---|
42 |
|
---|
43 | MY_EXPORT(int) Tst3(int iFortyTwo)
|
---|
44 | {
|
---|
45 | int rc;
|
---|
46 |
|
---|
47 | if (iFortyTwo != 42)
|
---|
48 | return 0;
|
---|
49 | if (g_i1 != 1)
|
---|
50 | return 1;
|
---|
51 | if (g_i2 != 2)
|
---|
52 | return 2;
|
---|
53 | if (g_pi1 != &g_i1)
|
---|
54 | return 3;
|
---|
55 | if (g_pfnTst3Sub != &Tst3Sub)
|
---|
56 | return 4;
|
---|
57 | rc = Tst3Sub(iFortyTwo);
|
---|
58 | if (rc != g_pfnTst3Sub(iFortyTwo))
|
---|
59 | return 5;
|
---|
60 | rc = Tst3Ext(iFortyTwo);
|
---|
61 | if (rc != 42)
|
---|
62 | return 6;
|
---|
63 | rc = g_pfnTst3Ext(iFortyTwo);
|
---|
64 | if (rc != 42)
|
---|
65 | return 7;
|
---|
66 | for (rc = 0; rc < sizeof(g_achBss); rc++)
|
---|
67 | if (g_achBss[rc])
|
---|
68 | return 8;
|
---|
69 | if (g_achBss[0] || g_achBss[1] || g_achBss[255])
|
---|
70 | return 9;
|
---|
71 |
|
---|
72 | return 42;
|
---|
73 | }
|
---|
74 |
|
---|