File: test_credentials.tcc

package info (click to toggle)
uhub 0.4.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,436 kB
  • ctags: 2,270
  • sloc: ansic: 18,123; xml: 575; perl: 568; sh: 368; makefile: 24
file content (24 lines) | stat: -rw-r--r-- 1,822 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <uhub.h>

EXO_TEST(cred_to_string_1, { return !strcmp(auth_cred_to_string(auth_cred_none),     "none");     });
EXO_TEST(cred_to_string_2, { return !strcmp(auth_cred_to_string(auth_cred_bot),      "bot");      });
EXO_TEST(cred_to_string_3, { return !strcmp(auth_cred_to_string(auth_cred_guest),    "guest");    });
EXO_TEST(cred_to_string_4, { return !strcmp(auth_cred_to_string(auth_cred_user),     "user");     });
EXO_TEST(cred_to_string_5, { return !strcmp(auth_cred_to_string(auth_cred_operator), "operator"); });
EXO_TEST(cred_to_string_6, { return !strcmp(auth_cred_to_string(auth_cred_super),    "super");    });
EXO_TEST(cred_to_string_7, { return !strcmp(auth_cred_to_string(auth_cred_link),     "link");     });
EXO_TEST(cred_to_string_8, { return !strcmp(auth_cred_to_string(auth_cred_admin),    "admin");    });

#define CRED_FROM_STRING(STR, EXPECT) enum auth_credentials cred; return auth_string_to_cred(STR, &cred) && cred == EXPECT;

EXO_TEST(cred_from_string_1,  { CRED_FROM_STRING("none",     auth_cred_none);     });
EXO_TEST(cred_from_string_2,  { CRED_FROM_STRING("bot",      auth_cred_bot);      });
EXO_TEST(cred_from_string_3,  { CRED_FROM_STRING("guest",    auth_cred_guest);    });
EXO_TEST(cred_from_string_4,  { CRED_FROM_STRING("user",     auth_cred_user);     });
EXO_TEST(cred_from_string_5,  { CRED_FROM_STRING("reg",      auth_cred_user);     });
EXO_TEST(cred_from_string_6,  { CRED_FROM_STRING("operator", auth_cred_operator); });
EXO_TEST(cred_from_string_7,  { CRED_FROM_STRING("op",       auth_cred_operator); });
EXO_TEST(cred_from_string_8,  { CRED_FROM_STRING("super",    auth_cred_super);    });
EXO_TEST(cred_from_string_9,  { CRED_FROM_STRING("link",     auth_cred_link);     });
EXO_TEST(cred_from_string_10, { CRED_FROM_STRING("admin",    auth_cred_admin);    });