]> granicus.if.org Git - neomutt/commitdiff
test: templates for parameter functions
authorRichard Russon <rich@flatcap.org>
Sun, 28 Apr 2019 13:13:46 +0000 (14:13 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 10:22:04 +0000 (11:22 +0100)
.gitignore
test/Makefile.autosetup
test/parameter/main.c [new file with mode: 0644]
test/parameter/mutt_param_cmp_strict.c [new file with mode: 0644]
test/parameter/mutt_param_delete.c [new file with mode: 0644]
test/parameter/mutt_param_free.c [new file with mode: 0644]
test/parameter/mutt_param_free_one.c [new file with mode: 0644]
test/parameter/mutt_param_get.c [new file with mode: 0644]
test/parameter/mutt_param_new.c [new file with mode: 0644]
test/parameter/mutt_param_set.c [new file with mode: 0644]

index 9224eee0753b260116ff2e491d58a0c2a6382143..14e83ba94c119b1c8d674c27739a84ab37074566 100644 (file)
@@ -34,6 +34,7 @@ test/mbyte-test
 test/md5-test
 test/memory-test
 test/neomutt-test
+test/parameter-test
 test/path-test
 test/pattern-test
 test/regex-test
index 4b15c2a695c7968456928c053be2a1c910cf382d..f664e67ceb4bce8be1c346120ff7263b4df31dcf 100644 (file)
@@ -295,6 +295,15 @@ MEMORY_OBJS        = test/memory/main.o \
                  test/memory/mutt_mem_malloc.o \
                  test/memory/mutt_mem_realloc.o
 
+PARAMETER_OBJS = test/parameter/main.o \
+                 test/parameter/mutt_param_new.o \
+                 test/parameter/mutt_param_delete.o \
+                 test/parameter/mutt_param_get.o \
+                 test/parameter/mutt_param_cmp_strict.o \
+                 test/parameter/mutt_param_free_one.o \
+                 test/parameter/mutt_param_set.o \
+                 test/parameter/mutt_param_free.o
+
 PATH_OBJS      = test/path/main.o \
                  test/path/mutt_path_abbr_folder.o \
                  test/path/mutt_path_basename.o \
@@ -448,6 +457,8 @@ TEST_MD5 = test/md5-test$(EXEEXT)
 
 TEST_MEMORY = test/memory-test$(EXEEXT)
 
+TEST_PARAMETER = test/parameter-test$(EXEEXT)
+
 TEST_PATH = test/path-test$(EXEEXT)
 
 TEST_PATTERN = test/pattern-test$(EXEEXT)
@@ -461,7 +472,7 @@ TEST_SIGNAL = test/signal-test$(EXEEXT)
 TEST_STRING = test/string-test$(EXEEXT)
 
 .PHONY: test
-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_EMAIL) $(TEST_ENVELOPE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_FROM) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
+test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_EMAIL) $(TEST_ENVELOPE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_FROM) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PARAMETER) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
        $(TEST_ATTACH)
@@ -485,6 +496,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY)
        $(TEST_MBYTE)
        $(TEST_MD5)
        $(TEST_MEMORY)
+       $(TEST_PARAMETER)
        $(TEST_PATH)
        $(TEST_PATTERN)
        $(TEST_REGEX)
