MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / test_parse_qop_val

Function test_parse_qop_val

parser/test/test_parse_qop.c:32–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30void test_parse_qop_oob(const str *, enum oob_position where, void *);
31
32void test_parse_qop_val(void)
33{
34 struct authenticate_body auth;
35 int i;
36 struct tts {
37 const str ts;
38 int tres;
39 int aflags;
40 } tset[] = {
41 {.ts = str_init("aut"), .tres = -1},
42 {.ts = str_init("auth-inti"), .tres = -1},
43 {.ts = str_init("auth,aut"), .tres = -1},
44 {.ts = str_init("auth,auth-inti"), .tres = -1},
45 {.ts = str_init("auth,,auth-int"), .tres = -1},
46 {.ts = str_init("auth-int,"), .tres = -1},
47 {.ts = str_init("auth,auth-int,"), .tres = -1},
48 {.ts = str_init("auth,auth-int,aut"), .tres = -1},
49 {.ts = str_init("auth-int , \tauth "), .tres = -1},
50 {.ts = str_init(" auth-int,auth"), .tres = -1},
51 {.ts = str_init("auth "), .tres = 0, .aflags = QOP_AUTH},
52 {.ts = str_init("auth-int"), .tres = 0, .aflags = QOP_AUTH_INT},
53 {.ts = str_init("auth, auth-int"), .tres = 0, .aflags = QOP_AUTH | QOP_AUTH_INT},
54 {.ts = str_init("auth-int , auth"), .tres = 0, .aflags = QOP_AUTH | QOP_AUTH_INT},
55 {}
56 };
57
58 for (i = 0; tset[i].ts.s != NULL; i++) {
59 memset(&auth, 0, sizeof(struct authenticate_body));
60 ok(parse_qop_value(tset[i].ts, &auth) == tset[i].tres,
61 "parse_qop_value(\"%s\") == %d", tset[i].ts.s, tset[i].tres);
62 if (tset[i].tres == 0)
63 ok(auth.flags == tset[i].aflags, "auth.flags == %d", tset[i].aflags);
64 test_oob(&tset[i].ts, test_parse_qop_oob, &auth);
65 }
66}
67
68void test_parse_qop_oob(const str *tstr, enum oob_position where, void *farg)
69{

Callers 1

test_parserFunction · 0.85

Calls 2

parse_qop_valueFunction · 0.85
test_oobFunction · 0.85

Tested by

no test coverage detected