]> granicus.if.org Git - neomutt/commitdiff
test: templates for group functions
authorRichard Russon <rich@flatcap.org>
Sat, 27 Apr 2019 17:36:27 +0000 (18:36 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 27 Apr 2019 21:48:41 +0000 (22:48 +0100)
14 files changed:
.gitignore
test/Makefile.autosetup
test/group/main.c [new file with mode: 0644]
test/group/mutt_group_match.c [new file with mode: 0644]
test/group/mutt_grouplist_add.c [new file with mode: 0644]
test/group/mutt_grouplist_add_addrlist.c [new file with mode: 0644]
test/group/mutt_grouplist_add_regex.c [new file with mode: 0644]
test/group/mutt_grouplist_clear.c [new file with mode: 0644]
test/group/mutt_grouplist_destroy.c [new file with mode: 0644]
test/group/mutt_grouplist_free.c [new file with mode: 0644]
test/group/mutt_grouplist_init.c [new file with mode: 0644]
test/group/mutt_grouplist_remove_addrlist.c [new file with mode: 0644]
test/group/mutt_grouplist_remove_regex.c [new file with mode: 0644]
test/group/mutt_pattern_group.c [new file with mode: 0644]

index 189108cc46d5b02f0f961238186e6f13cc3c2b1a..ba533da450122b8b0d6cdd813955840be2681615 100644 (file)
@@ -12,6 +12,7 @@ neomutt
 pgpewrap
 test/address-test
 test/config-test
+test/group-test
 test/neomutt-test
 test/path-test
 test/pattern-test
index 58f1ce7b6811458b20b253c0d56bfbf9e0feaba2..684152b8cdf0abed98251997ae2f4ccca5f88004 100644 (file)
@@ -44,6 +44,19 @@ CONFIG_OBJS  = test/config/main.o test/config/account.o \
                  test/config/regex.o test/config/set.o test/config/sort.o \
                  test/config/string.o test/config/synonym.o
 
+GROUP_OBJS     = test/group/main.o \
+                 test/group/mutt_grouplist_add_addrlist.o \
+                 test/group/mutt_grouplist_add.o \
+                 test/group/mutt_grouplist_add_regex.o \
+                 test/group/mutt_grouplist_clear.o \
+                 test/group/mutt_grouplist_destroy.o \
+                 test/group/mutt_grouplist_free.o \
+                 test/group/mutt_grouplist_init.o \
+                 test/group/mutt_grouplist_remove_addrlist.o \
+                 test/group/mutt_grouplist_remove_regex.o \
+                 test/group/mutt_group_match.o \
+                 test/group/mutt_pattern_group.o
+
 PATH_OBJS      = test/path/main.o \
                  test/path/mutt_path_abbr_folder.o \
                  test/path/mutt_path_basename.o \
@@ -123,6 +136,8 @@ TEST_ADDRESS = test/address-test$(EXEEXT)
 
 TEST_CONFIG = test/config-test$(EXEEXT)
 
+TEST_GROUP = test/group-test$(EXEEXT)
+
 TEST_PATH = test/path-test$(EXEEXT)
 
 TEST_PATTERN = test/pattern-test$(EXEEXT)
@@ -130,10 +145,11 @@ TEST_PATTERN = test/pattern-test$(EXEEXT)
 TEST_STRING = test/string-test$(EXEEXT)
 
 .PHONY: test
-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_CONFIG) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
+test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_CONFIG) $(TEST_GROUP) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
        $(TEST_CONFIG)
+       $(TEST_GROUP)
        $(TEST_PATH)
        $(TEST_PATTERN)
        $(TEST_STRING)
