From: Richard Russon Date: Sun, 28 Apr 2019 13:13:46 +0000 (+0100) Subject: test: templates for parameter functions X-Git-Tag: 2019-10-25~233^2~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=403e97b2927379702a7c0fd8e5a381b99175559c;p=neomutt test: templates for parameter functions --- diff --git a/.gitignore b/.gitignore index 9224eee07..14e83ba94 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index 4b15c2a69..f664e67ce 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -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 index 000000000..faf13e98f --- /dev/null +++ b/test/parameter/main.c @@ -0,0 +1,50 @@ +/** + * @file + * Test code for parameter Operations + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#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 index 000000000..659c88595 --- /dev/null +++ b/test/parameter/mutt_param_cmp_strict.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_param_cmp_strict() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#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 index 000000000..3843e2f3b --- /dev/null +++ b/test/parameter/mutt_param_delete.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_param_delete() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#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 index 000000000..9c2675af4 --- /dev/null +++ b/test/parameter/mutt_param_free.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_param_free() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#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 index 000000000..a045b7c44 --- /dev/null +++ b/test/parameter/mutt_param_free_one.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_param_free_one() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#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 index 000000000..a2c9f860d --- /dev/null +++ b/test/parameter/mutt_param_get.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_param_get() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#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 index 000000000..353db8ae3 --- /dev/null +++ b/test/parameter/mutt_param_new.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_param_new() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#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 index 000000000..ba03ae418 --- /dev/null +++ b/test/parameter/mutt_param_set.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_param_set() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#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); +}