]> granicus.if.org Git - neomutt/commitdiff
test: templates for sha1 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/sha1/main.c [new file with mode: 0644]
test/sha1/mutt_sha1_final.c [new file with mode: 0644]
test/sha1/mutt_sha1_init.c [new file with mode: 0644]
test/sha1/mutt_sha1_transform.c [new file with mode: 0644]
test/sha1/mutt_sha1_update.c [new file with mode: 0644]

index 53b403d5be84d0bd3c822b06d14b653b245127c5..bfe81e5a13256f93fe78393674b0189743bb243a 100644 (file)
@@ -32,6 +32,7 @@ test/neomutt-test
 test/path-test
 test/pattern-test
 test/regex-test
+test/sha1-test
 test/string-test
 
 # Build products
index bdd1e30fb0f41c4ca9b9052e435c0b332180c175..637a23b7fe8e165dfcd1db179bd82b2fb617cece 100644 (file)
@@ -305,6 +305,12 @@ REGEX_OBJS = test/regex/main.o \
                  test/regex/mutt_replacelist_new.o \
                  test/regex/mutt_replacelist_remove.o
 
+SHA1_OBJS      = test/sha1/main.o \
+                 test/sha1/mutt_sha1_final.o \
+                 test/sha1/mutt_sha1_init.o \
+                 test/sha1/mutt_sha1_transform.o \
+                 test/sha1/mutt_sha1_update.o
+
 STRING_OBJS    = test/string/main.o \
                  test/string/mutt_str_adjust.o \
                  test/string/mutt_str_append_item.o \
@@ -399,10 +405,12 @@ TEST_PATTERN = test/pattern-test$(EXEEXT)
 
 TEST_REGEX = test/regex-test$(EXEEXT)
 
+TEST_SHA1 = test/sha1-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_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(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_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
        $(TEST_BASE64)
@@ -424,6 +432,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSE
        $(TEST_PATH)
        $(TEST_PATTERN)
        $(TEST_REGEX)
+       $(TEST_SHA1)
        $(TEST_STRING)
 
 $(TEST_BINARY): $(TEST_OBJS) $(MUTTLIBS)
@@ -492,6 +501,9 @@ $(TEST_PATTERN): $(PWD)/test/pattern $(PATTERN_OBJS) $(MUTTLIBS)
 $(TEST_REGEX): $(PWD)/test/regex $(REGEX_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(REGEX_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_SHA1): $(PWD)/test/sha1 $(SHA1_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(SHA1_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_STRING): $(PWD)/test/string $(STRING_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(STRING_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -558,10 +570,13 @@ $(PWD)/test/pattern:
 $(PWD)/test/regex:
        $(MKDIR_P) $(PWD)/test/regex
 
+$(PWD)/test/sha1:
+       $(MKDIR_P) $(PWD)/test/sha1
+
 $(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_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(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_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
@@ -585,6 +600,7 @@ clean-test:
              $(TEST_PATH) $(PATH_OBJS) $(PATH_OBJS:.o=.Po) \
              $(TEST_PATTERN) $(PATTERN_OBJS) $(PATTERN_OBJS:.o=.Po) \
              $(TEST_REGEX) $(REGEX_OBJS) $(REGEX_OBJS:.o=.Po) \
+             $(TEST_SHA1) $(SHA1_OBJS) $(SHA1_OBJS:.o=.Po) \
              $(TEST_STRING) $(STRING_OBJS) $(STRING_OBJS:.o=.Po)
 
 install-test:
@@ -656,6 +672,9 @@ PATTERN_DEPFILES = $(PATTERN_OBJS:.o=.Po)
 REGEX_DEPFILES = $(REGEX_OBJS:.o=.Po)
 -include $(REGEX_DEPFILES)
 
+SHA1_DEPFILES = $(SHA1_OBJS:.o=.Po)
+-include $(SHA1_DEPFILES)
+
 STRING_DEPFILES = $(STRING_OBJS:.o=.Po)
 -include $(STRING_DEPFILES)
 
diff --git a/test/sha1/main.c b/test/sha1/main.c
new file mode 100644 (file)
index 0000000..049f811
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+ * @file
+ * Test code for sha1 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_sha1_final)                                      \
+  NEOMUTT_TEST_ITEM(test_mutt_sha1_init)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_sha1_transform)                                  \
+  NEOMUTT_TEST_ITEM(test_mutt_sha1_update)
+
+/******************************************************************************
+ * 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/sha1/mutt_sha1_final.c b/test/sha1/mutt_sha1_final.c
new file mode 100644 (file)
index 0000000..b783496
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sha1_final()
+ *
+ * @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_sha1_final(void)
+{
+  // void mutt_sha1_final(unsigned char digest[20], struct Sha1Ctx *sha1ctx);
+}
diff --git a/test/sha1/mutt_sha1_init.c b/test/sha1/mutt_sha1_init.c
new file mode 100644 (file)
index 0000000..3ace0f5
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sha1_init()
+ *
+ * @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_sha1_init(void)
+{
+  // void mutt_sha1_init(struct Sha1Ctx *sha1ctx);
+}
diff --git a/test/sha1/mutt_sha1_transform.c b/test/sha1/mutt_sha1_transform.c
new file mode 100644 (file)
index 0000000..5a6f58e
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sha1_transform()
+ *
+ * @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_sha1_transform(void)
+{
+  // void mutt_sha1_transform(uint32_t state[5], const unsigned char buffer[64]);
+}
diff --git a/test/sha1/mutt_sha1_update.c b/test/sha1/mutt_sha1_update.c
new file mode 100644 (file)
index 0000000..1254df8
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_sha1_update()
+ *
+ * @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_sha1_update(void)
+{
+  // void mutt_sha1_update(struct Sha1Ctx *sha1ctx, const unsigned char *data, uint32_t len);
+}