tools/genmodule: Added .unusedlibbase option
[AROS.git] / test / library / peropenertest.c
blobb8827ee32a7e059db2b738c09064d55e32d4d5e8
1 /*
2 Copyright © 2008-2009, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <proto/dos.h>
8 #include <proto/peropener.h>
9 #include <proto/pertask.h>
11 struct Library *PeropenerBase = NULL;
13 int main (int argc, char ** argv)
15 struct Library *base1, *base2;
16 BPTR seglist;
18 FPuts(Output(), (STRPTR)"Testing peropener.library\n");
20 base1=OpenLibrary((STRPTR)"peropener.library",0);
21 base2=OpenLibrary((STRPTR)"peropener.library",0);
23 /* Set value for base1 */
24 PeropenerBase = base1;
25 PeropenerSetValue(1);
27 /* Check .unusedlibbase option with base1 */
28 if (PeropenerNoLib() != 1)
29 Printf("Error calling PeropenerNoLib()\n");
31 /* Set value for base2 */
32 PeropenerBase = base2;
33 PeropenerSetValue(2);
35 /* Check value for base2 */
36 Printf((STRPTR)"Checking value for base2: 2 == %ld %s\n",
37 PeropenerGetValue(), (PeropenerGetValue() == 2) ? "OK" : "FAIL!"
40 /* Check value for base2 */
41 PeropenerBase = base1;
42 PeropenerGetValue();
43 Printf((STRPTR)"Checking value for base1: 1 == %ld %s\n",
44 PeropenerGetValue(), (PeropenerGetValue() == 1) ? "OK" : "FAIL!"
47 FPrintf(Output(), (STRPTR)"base1=%lx, base2=%lx\n", base1, base2);
49 if (base1 != NULL)
50 CloseLibrary(base1);
51 if (base2 != NULL)
52 CloseLibrary(base2);
54 FPuts(Output(), (STRPTR)"\nTesting pertask.library\n");
56 base1=OpenLibrary((STRPTR)"pertask.library",0);
57 base2=OpenLibrary((STRPTR)"pertask.library",0);
59 FPrintf(Output(), (STRPTR)"base1=%lx, base2=%lx\n", base1, base2);
61 seglist = LoadSeg((CONST_STRPTR)"peropenertest_child");
62 if (seglist != (BPTR)NULL)
64 SetProgramName("peropenertest_child");
65 RunCommand(seglist, 10*1024, "\n", 1);
66 UnLoadSeg(seglist);
68 else
70 FPrintf(Output(), (STRPTR)"Failed to load peropenertest_child\n");
73 if (base1 != NULL)
74 CloseLibrary(base1);
75 if (base2 != NULL)
76 CloseLibrary(base2);
78 Flush (Output ());
80 return 0;