Add cdh test
This commit is contained in:
parent
e04a231974
commit
ac658859aa
2 changed files with 28 additions and 0 deletions
2
tests/CMakeLists.txt
Normal file
2
tests/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
add_executable(get_cdh ${CMAKE_CURRENT_SOURCE_DIR}/test_get_cdh.c)
|
||||||
|
target_link_libraries(get_cdh PUBLIC libmineziper)
|
||||||
26
tests/test_get_cdh.c
Normal file
26
tests/test_get_cdh.c
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "libmineziper_zip.h"
|
||||||
|
|
||||||
|
#define BUF_SIZE 10000
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
FILE* stream = fopen(argv[1], "r");
|
||||||
|
if (stream == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Cannot open file for writing\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buf[BUF_SIZE + 1];
|
||||||
|
zip zip;
|
||||||
|
raw raw;
|
||||||
|
|
||||||
|
raw.size = fread(buf, BUF_SIZE, 1, stream);
|
||||||
|
buf[BUF_SIZE] = '\0';
|
||||||
|
raw.buf = buf;
|
||||||
|
|
||||||
|
find_cdh(&raw, &zip);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue