From: Richard Russon Date: Sun, 28 Apr 2019 13:13:46 +0000 (+0100) Subject: test: templates for body functions X-Git-Tag: 2019-10-25~233^2~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9e65296e8b29d7be9d94cf3689dfd1bbd4be13d;p=neomutt test: templates for body functions --- diff --git a/.gitignore b/.gitignore index ca9616b19..a7f6447ca 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ pgpewrap test/address-test test/attach-test test/base64-test +test/body-test test/buffer-test test/charset-test test/config-test diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index 41f54ca95..cebd84b90 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -48,6 +48,11 @@ BASE64_OBJS = test/base64/main.o \ test/base64/mutt_b64_decode.o \ test/base64/mutt_b64_encode.o +BODY_OBJS = test/body/main.o \ + test/body/mutt_body_free.o \ + test/body/mutt_body_cmp_strict.o \ + test/body/mutt_body_new.o + BUFFER_OBJS = test/buffer/main.o \ test/buffer/mutt_buffer_addch.o \ test/buffer/mutt_buffer_add_printf.o \ @@ -386,6 +391,8 @@ TEST_ATTACH = test/attach-test$(EXEEXT) TEST_BASE64 = test/base64-test$(EXEEXT) +TEST_BODY = test/body-test$(EXEEXT) + TEST_BUFFER = test/buffer-test$(EXEEXT) TEST_CHARSET = test/charset-test$(EXEEXT) @@ -431,11 +438,12 @@ TEST_SIGNAL = test/signal-test$(EXEEXT) TEST_STRING = test/string-test$(EXEEXT) .PHONY: test -test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_ENVLIST) $(TEST_FILE) $(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_ENVLIST) $(TEST_FILE) $(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_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) + $(TEST_BODY) $(TEST_BUFFER) $(TEST_CONFIG) $(TEST_DATE) @@ -470,6 +478,9 @@ $(TEST_ATTACH): $(PWD)/test/attach $(ATTACH_OBJS) $(MUTTLIBS) $(TEST_BASE64): $(PWD)/test/base64 $(BASE64_OBJS) $(MUTTLIBS) $(CC) -o $@ $(BASE64_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) +$(TEST_BODY): $(PWD)/test/body $(BODY_OBJS) $(MUTTLIBS) + $(CC) -o $@ $(BODY_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) + $(TEST_BUFFER): $(PWD)/test/buffer $(BUFFER_OBJS) $(MUTTLIBS) $(CC) -o $@ $(BUFFER_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) @@ -545,6 +556,9 @@ $(PWD)/test/attach: $(PWD)/test/base64: $(MKDIR_P) $(PWD)/test/base64 +$(PWD)/test/body: + $(MKDIR_P) $(PWD)/test/body + $(PWD)/test/buffer: $(MKDIR_P) $(PWD)/test/buffer @@ -611,13 +625,15 @@ $(PWD)/test/signal: $(PWD)/test/string: $(MKDIR_P) $(PWD)/test/string -all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_ENVLIST) $(TEST_FILE) $(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_ENVLIST) $(TEST_FILE) $(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) clean-test: $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \ $(TEST_ADDRESS) $(ADDRESS_OBJS) $(ADDRESS_OBJS:.o=.Po) \ $(TEST_ATTACH) $(ATTACH_OBJS) $(ATTACH_OBJS:.o=.Po) \ $(TEST_BASE64) $(BASE64_OBJS) $(BASE64_OBJS:.o=.Po) \ + $(TEST_BODY) $(BODY_OBJS) $(BODY_OBJS:.o=.Po) \ + $(TEST_BUFFER) $(BUFFER_OBJS) $(BUFFER_OBJS:.o=.Po) \ $(TEST_CHARSET) $(CHARSET_OBJS) $(CHARSET_OBJS:.o=.Po) \ $(TEST_CONFIG) $(CONFIG_OBJS) $(CONFIG_OBJS:.o=.Po) \ $(TEST_DATE) $(DATE_OBJS) $(DATE_OBJS:.o=.Po) \ @@ -655,6 +671,9 @@ ATTACH_DEPFILES = $(ATTACH_OBJS:.o=.Po) BASE64_DEPFILES = $(BASE64_OBJS:.o=.Po) -include $(BASE64_DEPFILES) +BODY_DEPFILES = $(BODY_OBJS:.o=.Po) +-include $(BODY_DEPFILES) + BUFFER_DEPFILES = $(BUFFER_OBJS:.o=.Po) -include $(BUFFER_DEPFILES) diff --git a/test/body/main.c b/test/body/main.c new file mode 100644 index 000000000..f503717e3 --- /dev/null +++ b/test/body/main.c @@ -0,0 +1,46 @@ +/** + * @file + * Test code for body 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_body_cmp_strict) \ + NEOMUTT_TEST_ITEM(test_mutt_body_free) \ + NEOMUTT_TEST_ITEM(test_mutt_body_new) + +/****************************************************************************** + * 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/body/mutt_body_cmp_strict.c b/test/body/mutt_body_cmp_strict.c new file mode 100644 index 000000000..ce7314810 --- /dev/null +++ b/test/body/mutt_body_cmp_strict.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_body_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_body_cmp_strict(void) +{ + // bool mutt_body_cmp_strict(const struct Body *b1, const struct Body *b2); +} diff --git a/test/body/mutt_body_free.c b/test/body/mutt_body_free.c new file mode 100644 index 000000000..d230a8746 --- /dev/null +++ b/test/body/mutt_body_free.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_body_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_body_free(void) +{ + // void mutt_body_free(struct Body **p); +} diff --git a/test/body/mutt_body_new.c b/test/body/mutt_body_new.c new file mode 100644 index 000000000..2adeeec13 --- /dev/null +++ b/test/body/mutt_body_new.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_body_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_body_new(void) +{ + // struct Body *mutt_body_new(void); +}