5 static void testvalue(CONST_STRPTR var
, STRPTR expval
, ULONG explen
, BOOL expnull
, LONG cnt
)
11 if ((len
= GetVar(var
, buffer
, sizeof(buffer
), 0)) < 0)
12 printf("test %d ERROR getvar %d\n", cnt
, (int)len
);
14 printf("test %d getvar '%s'\n", cnt
, buffer
);
15 if ((lv
= FindVar(var
, 0)) == NULL
)
16 printf("test %d ERROR findvar\n", cnt
);
18 printf("test %d findvar lv_Value=%p, lv_Len=%d\n", cnt
, lv
->lv_Value
, lv
->lv_Len
);
19 if (lv
->lv_Len
!= explen
)
20 printf("test %d ERROR lv_Len, expected %d, found %d\n", cnt
, explen
, lv
->lv_Len
);
21 if (expnull
&& lv
->lv_Value
!= NULL
)
22 printf("test %d ERROR lv_Value expected NULL, found %p\n", cnt
, lv
->lv_Value
);
24 if (!expnull
&& lv
->lv_Value
== NULL
)
25 printf("test %d ERROR lv_Value expected not NULL, found %p\n", cnt
, lv
->lv_Value
);
30 CONST_STRPTR var
="abc";
34 /* Behavior validated with OS3.x */
36 printf("test %d setvar '%s'\n", cnt
, val
);
37 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
38 printf("error setvar\n");
39 testvalue(var
, val
, 3, FALSE
, cnt
++);
42 printf("test %d setvar '%s'\n", cnt
, val
);
43 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
44 printf("error setvar\n");
45 testvalue(var
, val
, 0, TRUE
, cnt
++);
48 printf("test %d setvar '%s'\n", cnt
, val
);
49 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
50 printf("error setvar\n");
51 testvalue(var
, val
, 4, FALSE
, cnt
++);
54 printf("test %d setvar '%s'\n", cnt
, val
);
55 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
56 printf("error setvar\n");
57 testvalue(var
, val
, 0, TRUE
, cnt
++);
60 printf("test %d setvar '%s'\n", cnt
, val
);
61 if (SetVar(var
, val
, strlen(val
), 0) == DOSFALSE
)
62 printf("error setvar\n");
63 testvalue(var
, val
, 0, TRUE
, cnt
++);