]> granicus.if.org Git - neomutt/commitdiff
test: templates for md5 functions
authorRichard Russon <rich@flatcap.org>
Sun, 28 Apr 2019 11:37:15 +0000 (12:37 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 10:22:04 +0000 (11:22 +0100)
.gitignore
test/Makefile.autosetup
test/md5/main.c [new file with mode: 0644]
test/md5/mutt_md5.c [new file with mode: 0644]
test/md5/mutt_md5_bytes.c [new file with mode: 0644]
test/md5/mutt_md5_finish_ctx.c [new file with mode: 0644]
test/md5/mutt_md5_init_ctx.c [new file with mode: 0644]
test/md5/mutt_md5_process.c [new file with mode: 0644]
test/md5/mutt_md5_process_bytes.c [new file with mode: 0644]
test/md5/mutt_md5_toascii.c [new file with mode: 0644]

index 81eb9bd16b9b1888a19a19d6ad68ea7f7c55673d..e3c9f04f7ca3601454683648b3b957de8b133a75 100644 (file)
@@ -26,6 +26,7 @@ test/list-test
 test/logging-test
 test/mapping-test
 test/mbyte-test
+test/md5-test
 test/neomutt-test
 test/path-test
 test/pattern-test
index fd2cb9932ce22efeea952ff0129d5df444ba20ce..5d3eea02c2c11fbe3ffb46047c381153401d124e 100644 (file)
@@ -251,6 +251,15 @@ MBYTE_OBJS = test/mbyte/main.o \
                  test/mbyte/mutt_mb_width.o \
                  test/mbyte/mutt_mb_width_ceiling.o
 
+MD5_OBJS       = test/md5/main.o \
+                 test/md5/mutt_md5_bytes.o \
+                 test/md5/mutt_md5.o \
+                 test/md5/mutt_md5_finish_ctx.o \
+                 test/md5/mutt_md5_init_ctx.o \
+                 test/md5/mutt_md5_process_bytes.o \
+                 test/md5/mutt_md5_process.o \
+                 test/md5/mutt_md5_toascii.o
+
 PATH_OBJS      = test/path/main.o \
                  test/path/mutt_path_abbr_folder.o \
                  test/path/mutt_path_basename.o \
@@ -358,6 +367,8 @@ TEST_MAPPING = test/mapping-test$(EXEEXT)
 
 TEST_MBYTE = test/mbyte-test$(EXEEXT)
 
+TEST_MD5 = test/md5-test$(EXEEXT)
+
 TEST_PATH = test/path-test$(EXEEXT)
 
 TEST_PATTERN = test/pattern-test$(EXEEXT)
@@ -365,7 +376,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_MAPPING) $(TEST_MBYTE) $(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_MBYTE) $(TEST_MD5) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
        $(TEST_BASE64)
@@ -382,6 +393,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSE
        $(TEST_LOGGING)
        $(TEST_MAPPING)
        $(TEST_MBYTE)
+       $(TEST_MD5)
        $(TEST_PATH)
        $(TEST_PATTERN)
        $(TEST_STRING)
