| [2965] | 1 | /* $Id: tst-3.c 3601 2007-10-29 00:21:13Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | * kLdr - Dynamic Loader testcase no. 3, Driver.
|
|---|
| [3601] | 4 | */
|
|---|
| 5 |
|
|---|
| 6 | /*
|
|---|
| 7 | * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
|
|---|
| [2965] | 8 | *
|
|---|
| [3601] | 9 | * This file is part of kStuff.
|
|---|
| [2965] | 10 | *
|
|---|
| [3601] | 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.
|
|---|
| [2965] | 15 | *
|
|---|
| [3601] | 16 | * kStuff is distributed in the hope that it will be useful,
|
|---|
| [2965] | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| [3601] | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 19 | * Lesser General Public License for more details.
|
|---|
| [2965] | 20 | *
|
|---|
| [3601] | 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
|
|---|
| [2965] | 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 |
|
|---|
| [2967] | 34 | extern int Tst3Sub(int);
|
|---|
| [2965] | 35 | int (*g_pfnTst3Sub)(int) = &Tst3Sub;
|
|---|
| 36 |
|
|---|
| [2967] | 37 | MY_IMPORT(int) Tst3Ext(int);
|
|---|
| 38 | int (*g_pfnTst3Ext)(int) = &Tst3Ext;
|
|---|
| 39 |
|
|---|
| [2965] | 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;
|
|---|
| [2967] | 60 | rc = Tst3Ext(iFortyTwo);
|
|---|
| 61 | if (rc != 42)
|
|---|
| 62 | return 6;
|
|---|
| 63 | rc = g_pfnTst3Ext(iFortyTwo);
|
|---|
| 64 | if (rc != 42)
|
|---|
| 65 | return 7;
|
|---|
| [2965] | 66 | for (rc = 0; rc < sizeof(g_achBss); rc++)
|
|---|
| 67 | if (g_achBss[rc])
|
|---|
| [2967] | 68 | return 8;
|
|---|
| [2965] | 69 | if (g_achBss[0] || g_achBss[1] || g_achBss[255])
|
|---|
| [2967] | 70 | return 9;
|
|---|
| [2965] | 71 |
|
|---|
| 72 | return 42;
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|