void test_mutt_regex_compile(void)
{
// struct Regex *mutt_regex_compile(const char *str, int flags);
+
+ {
+ TEST_CHECK(!mutt_regex_compile(NULL, 0));
+ }
}
void test_mutt_regex_free(void)
{
// void mutt_regex_free(struct Regex **r);
+
+ {
+ mutt_regex_free(NULL);
+ TEST_CHECK_(1, "mutt_regex_free(NULL)");
+ }
+
+ {
+ struct Regex *regex = NULL;
+ mutt_regex_free(®ex);
+ TEST_CHECK_(1, "mutt_regex_free(®ex)");
+ }
}
void test_mutt_regex_new(void)
{
// struct Regex *mutt_regex_new(const char *str, int flags, struct Buffer *err);
+
+ {
+ struct Buffer buf = { 0 };
+ TEST_CHECK(!mutt_regex_new(NULL, 0, &buf));
+ }
+
+ {
+ TEST_CHECK(mutt_regex_new("apple", 0, NULL) != NULL);
+ }
}
void test_mutt_regexlist_add(void)
{
// int mutt_regexlist_add(struct RegexList *rl, const char *str, int flags, struct Buffer *err);
+
+ {
+ struct Buffer buf = { 0 };
+ TEST_CHECK(mutt_regexlist_add(NULL, "apple", 0, &buf) == 0);
+ }
+
+ {
+ struct RegexList regexlist = { 0 };
+ struct Buffer buf = { 0 };
+ TEST_CHECK(mutt_regexlist_add(®exlist, NULL, 0, &buf) == 0);
+ }
+
+ {
+ struct RegexList regexlist = STAILQ_HEAD_INITIALIZER(regexlist);
+ TEST_CHECK(mutt_regexlist_add(®exlist, "apple", 0, NULL) == 0);
+ }
}
void test_mutt_regexlist_free(void)
{
// void mutt_regexlist_free(struct RegexList *rl);
+
+ {
+ mutt_regexlist_free(NULL);
+ TEST_CHECK_(1, "mutt_regexlist_free(NULL)");
+ }
}
void test_mutt_regexlist_match(void)
{
// bool mutt_regexlist_match(struct RegexList *rl, const char *str);
+
+ {
+ TEST_CHECK(!mutt_regexlist_match(NULL, "apple"));
+ }
+
+ {
+ struct RegexList regexlist = { 0 };
+ TEST_CHECK(!mutt_regexlist_match(®exlist, NULL));
+ }
}
void test_mutt_regexlist_remove(void)
{
// int mutt_regexlist_remove(struct RegexList *rl, const char *str);
+
+ {
+ TEST_CHECK(mutt_regexlist_remove(NULL, "apple") != 0);
+ }
+
+ {
+ struct RegexList regexlist = { 0 };
+ TEST_CHECK(mutt_regexlist_remove(®exlist, NULL) != 0);
+ }
}
void test_mutt_replacelist_add(void)
{
// int mutt_replacelist_add(struct ReplaceList *rl, const char *pat, const char *templ, struct Buffer *err);
+
+ {
+ struct Buffer buf = { 0 };
+ TEST_CHECK(mutt_replacelist_add(NULL, "apple", "banana", &buf) == 0);
+ }
+
+ {
+ struct ReplaceList replacelist = { 0 };
+ struct Buffer buf = { 0 };
+ TEST_CHECK(mutt_replacelist_add(&replacelist, NULL, "banana", &buf) == 0);
+ }
+
+ {
+ struct ReplaceList replacelist = { 0 };
+ struct Buffer buf = { 0 };
+ TEST_CHECK(mutt_replacelist_add(&replacelist, "apple", NULL, &buf) == 0);
+ }
+
+ {
+ struct ReplaceList replacelist = STAILQ_HEAD_INITIALIZER(replacelist);
+ TEST_CHECK(mutt_replacelist_add(&replacelist, "apple", "banana", NULL) == 0);
+ }
}
void test_mutt_replacelist_apply(void)
{
// char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, const char *str);
+
+ {
+ char buf[32] = { 0 };
+ TEST_CHECK(mutt_replacelist_apply(NULL, buf, sizeof(buf), "apple") == buf);
+ }
+
+ {
+ struct ReplaceList replacelist = { 0 };
+ TEST_CHECK(mutt_replacelist_apply(&replacelist, NULL, 10, "apple") != NULL);
+ }
+
+ {
+ struct ReplaceList replacelist = { 0 };
+ char buf[32] = { 0 };
+ TEST_CHECK(mutt_replacelist_apply(&replacelist, buf, sizeof(buf), NULL) == buf);
+ }
}
void test_mutt_replacelist_free(void)
{
// void mutt_replacelist_free(struct ReplaceList *rl);
+
+ {
+ mutt_replacelist_free(NULL);
+ TEST_CHECK_(1, "mutt_replacelist_free(NULL)");
+ }
}
void test_mutt_replacelist_match(void)
{
// bool mutt_replacelist_match(struct ReplaceList *rl, char *buf, size_t buflen, const char *str);
+
+ {
+ char buf[32] = { 0 };
+ TEST_CHECK(!mutt_replacelist_match(NULL, buf, sizeof(buf), "apple"));
+ }
+
+ {
+ struct ReplaceList replacelist = { 0 };
+ TEST_CHECK(!mutt_replacelist_match(&replacelist, NULL, 10, "apple"));
+ }
+
+ {
+ struct ReplaceList replacelist = { 0 };
+ char buf[32] = { 0 };
+ TEST_CHECK(!mutt_replacelist_match(&replacelist, buf, sizeof(buf), NULL));
+ }
}
void test_mutt_replacelist_remove(void)
{
// int mutt_replacelist_remove(struct ReplaceList *rl, const char *pat);
+
+ {
+ TEST_CHECK(mutt_replacelist_remove(NULL, "apple") == 0);
+ }
+
+ {
+ struct ReplaceList replacelist = { 0 };
+ TEST_CHECK(mutt_replacelist_remove(&replacelist, NULL) == 0);
+ }
}