append modtype to generated makefiles
[AROS.git] / test / library / peropenertest.c
blobbb3477ff8010a467a5cd4a2145a0ea89de287290
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 .function option with base2 */
36 if (PeropenerNameChange() != 1)
37 Printf("Error calling PeropenerNameChange()\n");
39 /* Check value for base2 */
40 Printf((STRPTR)"Checking value for base2: 2 == %ld %s\n",
41 PeropenerGetValue(), (PeropenerGetValue() == 2) ? "OK" : "FAIL!"
44 /* Check value for base2 */
45 PeropenerBase = base1;
46 PeropenerGetValue();
47 Printf((STRPTR)"Checking value for base1: 1 == %ld %s\n",
48 PeropenerGetValue(), (PeropenerGetValue() == 1) ? "OK" : "FAIL!"
51 FPrintf(Output(), (STRPTR)"base1=%lx, base2=%lx\n", base1, base2);
53 if (base1 != NULL)
54 CloseLibrary(base1);
55 if (base2 != NULL)
56 CloseLibrary(base2);
58 FPuts(Output(), (STRPTR)"\nTesting pertask.library\n");
60 base1=OpenLibrary((STRPTR)"pertask.library",0);
61 base2=OpenLibrary((STRPTR)"pertask.library",0);
63 FPrintf(Output(), (STRPTR)"base1=%lx, base2=%lx\n", base1, base2);
65 seglist = LoadSeg((CONST_STRPTR)"peropenertest_child");
66 if (seglist != (BPTR)NULL)
68 SetProgramName("peropenertest_child");
69 RunCommand(seglist, 10*1024, "\n", 1);
70 UnLoadSeg(seglist);
72 else
74 FPrintf(Output(), (STRPTR)"Failed to load peropenertest_child\n");
77 if (base1 != NULL)
78 CloseLibrary(base1);
79 if (base2 != NULL)
80 CloseLibrary(base2);
82 Flush (Output ());
84 return 0;