diff --git a/test/Makefile b/test/Makefile index 8f8e92b..22d8202 100644 --- a/test/Makefile +++ b/test/Makefile @@ -55,11 +55,15 @@ tests += init_file_sha1 tests += init_file_sha256 tests += store_file_md5 tests += load_file_md5 +tests += store_file_sha1 +tests += load_file_sha1 +tests += store_file_sha256 +tests += load_file_sha256 total != echo $(tests) | wc -w | awk '{ print $$1 }' .PHONY: test test: $(tests) - @echo -e "\n\t\e[0;33mRunning $(total) tests\e[0m\n" + @echo -e "\n\t=== \e[0;33mRunning $(total) tests\e[0m ===\n" @idx=1 ; success=0 ; fail=0; for t in $(tests) ; \ do printf "[%02i/$(total)] \%-25s" $${idx} $${t} ; \ idx=$$(expr $${idx} + 1) ; \ diff --git a/test/load_file_sha1.c b/test/load_file_sha1.c new file mode 100644 index 0000000..5fc69ac --- /dev/null +++ b/test/load_file_sha1.c @@ -0,0 +1,16 @@ +#include "haggis_private.h" +#include +#include +#include + +int main() { + haggis_file hf; + char *f = "output/store_file_sha1"; + FILE *fd; + int res; + + fd = fopen(f, "r"); + res = haggis_load_file(fd, &hf); + fclose(fd); + return res; +} diff --git a/test/load_file_sha256.c b/test/load_file_sha256.c new file mode 100644 index 0000000..525a70c --- /dev/null +++ b/test/load_file_sha256.c @@ -0,0 +1,16 @@ +#include "haggis_private.h" +#include +#include +#include + +int main() { + haggis_file hf; + char *f = "output/store_file_sha256"; + FILE *fd; + int res; + + fd = fopen(f, "r"); + res = haggis_load_file(fd, &hf); + fclose(fd); + return res; +} diff --git a/test/store_file_sha1.c b/test/store_file_sha1.c new file mode 100644 index 0000000..a530a15 --- /dev/null +++ b/test/store_file_sha1.c @@ -0,0 +1,23 @@ +#include "haggis_private.h" +#include +#include + +#if defined(__FreeBSD__) || defined(__DragonFly__) +#include +#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__LINUX__) +#include +#endif + +int main() { + haggis_file hf; + char *f = "load_device.c"; + FILE *fd; + + assert(haggis_file_init(f, &hf, sha1) == 0); + fd = fopen("output/store_file_sha1", "w"); + assert(haggis_store_file(fd, &hf) == 0); + fflush(fd); + fclose(fd); + return 0; +} + diff --git a/test/store_file_sha256.c b/test/store_file_sha256.c new file mode 100644 index 0000000..62ce805 --- /dev/null +++ b/test/store_file_sha256.c @@ -0,0 +1,23 @@ +#include "haggis_private.h" +#include +#include + +#if defined(__FreeBSD__) || defined(__DragonFly__) +#include +#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__LINUX__) +#include +#endif + +int main() { + haggis_file hf; + char *f = "load_device.c"; + FILE *fd; + + assert(haggis_file_init(f, &hf, sha1) == 0); + fd = fopen("output/store_file_sha256", "w"); + assert(haggis_store_file(fd, &hf) == 0); + fflush(fd); + fclose(fd); + return 0; +} +