From: Richard Russon Date: Sun, 28 Apr 2019 11:37:15 +0000 (+0100) Subject: test: templates for mapping functions X-Git-Tag: 2019-10-25~233^2~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e9f8831ab0698be2a99820ada75e9f789ed653e;p=neomutt test: templates for mapping functions --- diff --git a/.gitignore b/.gitignore index 97736b0ca..f7f1b036d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ test/history-test test/idna-test test/list-test test/logging-test +test/mapping-test test/neomutt-test test/path-test test/pattern-test diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index 9492a564a..7e68202b5 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -233,6 +233,10 @@ LOGGING_OBJS = test/logging/main.o \ test/logging/log_queue_save.o \ test/logging/log_queue_set_max_size.o +MAPPING_OBJS = test/mapping/main.o \ + test/mapping/mutt_map_get_name.o \ + test/mapping/mutt_map_get_value.o + PATH_OBJS = test/path/main.o \ test/path/mutt_path_abbr_folder.o \ test/path/mutt_path_basename.o \ @@ -336,6 +340,8 @@ TEST_LIST = test/list-test$(EXEEXT) TEST_LOGGING = test/logging-test$(EXEEXT) +TEST_MAPPING = test/mapping-test$(EXEEXT) + TEST_PATH = test/path-test$(EXEEXT) TEST_PATTERN = test/pattern-test$(EXEEXT) @@ -343,7 +349,7 @@ TEST_PATTERN = test/pattern-test$(EXEEXT) TEST_STRING = test/string-test$(EXEEXT) .PHONY: test -test: $(TEST_BINARY) $(TEST_ADDRESS) $(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_PATH) $(TEST_PATTERN) $(TEST_STRING) +test: $(TEST_BINARY) $(TEST_ADDRESS) $(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_PATH) $(TEST_PATTERN) $(TEST_STRING) $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) @@ -358,6 +364,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSE $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) + $(TEST_MAPPING) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING) @@ -407,6 +414,9 @@ $(TEST_LIST): $(PWD)/test/list $(LIST_OBJS) $(MUTTLIBS) $(TEST_LOGGING): $(PWD)/test/logging $(LOGGING_OBJS) $(MUTTLIBS) $(CC) -o $@ $(LOGGING_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) +$(TEST_MAPPING): $(PWD)/test/mapping $(MAPPING_OBJS) $(MUTTLIBS) + $(CC) -o $@ $(MAPPING_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) + $(TEST_PATH): $(PWD)/test/path $(PATH_OBJS) $(MUTTLIBS) $(CC) -o $@ $(PATH_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) @@ -458,6 +468,9 @@ $(PWD)/test/list: $(PWD)/test/logging: $(MKDIR_P) $(PWD)/test/logging +$(PWD)/test/mapping: + $(MKDIR_P) $(PWD)/test/mapping + $(PWD)/test/path: $(MKDIR_P) $(PWD)/test/path @@ -467,7 +480,7 @@ $(PWD)/test/pattern: $(PWD)/test/string: $(MKDIR_P) $(PWD)/test/string -all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(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_PATH) $(TEST_PATTERN) $(TEST_STRING) +all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(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_PATH) $(TEST_PATTERN) $(TEST_STRING) clean-test: $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \ @@ -484,6 +497,7 @@ clean-test: $(TEST_IDNA) $(IDNA_OBJS) $(IDNA_OBJS:.o=.Po) \ $(TEST_LIST) $(LIST_OBJS) $(LIST_OBJS:.o=.Po) \ $(TEST_LOGGING) $(LOGGING_OBJS) $(LOGGING_OBJS:.o=.Po) \ + $(TEST_MAPPING) $(MAPPING_OBJS) $(MAPPING_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) @@ -536,6 +550,9 @@ LIST_DEPFILES = $(LIST_OBJS:.o=.Po) LOGGING_DEPFILES = $(LOGGING_OBJS:.o=.Po) -include $(LOGGING_DEPFILES) +MAPPING_DEPFILES = $(MAPPING_OBJS:.o=.Po) +-include $(MAPPING_DEPFILES) + PATH_DEPFILES = $(PATH_OBJS:.o=.Po) -include $(PATH_DEPFILES) diff --git a/test/mapping/main.c b/test/mapping/main.c new file mode 100644 index 000000000..f299b9f69 --- /dev/null +++ b/test/mapping/main.c @@ -0,0 +1,44 @@ +/** + * @file + * Test code for mapping 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_map_get_name) \ + NEOMUTT_TEST_ITEM(test_mutt_map_get_value) + +/****************************************************************************** + * 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/mapping/mutt_map_get_name.c b/test/mapping/mutt_map_get_name.c new file mode 100644 index 000000000..2dee5e312 --- /dev/null +++ b/test/mapping/mutt_map_get_name.c @@ -0,0 +1,31 @@ +/** + * @file + * Test code for mutt_map_get_name() + * + * @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" + +void test_mutt_map_get_name(void) +{ + // const char *mutt_map_get_name(int val, const struct Mapping *map); +} diff --git a/test/mapping/mutt_map_get_value.c b/test/mapping/mutt_map_get_value.c new file mode 100644 index 000000000..f44aaae2d --- /dev/null +++ b/test/mapping/mutt_map_get_value.c @@ -0,0 +1,31 @@ +/** + * @file + * Test code for mutt_map_get_value() + * + * @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" + +void test_mutt_map_get_value(void) +{ + // int mutt_map_get_value(const char *name, const struct Mapping *map); +}