MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / test2

Function test2

tests/testcookie.c:51–85  ·  view source on GitHub ↗

RENEW tests

Source from the content-addressed store, hash-verified

49
50// RENEW tests
51static int test2()
52{
53 int retcode;
54 char cookie[HAMLIB_COOKIE_SIZE];
55 retcode = rig_cookie(NULL, RIG_COOKIE_GET, cookie, sizeof(cookie));
56
57 if (retcode == RIG_OK) { printf("Test#2a OK %s\n", cookie); }
58 else {printf("Test#2a Failed\n"); return 1;}
59
60 retcode = rig_cookie(NULL, RIG_COOKIE_RELEASE, cookie, sizeof(cookie));
61
62 if (retcode == RIG_OK) { printf("Test#2b OK\n"); }
63 else {printf("Test#2b Failed\n"); return 1;}
64
65// get another cookie should work
66 char cookie2[HAMLIB_COOKIE_SIZE];
67 retcode = rig_cookie(NULL, RIG_COOKIE_GET, cookie2, sizeof(cookie2));
68
69 if (retcode == RIG_OK) { printf("Test#2c OK %s\n", cookie2); }
70 else {printf("Test#2c Failed\n"); return 1;}
71
72// should not be able to renew 1st cookie
73 retcode = rig_cookie(NULL, RIG_COOKIE_RENEW, cookie, sizeof(cookie));
74
75 if (retcode != RIG_OK) { printf("Test#2d OK\n"); }
76 else {printf("Test#2d Failed cookie=%s\n", cookie); return 1;}
77
78// release cookie2 again to clean up test
79 retcode = rig_cookie(NULL, RIG_COOKIE_RELEASE, cookie2, sizeof(cookie2));
80
81 if (retcode == RIG_OK) { printf("Test#2e OK\n"); }
82 else {printf("Test#2e Failed\n"); return 1;}
83
84 return 0;
85}
86
87// Input sanity checks
88static int test3_invalid_input()

Callers 1

mainFunction · 0.85

Calls 1

rig_cookieFunction · 0.85

Tested by

no test coverage detected