source: trunk/kLdr/testcase/tst-3.c@ 3232

Last change on this file since 3232 was 2967, checked in by bird, 19 years ago

More testcase fun.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1/* $Id: tst-3.c 2967 2007-02-13 22:28:46Z bird $ */
2/** @file
3 *
4 * kLdr - Dynamic Loader testcase no. 3, Driver.
5 *
6 * Copyright (c) 2006 knut st. osmundsen <bird-kbuild-src@anduin.net>
7 *
8 *
9 * This file is part of kLdr.
10 *
11 * kLdr is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * kLdr 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
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with kLdr; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27
28#include "tst.h"
29
30
31int g_i1 = 1;
32int g_i2 = 2;
33int *g_pi1 = &g_i1;
34
35extern int Tst3Sub(int);
36int (*g_pfnTst3Sub)(int) = &Tst3Sub;
37
38MY_IMPORT(int) Tst3Ext(int);
39int (*g_pfnTst3Ext)(int) = &Tst3Ext;
40
41char g_achBss[256];
42
43
44MY_EXPORT(int) Tst3(int iFortyTwo)
45{
46 int rc;
47
48 if (iFortyTwo != 42)
49 return 0;
50 if (g_i1 != 1)
51 return 1;
52 if (g_i2 != 2)
53 return 2;
54 if (g_pi1 != &g_i1)
55 return 3;
56 if (g_pfnTst3Sub != &Tst3Sub)
57 return 4;
58 rc = Tst3Sub(iFortyTwo);
59 if (rc != g_pfnTst3Sub(iFortyTwo))
60 return 5;
61 rc = Tst3Ext(iFortyTwo);
62 if (rc != 42)
63 return 6;
64 rc = g_pfnTst3Ext(iFortyTwo);
65 if (rc != 42)
66 return 7;
67 for (rc = 0; rc < sizeof(g_achBss); rc++)
68 if (g_achBss[rc])
69 return 8;
70 if (g_achBss[0] || g_achBss[1] || g_achBss[255])
71 return 9;
72
73 return 42;
74}
75
Note: See TracBrowser for help on using the repository browser.