@@ -437,6 +449,9 @@ $(TEST_MAPPING): $(PWD)/test/mapping $(MAPPING_OBJS) $(MUTTLIBS)
 $(TEST_MBYTE): $(PWD)/test/mbyte $(MBYTE_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(MBYTE_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_MD5): $(PWD)/test/md5 $(MD5_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(MD5_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_PATH): $(PWD)/test/path $(PATH_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(PATH_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -494,6 +509,9 @@ $(PWD)/test/mapping:
 $(PWD)/test/mbyte:
        $(MKDIR_P) $(PWD)/test/mbyte
 
+$(PWD)/test/md5:
+       $(MKDIR_P) $(PWD)/test/md5
+
 $(PWD)/test/path:
        $(MKDIR_P) $(PWD)/test/path
 
@@ -503,7 +521,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_MAPPING) $(TEST_MBYTE) $(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_MBYTE) $(TEST_MD5) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
@@ -522,6 +540,7 @@ clean-test:
              $(TEST_LOGGING) $(LOGGING_OBJS) $(LOGGING_OBJS:.o=.Po) \
              $(TEST_MAPPING) $(MAPPING_OBJS) $(MAPPING_OBJS:.o=.Po) \
              $(TEST_MBYTE) $(MBYTE_OBJS) $(MBYTE_OBJS:.o=.Po) \
+             $(TEST_MD5) $(MD5_OBJS) $(MD5_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)
@@ -580,6 +599,9 @@ MAPPING_DEPFILES = $(MAPPING_OBJS:.o=.Po)
 MBYTE_DEPFILES = $(MBYTE_OBJS:.o=.Po)
 -include $(MBYTE_DEPFILES)
 
+MD5_DEPFILES = $(MD5_OBJS:.o=.Po)
+-include $(MD5_DEPFILES)
+
 PATH_DEPFILES = $(PATH_OBJS:.o=.Po)
 -include $(PATH_DEPFILES)
 
diff --git a/test/md5/main.c b/test/md5/main.c
new file mode 100644 (file)
index 0000000..c444152
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * @file
+ * Test code for md5 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_md5_bytes)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_md5)                                             \
+  NEOMUTT_TEST_ITEM(test_mutt_md5_finish_ctx)                                  \
+  NEOMUTT_TEST_ITEM(test_mutt_md5_init_ctx)                                    \
+  NEOMUTT_TEST_ITEM(test_mutt_md5_process_bytes)                               \
+  NEOMUTT_TEST_ITEM(test_mutt_md5_process)                                     \
+  NEOMUTT_TEST_ITEM(test_mutt_md5_toascii)
+
+/******************************************************************************
+ * 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/md5/mutt_md5.c b/test/md5/mutt_md5.c
new file mode 100644 (file)
index 0000000..979313a
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_md5()
+ *
+ * @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"
+
+void test_mutt_md5(void)
+{
+  // void *mutt_md5(const char *str, void *buf);
+}
diff --git a/test/md5/mutt_md5_bytes.c b/test/md5/mutt_md5_bytes.c
new file mode 100644 (file)
index 0000000..902aa8b
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_md5_bytes()
+ *
+ * @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"
+
+void test_mutt_md5_bytes(void)
+{
+  // void *mutt_md5_bytes(const void *buffer, size_t len, void *resbuf);
+}
diff --git a/test/md5/mutt_md5_finish_ctx.c b/test/md5/mutt_md5_finish_ctx.c
new file mode 100644 (file)
index 0000000..171cce5
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_md5_finish_ctx()
+ *
+ * @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"
+
+void test_mutt_md5_finish_ctx(void)
+{
+  // void *mutt_md5_finish_ctx(struct Md5Ctx *md5ctx, void *resbuf);
+}
diff --git a/test/md5/mutt_md5_init_ctx.c b/test/md5/mutt_md5_init_ctx.c
new file mode 100644 (file)
index 0000000..899bab6
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_md5_init_ctx()
+ *
+ * @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"
+
+void test_mutt_md5_init_ctx(void)
+{
+  // void mutt_md5_init_ctx(struct Md5Ctx *md5ctx);
+}
diff --git a/test/md5/mutt_md5_process.c b/test/md5/mutt_md5_process.c
new file mode 100644 (file)
index 0000000..5b4a74c
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_md5_process()
+ *
+ * @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"
+
+void test_mutt_md5_process(void)
+{
+  // void mutt_md5_process(const char *str, struct Md5Ctx *md5ctx);
+}
diff --git a/test/md5/mutt_md5_process_bytes.c b/test/md5/mutt_md5_process_bytes.c
new file mode 100644 (file)
index 0000000..342c268
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_md5_process_bytes()
+ *
+ * @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"
+
+void test_mutt_md5_process_bytes(void)
+{
+  // void mutt_md5_process_bytes(const void *buffer, size_t len, struct Md5Ctx *md5ctx);
+}
diff --git a/test/md5/mutt_md5_toascii.c b/test/md5/mutt_md5_toascii.c
new file mode 100644 (file)
index 0000000..7dbaf00
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_md5_toascii()
+ *
+ * @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"
+
+void test_mutt_md5_toascii(void)
+{
+  // void mutt_md5_toascii(const void *digest, char *resbuf);
+}