@@ -147,6 +163,9 @@ $(TEST_ADDRESS): $(PWD)/test/address $(ADDRESS_OBJS) $(MUTTLIBS)
 $(TEST_CONFIG): $(PWD)/test/config $(CONFIG_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(CONFIG_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_GROUP): $(PWD)/test/group $(GROUP_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(GROUP_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_PATH): $(PWD)/test/path $(PATH_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(PATH_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -162,6 +181,9 @@ $(PWD)/test/address:
 $(PWD)/test/config:
        $(MKDIR_P) $(PWD)/test/config
 
+$(PWD)/test/group:
+       $(MKDIR_P) $(PWD)/test/group
+
 $(PWD)/test/path:
        $(MKDIR_P) $(PWD)/test/path
 
@@ -171,12 +193,13 @@ $(PWD)/test/pattern:
 $(PWD)/test/string:
        $(MKDIR_P) $(PWD)/test/string
 
-all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_CONFIG) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
+all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_CONFIG) $(TEST_GROUP) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
              $(TEST_ADDRESS) $(ADDRESS_OBJS) $(ADDRESS_OBJS:.o=.Po) \
              $(TEST_CONFIG) $(CONFIG_OBJS) $(CONFIG_OBJS:.o=.Po) \
+             $(TEST_GROUP) $(GROUP_OBJS) $(GROUP_OBJS:.o=.Po) \
              $(TEST_PATH) $(PATH_OBJS) $(PATH_OBJS:.o=.Po) \
              $(TEST_PATTERN) $(PATTERN_OBJS) $(PATTERN_OBJS:.o=.Po) \
              $(TEST_STRING) $(STRING_OBJS) $(STRING_OBJS:.o=.Po)
@@ -193,6 +216,9 @@ ADDRESS_DEPFILES = $(ADDRESS_OBJS:.o=.Po)
 CONFIG_DEPFILES = $(CONFIG_OBJS:.o=.Po)
 -include $(CONFIG_DEPFILES)
 
+GROUP_DEPFILES = $(GROUP_OBJS:.o=.Po)
+-include $(GROUP_DEPFILES)
+
 PATH_DEPFILES = $(PATH_OBJS:.o=.Po)
 -include $(PATH_DEPFILES)
 
diff --git a/test/group/main.c b/test/group/main.c
new file mode 100644 (file)
index 0000000..5f20d76
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ * @file
+ * Test code for Path Operations
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "acutest.h"
+
+/******************************************************************************
+ * Add your test cases to this list.
+ *****************************************************************************/
+#define NEOMUTT_TEST_LIST                                                      \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_add)                                   \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_add_addrlist)                          \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_add_regex)                             \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_clear)                                 \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_destroy)                               \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_free)                                  \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_init)                                  \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_remove_addrlist)                       \
+  NEOMUTT_TEST_ITEM(test_mutt_grouplist_remove_regex)                          \
+  NEOMUTT_TEST_ITEM(test_mutt_group_match)                                     \
+  NEOMUTT_TEST_ITEM(test_mutt_pattern_group)
+
+/******************************************************************************
+ * You probably don't need to touch what follows.
+ *****************************************************************************/
+#define NEOMUTT_TEST_ITEM(x) void x(void);
+NEOMUTT_TEST_LIST
+#undef NEOMUTT_TEST_ITEM
+
+TEST_LIST = {
+#define NEOMUTT_TEST_ITEM(x) { #x, x },
+  NEOMUTT_TEST_LIST
+#undef NEOMUTT_TEST_ITEM
+  { 0 }
+};
diff --git a/test/group/mutt_group_match.c b/test/group/mutt_group_match.c
new file mode 100644 (file)
index 0000000..5d32ddd
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_group_match()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_group_match(void)
+{
+  // bool mutt_group_match(struct Group *g, const char *s);
+}
diff --git a/test/group/mutt_grouplist_add.c b/test/group/mutt_grouplist_add.c
new file mode 100644 (file)
index 0000000..8d37336
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_add()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_add(void)
+{
+  // void mutt_grouplist_add(struct GroupList *head, struct Group *group);
+}
diff --git a/test/group/mutt_grouplist_add_addrlist.c b/test/group/mutt_grouplist_add_addrlist.c
new file mode 100644 (file)
index 0000000..34d73aa
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_add_addrlist()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_add_addrlist(void)
+{
+  // void mutt_grouplist_add_addrlist(struct GroupList *head, struct Address *a);
+}
diff --git a/test/group/mutt_grouplist_add_regex.c b/test/group/mutt_grouplist_add_regex.c
new file mode 100644 (file)
index 0000000..12f3814
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_add_regex()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_add_regex(void)
+{
+  // int mutt_grouplist_add_regex(struct GroupList *head, const char *s, int flags, struct Buffer *err);
+}
diff --git a/test/group/mutt_grouplist_clear.c b/test/group/mutt_grouplist_clear.c
new file mode 100644 (file)
index 0000000..4080e0e
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_clear()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_clear(void)
+{
+  // void mutt_grouplist_clear(struct GroupList *head);
+}
diff --git a/test/group/mutt_grouplist_destroy.c b/test/group/mutt_grouplist_destroy.c
new file mode 100644 (file)
index 0000000..8c8acab
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_destroy()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_destroy(void)
+{
+  // void mutt_grouplist_destroy(struct GroupList *head);
+}
diff --git a/test/group/mutt_grouplist_free.c b/test/group/mutt_grouplist_free.c
new file mode 100644 (file)
index 0000000..60b7455
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_free()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_free(void)
+{
+  // void mutt_grouplist_free(void);
+}
diff --git a/test/group/mutt_grouplist_init.c b/test/group/mutt_grouplist_init.c
new file mode 100644 (file)
index 0000000..074c6c6
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_init()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_init(void)
+{
+  // void mutt_grouplist_init(void);
+}
diff --git a/test/group/mutt_grouplist_remove_addrlist.c b/test/group/mutt_grouplist_remove_addrlist.c
new file mode 100644 (file)
index 0000000..6909e07
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_remove_addrlist()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_remove_addrlist(void)
+{
+  // int mutt_grouplist_remove_addrlist(struct GroupList *head, struct Address *a);
+}
diff --git a/test/group/mutt_grouplist_remove_regex.c b/test/group/mutt_grouplist_remove_regex.c
new file mode 100644 (file)
index 0000000..edd9862
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_grouplist_remove_regex()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_grouplist_remove_regex(void)
+{
+  // int mutt_grouplist_remove_regex(struct GroupList *head, const char *s);
+}
diff --git a/test/group/mutt_pattern_group.c b/test/group/mutt_pattern_group.c
new file mode 100644 (file)
index 0000000..5541a70
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * Test code for mutt_pattern_group()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+#include "address/lib.h"
+
+void test_mutt_pattern_group(void)
+{
+  // struct Group *mutt_pattern_group(const char *k);
+}