2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
10 static void testvalue(CONST_STRPTR var
, STRPTR expval
, ULONG explen
, BOOL expnull
, LONG cnt
)
16 if ((len
= GetVar(var
, buffer
, sizeof(buffer
), 0)) < 0)
17 printf("test %d ERROR getvar %d\n", (int)cnt
, (int)len
);
19 printf("test %d getvar '%s'\n", (int)cnt
, buffer
);
20 if ((lv
= FindVar(var
, 0)) == NULL
)
21 printf("test %d ERROR findvar\n", (int)cnt
);
23 printf("test %d findvar lv_Value=%p, lv_Len=%d\n", (int)cnt
, lv
->lv_Value
, (int)lv
->lv_Len
);
24 if (lv
->lv_Len
!= explen
)
25 printf("test %d ERROR lv_Len, expected %d, found %d\n", (int)cnt
, (int)explen
, (int)lv
->lv_Len
);
26 if (expnull
&& lv
->lv_Value
!= NULL
)
27 printf("test %d ERROR lv_Value expected NULL, found %p\n", (int)cnt
, lv
->lv_Value
);
29 if (!expnull
&& lv
->lv_Value
== NULL
)
30 printf("test %d ERROR lv_Value expected not NULL, found %p\n", (int)cnt
, lv
->lv_Value
);
35 CONST_STRPTR var
="abc";
39 /* Behavior validated with OS3.x */
41 printf("test %d setvar '%s'\n", (int)cnt
, val
);
42 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
43 printf("error setvar\n");
44 testvalue(var
, val
, 3, FALSE
, cnt
++);
47 printf("test %d setvar '%s'\n", (int)cnt
, val
);
48 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
49 printf("error setvar\n");
50 testvalue(var
, val
, 0, TRUE
, cnt
++);
53 printf("test %d setvar '%s'\n", (int)cnt
, val
);
54 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
55 printf("error setvar\n");
56 testvalue(var
, val
, 4, FALSE
, cnt
++);
59 printf("test %d setvar '%s'\n", (int)cnt
, val
);
60 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
61 printf("error setvar\n");
62 testvalue(var
, val
, 0, TRUE
, cnt
++);
65 printf("test %d setvar '%s'\n", (int)cnt
, val
);
66 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
67 printf("error setvar\n");
68 testvalue(var
, val
, 0, TRUE
, cnt
++);