From 60f4722621bbf4560c1a689c8c50950c181fa463 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sun, 28 Apr 2019 14:13:46 +0100 Subject: [PATCH] test: templates for thread functions --- .gitignore | 1 + test/Makefile.autosetup | 28 ++++++++++++++-- test/thread/clean_references.c | 33 ++++++++++++++++++ test/thread/find_virtual.c | 33 ++++++++++++++++++ test/thread/insert_message.c | 33 ++++++++++++++++++ test/thread/is_descendant.c | 33 ++++++++++++++++++ test/thread/main.c | 50 ++++++++++++++++++++++++++++ test/thread/mutt_break_thread.c | 33 ++++++++++++++++++ test/thread/thread_hash_destructor.c | 33 ++++++++++++++++++ test/thread/unlink_message.c | 33 ++++++++++++++++++ 10 files changed, 307 insertions(+), 3 deletions(-) create mode 100644 test/thread/clean_references.c create mode 100644 test/thread/find_virtual.c create mode 100644 test/thread/insert_message.c create mode 100644 test/thread/is_descendant.c create mode 100644 test/thread/main.c create mode 100644 test/thread/mutt_break_thread.c create mode 100644 test/thread/thread_hash_destructor.c create mode 100644 test/thread/unlink_message.c diff --git a/.gitignore b/.gitignore index ed6c3ef8a..df8b7650c 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ test/sha1-test test/signal-test test/string-test test/tags-test +test/thread-test # Build products *.o diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index a6c211717..2cd533575 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -444,6 +444,15 @@ TAGS_OBJS = test/tags/main.o \ test/tags/driver_tags_free.o \ test/tags/driver_tags_get_transformed_for.o +THREAD_OBJS = test/thread/main.o \ + test/thread/thread_hash_destructor.o \ + test/thread/is_descendant.o \ + test/thread/mutt_break_thread.o \ + test/thread/unlink_message.o \ + test/thread/clean_references.o \ + test/thread/find_virtual.o \ + test/thread/insert_message.o + CFLAGS += -I$(SRCDIR)/test TEST_BINARY = test/neomutt-test$(EXEEXT) @@ -516,8 +525,10 @@ TEST_STRING = test/string-test$(EXEEXT) TEST_TAGS = test/tags-test$(EXEEXT) +TEST_THREAD = test/thread-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_PARAMETER) $(TEST_PARSE) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_RFC2047) $(TEST_RFC2231) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING) $(TEST_TAGS) +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_PARSE) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_RFC2047) $(TEST_RFC2231) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING) $(TEST_TAGS) $(TEST_THREAD) $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) @@ -552,6 +563,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_SIGNAL) $(TEST_STRING) $(TEST_TAGS) + $(TEST_THREAD) $(TEST_BINARY): $(TEST_OBJS) $(MUTTLIBS) $(CC) -o $@ $(TEST_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) @@ -658,6 +670,9 @@ $(TEST_STRING): $(PWD)/test/string $(STRING_OBJS) $(MUTTLIBS) $(TEST_TAGS): $(PWD)/test/tags $(TAGS_OBJS) $(MUTTLIBS) $(CC) -o $@ $(TAGS_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) +$(TEST_THREAD): $(PWD)/test/thread $(THREAD_OBJS) $(MUTTLIBS) + $(CC) -o $@ $(THREAD_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) + $(PWD)/test/address: $(MKDIR_P) $(PWD)/test/address @@ -760,7 +775,10 @@ $(PWD)/test/string: $(PWD)/test/tags: $(MKDIR_P) $(PWD)/test/tags -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_PARSE) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_RFC2047) $(TEST_RFC2231) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING) $(TEST_TAGS) +$(PWD)/test/thread: + $(MKDIR_P) $(PWD)/test/thread + +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_PARSE) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_RFC2047) $(TEST_RFC2231) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING) $(TEST_TAGS) $(TEST_THREAD) clean-test: $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \ @@ -797,7 +815,8 @@ clean-test: $(TEST_SHA1) $(SHA1_OBJS) $(SHA1_OBJS:.o=.Po) \ $(TEST_SIGNAL) $(SIGNAL_OBJS) $(SIGNAL_OBJS:.o=.Po) \ $(TEST_STRING) $(STRING_OBJS) $(STRING_OBJS:.o=.Po) \ - $(TEST_TAGS) $(TAGS_OBJS) $(TAGS_OBJS:.o=.Po) + $(TEST_TAGS) $(TAGS_OBJS) $(TAGS_OBJS:.o=.Po) \ + $(TEST_THREAD) $(THREAD_OBJS) $(THREAD_OBJS:.o=.Po) install-test: uninstall-test: @@ -907,4 +926,7 @@ STRING_DEPFILES = $(STRING_OBJS:.o=.Po) TAGS_DEPFILES = $(TAGS_OBJS:.o=.Po) -include $(TAGS_DEPFILES) +THREAD_DEPFILES = $(THREAD_OBJS:.o=.Po) +-include $(THREAD_DEPFILES) + # vim: set ts=8 noexpandtab: diff --git a/test/thread/clean_references.c b/test/thread/clean_references.c new file mode 100644 index 000000000..c8419453a --- /dev/null +++ b/test/thread/clean_references.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for clean_references() + * + * @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_clean_references(void) +{ + // void clean_references(struct MuttThread *brk, struct MuttThread *cur); +} diff --git a/test/thread/find_virtual.c b/test/thread/find_virtual.c new file mode 100644 index 000000000..96a8a9688 --- /dev/null +++ b/test/thread/find_virtual.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for find_virtual() + * + * @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_find_virtual(void) +{ + // struct Email *find_virtual(struct MuttThread *cur, int reverse); +} diff --git a/test/thread/insert_message.c b/test/thread/insert_message.c new file mode 100644 index 000000000..71b4806cc --- /dev/null +++ b/test/thread/insert_message.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for insert_message() + * + * @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_insert_message(void) +{ + // void insert_message(struct MuttThread **new, struct MuttThread *newparent, struct MuttThread *cur); +} diff --git a/test/thread/is_descendant.c b/test/thread/is_descendant.c new file mode 100644 index 000000000..5754bd9d5 --- /dev/null +++ b/test/thread/is_descendant.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for is_descendant() + * + * @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_is_descendant(void) +{ + // bool is_descendant(struct MuttThread *a, struct MuttThread *b); +} diff --git a/test/thread/main.c b/test/thread/main.c new file mode 100644 index 000000000..e83efe73d --- /dev/null +++ b/test/thread/main.c @@ -0,0 +1,50 @@ +/** + * @file + * Test code for thread 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_clean_references) \ + NEOMUTT_TEST_ITEM(test_find_virtual) \ + NEOMUTT_TEST_ITEM(test_insert_message) \ + NEOMUTT_TEST_ITEM(test_is_descendant) \ + NEOMUTT_TEST_ITEM(test_mutt_break_thread) \ + NEOMUTT_TEST_ITEM(test_thread_hash_destructor) \ + NEOMUTT_TEST_ITEM(test_unlink_message) + +/****************************************************************************** + * 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/thread/mutt_break_thread.c b/test/thread/mutt_break_thread.c new file mode 100644 index 000000000..cdc0e3a68 --- /dev/null +++ b/test/thread/mutt_break_thread.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_break_thread() + * + * @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_break_thread(void) +{ + // void mutt_break_thread(struct Email *e); +} diff --git a/test/thread/thread_hash_destructor.c b/test/thread/thread_hash_destructor.c new file mode 100644 index 000000000..dbd3afc85 --- /dev/null +++ b/test/thread/thread_hash_destructor.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for thread_hash_destructor() + * + * @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_thread_hash_destructor(void) +{ + // void thread_hash_destructor(int type, void *obj, intptr_t data); +} diff --git a/test/thread/unlink_message.c b/test/thread/unlink_message.c new file mode 100644 index 000000000..fc3166c5e --- /dev/null +++ b/test/thread/unlink_message.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for unlink_message() + * + * @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_unlink_message(void) +{ + // void unlink_message(struct MuttThread **old, struct MuttThread *cur); +} -- 2.40.0