]> granicus.if.org Git - neomutt/commitdiff
test: templates for base64 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 09:49:16 +0000 (10:49 +0100)
.gitignore
test/Makefile.autosetup
test/base64/main.c [new file with mode: 0644]
test/base64/mutt_b64_buffer_decode.c [new file with mode: 0644]
test/base64/mutt_b64_buffer_encode.c [new file with mode: 0644]
test/base64/mutt_b64_decode.c [new file with mode: 0644]
test/base64/mutt_b64_encode.c [new file with mode: 0644]

index a1e68392b9b7fdf50b938dc21304a853526dd346..4c81b89e156129c225d1d2217cdba84629bde50e 100644 (file)
@@ -11,6 +11,7 @@ doc/makedoc
 neomutt
 pgpewrap
 test/address-test
+test/base64-test
 test/config-test
 test/group-test
 test/idna-test
index e2cd249586337d7614071ff173ce5c0fa0e06a68..39b421f89896b9153dac8a817b36a14049fa9716 100644 (file)
@@ -35,6 +35,12 @@ ADDRESS_OBJS = test/address/main.o \
                  test/address/mutt_addr_write.o \
                  test/address/mutt_addr_write_single.o
 
+BASE64_OBJS    = test/base64/main.o \
+                 test/base64/mutt_b64_buffer_decode.o \
+                 test/base64/mutt_b64_buffer_encode.o \
+                 test/base64/mutt_b64_decode.o \
+                 test/base64/mutt_b64_encode.o
+
 CONFIG_OBJS    = test/config/main.o test/config/account.o \
                  test/config/address.o test/config/bool.o \
                  test/config/command.o test/config/common.o test/config/dump.o \
@@ -140,6 +146,8 @@ TEST_BINARY = test/neomutt-test$(EXEEXT)
 
 TEST_ADDRESS = test/address-test$(EXEEXT)
 
+TEST_BASE64 = test/base64-test$(EXEEXT)
+
 TEST_CONFIG = test/config-test$(EXEEXT)
 
 TEST_GROUP = test/group-test$(EXEEXT)
@@ -153,9 +161,10 @@ TEST_PATTERN = test/pattern-test$(EXEEXT)
 TEST_STRING = test/string-test$(EXEEXT)
 
 .PHONY: test
-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_CONFIG) $(TEST_GROUP) $(TEST_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
+test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_CONFIG) $(TEST_GROUP) $(TEST_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
+       $(TEST_BASE64)
        $(TEST_CONFIG)
        $(TEST_GROUP)
        $(TEST_IDNA)
@@ -169,6 +178,9 @@ $(TEST_BINARY): $(TEST_OBJS) $(MUTTLIBS)
 $(TEST_ADDRESS): $(PWD)/test/address $(ADDRESS_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(ADDRESS_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_BASE64): $(PWD)/test/base64 $(BASE64_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(BASE64_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_CONFIG): $(PWD)/test/config $(CONFIG_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(CONFIG_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -190,6 +202,9 @@ $(TEST_STRING): $(PWD)/test/string $(STRING_OBJS) $(MUTTLIBS)
 $(PWD)/test/address:
        $(MKDIR_P) $(PWD)/test/address
 
+$(PWD)/test/base64:
+       $(MKDIR_P) $(PWD)/test/base64
+
 $(PWD)/test/config:
        $(MKDIR_P) $(PWD)/test/config
 
@@ -208,11 +223,12 @@ $(PWD)/test/pattern:
 $(PWD)/test/string:
        $(MKDIR_P) $(PWD)/test/string
 
-all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_CONFIG) $(TEST_GROUP) $(TEST_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
+all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_CONFIG) $(TEST_GROUP) $(TEST_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
              $(TEST_ADDRESS) $(ADDRESS_OBJS) $(ADDRESS_OBJS:.o=.Po) \
+             $(TEST_BASE64) $(BASE64_OBJS) $(BASE64_OBJS:.o=.Po) \
              $(TEST_CONFIG) $(CONFIG_OBJS) $(CONFIG_OBJS:.o=.Po) \
              $(TEST_GROUP) $(GROUP_OBJS) $(GROUP_OBJS:.o=.Po) \
              $(TEST_IDNA) $(IDNA_OBJS) $(IDNA_OBJS:.o=.Po) \
@@ -229,6 +245,9 @@ TEST_DEPFILES = $(TEST_OBJS:.o=.Po)
 ADDRESS_DEPFILES = $(ADDRESS_OBJS:.o=.Po)
 -include $(ADDRESS_DEPFILES)
 
+BASE64_DEPFILES = $(BASE64_OBJS:.o=.Po)
+-include $(BASE64_DEPFILES)
+
 CONFIG_DEPFILES = $(CONFIG_OBJS:.o=.Po)
 -include $(CONFIG_DEPFILES)
 
diff --git a/test/base64/main.c b/test/base64/main.c
new file mode 100644 (file)
index 0000000..b96b175
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+ * @file
+ * Test code for base64 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_b64_buffer_decode)                               \
+  NEOMUTT_TEST_ITEM(test_mutt_b64_buffer_encode)                               \
+  NEOMUTT_TEST_ITEM(test_mutt_b64_decode)                                      \
+  NEOMUTT_TEST_ITEM(test_mutt_b64_encode)
+
+/******************************************************************************
+ * 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/base64/mutt_b64_buffer_decode.c b/test/base64/mutt_b64_buffer_decode.c
new file mode 100644 (file)
index 0000000..24be5b2
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_b64_buffer_decode()
+ *
+ * @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_b64_buffer_decode(void)
+{
+  // int mutt_b64_buffer_decode(struct Buffer *buf, const char *in);
+}
diff --git a/test/base64/mutt_b64_buffer_encode.c b/test/base64/mutt_b64_buffer_encode.c
new file mode 100644 (file)
index 0000000..ac1032e
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_b64_buffer_encode()
+ *
+ * @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_b64_buffer_encode(void)
+{
+  // size_t mutt_b64_buffer_encode(struct Buffer *buf, const char *in, size_t len);
+}
diff --git a/test/base64/mutt_b64_decode.c b/test/base64/mutt_b64_decode.c
new file mode 100644 (file)
index 0000000..7693181
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_b64_decode()
+ *
+ * @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_b64_decode(void)
+{
+  // int mutt_b64_decode(const char *in, char *out, size_t olen);
+}
diff --git a/test/base64/mutt_b64_encode.c b/test/base64/mutt_b64_encode.c
new file mode 100644 (file)
index 0000000..6ae4898
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_b64_encode()
+ *
+ * @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_b64_encode(void)
+{
+  // size_t mutt_b64_encode(const char *in, size_t inlen, char *out, size_t outlen);
+}