@@ -564,6 +576,9 @@ $(TEST_MD5): $(PWD)/test/md5 $(MD5_OBJS) $(MUTTLIBS)
 $(TEST_MEMORY): $(PWD)/test/memory $(MEMORY_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(MEMORY_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_PARAMETER): $(PWD)/test/parameter $(PARAMETER_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(PARAMETER_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_PATH): $(PWD)/test/path $(PATH_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(PATH_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -651,6 +666,9 @@ $(PWD)/test/md5:
 $(PWD)/test/memory:
        $(MKDIR_P) $(PWD)/test/memory
 
+$(PWD)/test/parameter:
+       $(MKDIR_P) $(PWD)/test/parameter
+
 $(PWD)/test/path:
        $(MKDIR_P) $(PWD)/test/path
 
@@ -669,7 +687,7 @@ $(PWD)/test/signal:
 $(PWD)/test/string:
        $(MKDIR_P) $(PWD)/test/string
 
-all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_EMAIL) $(TEST_ENVELOPE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_FROM) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
+all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_EMAIL) $(TEST_ENVELOPE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_FROM) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PARAMETER) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
@@ -696,6 +714,7 @@ clean-test:
              $(TEST_MBYTE) $(MBYTE_OBJS) $(MBYTE_OBJS:.o=.Po) \
              $(TEST_MD5) $(MD5_OBJS) $(MD5_OBJS:.o=.Po) \
              $(TEST_MEMORY) $(MEMORY_OBJS) $(MEMORY_OBJS:.o=.Po) \
+             $(TEST_PARAMETER) $(PARAMETER_OBJS) $(PARAMETER_OBJS:.o=.Po) \
              $(TEST_PATH) $(PATH_OBJS) $(PATH_OBJS:.o=.Po) \
              $(TEST_PATTERN) $(PATTERN_OBJS) $(PATTERN_OBJS:.o=.Po) \
              $(TEST_REGEX) $(REGEX_OBJS) $(REGEX_OBJS:.o=.Po) \
@@ -778,6 +797,9 @@ MD5_DEPFILES = $(MD5_OBJS:.o=.Po)
 MEMORY_DEPFILES = $(MEMORY_OBJS:.o=.Po)
 -include $(MEMORY_DEPFILES)
 
+PARAMETER_DEPFILES = $(PARAMETER_OBJS:.o=.Po)
+-include $(PARAMETER_DEPFILES)
+
 PATH_DEPFILES = $(PATH_OBJS:.o=.Po)
 -include $(PATH_DEPFILES)
 
diff --git a/test/parameter/main.c b/test/parameter/main.c
new file mode 100644 (file)
index 0000000..faf13e9
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * @file
+ * Test code for parameter 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_param_cmp_strict)                                \
+  NEOMUTT_TEST_ITEM(test_mutt_param_delete)                                    \
+  NEOMUTT_TEST_ITEM(test_mutt_param_free)                                      \
+  NEOMUTT_TEST_ITEM(test_mutt_param_free_one)                                  \
+  NEOMUTT_TEST_ITEM(test_mutt_param_get)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_param_new)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_param_set)
+
+/******************************************************************************
+ * 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/parameter/mutt_param_cmp_strict.c b/test/parameter/mutt_param_cmp_strict.c
new file mode 100644 (file)
index 0000000..659c885
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for mutt_param_cmp_strict()
+ *
+ * @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 "email/lib.h"
+#include "address/lib.h"
+
+void test_mutt_param_cmp_strict(void)
+{
+  // bool mutt_param_cmp_strict(const struct ParameterList *p1, const struct ParameterList *p2);
+}
diff --git a/test/parameter/mutt_param_delete.c b/test/parameter/mutt_param_delete.c
new file mode 100644 (file)
index 0000000..3843e2f
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for mutt_param_delete()
+ *
+ * @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 "email/lib.h"
+#include "address/lib.h"
+
+void test_mutt_param_delete(void)
+{
+  // void mutt_param_delete(struct ParameterList *p, const char *attribute);
+}
diff --git a/test/parameter/mutt_param_free.c b/test/parameter/mutt_param_free.c
new file mode 100644 (file)
index 0000000..9c2675a
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for mutt_param_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 "email/lib.h"
+#include "address/lib.h"
+
+void test_mutt_param_free(void)
+{
+  // void mutt_param_free(struct ParameterList *p);
+}
diff --git a/test/parameter/mutt_param_free_one.c b/test/parameter/mutt_param_free_one.c
new file mode 100644 (file)
index 0000000..a045b7c
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for mutt_param_free_one()
+ *
+ * @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 "email/lib.h"
+#include "address/lib.h"
+
+void test_mutt_param_free_one(void)
+{
+  // void mutt_param_free_one(struct Parameter **p);
+}
diff --git a/test/parameter/mutt_param_get.c b/test/parameter/mutt_param_get.c
new file mode 100644 (file)
index 0000000..a2c9f86
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for mutt_param_get()
+ *
+ * @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 "email/lib.h"
+#include "address/lib.h"
+
+void test_mutt_param_get(void)
+{
+  // char *mutt_param_get(const struct ParameterList *p, const char *s);
+}
diff --git a/test/parameter/mutt_param_new.c b/test/parameter/mutt_param_new.c
new file mode 100644 (file)
index 0000000..353db8a
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for mutt_param_new()
+ *
+ * @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 "email/lib.h"
+#include "address/lib.h"
+
+void test_mutt_param_new(void)
+{
+  // struct Parameter *mutt_param_new(void);
+}
diff --git a/test/parameter/mutt_param_set.c b/test/parameter/mutt_param_set.c
new file mode 100644 (file)
index 0000000..ba03ae4
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for mutt_param_set()
+ *
+ * @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 "email/lib.h"
+#include "address/lib.h"
+
+void test_mutt_param_set(void)
+{
+  // void mutt_param_set(struct ParameterList *p, const char *attribute, const char *value);
+}