diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-10-01 21:55:35 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-10-01 21:55:35 +0800 |
commit | b1c77551dce9570b8a7fb6baeef0e17e23f3dda0 (patch) | |
tree | 2fc878c5b00f1ecb2a1b59281a2e471e5f07700b /csrc/mkf | |
parent | 6736d6764ba2541eeaa48b45b002acadb20b9b05 (diff) | |
download | rich4-b1c77551dce9570b8a7fb6baeef0e17e23f3dda0.tar.xz |
add dump1 test
Diffstat (limited to 'csrc/mkf')
-rw-r--r-- | csrc/mkf/test/data1.sha1 | 11 | ||||
-rw-r--r-- | csrc/mkf/test/data1_graph_info.txt | 11 | ||||
-rw-r--r-- | csrc/mkf/test/dump1.c | 28 | ||||
-rwxr-xr-x | csrc/mkf/test/runtest.sh | 10 |
4 files changed, 58 insertions, 2 deletions
diff --git a/csrc/mkf/test/data1.sha1 b/csrc/mkf/test/data1.sha1 new file mode 100644 index 0000000..56bb0b1 --- /dev/null +++ b/csrc/mkf/test/data1.sha1 @@ -0,0 +1,11 @@ +d0c4b59b19e1f36f164a0a0a97ccae102ee5efe9 data1.00.data +eb232db5bb98434f7a6c5ae3740082df66292913 data1.01.data +019731df3bf221e0287bf0675ed1ef87ccc072d1 data1.02.data +bb6d61a6665e98060bf2923366448229ed049c9f data1.03.data +0a9700f7565a8b57c500cdfb427217b1ccfe598c data1.04.data +c1e4f9931ddd0d287a7357b5dd35c0818f55a2c3 data1.05.data +2279f987fcb0b8156a0c1f7e09b89506df4b2f7c data1.06.data +4662b97408d03553e99ad43c1897a99d8ef33d94 data1.07.data +456eb7147784ddf3e2c9afdb9ff9ea36a18b70d7 data1.08.data +3a96b833397ebfaf30444953a074626c7e39aedc data1.09.data +c6912ae65d6c299b3bb765ef33baf1f5576573ff data1.10.data diff --git a/csrc/mkf/test/data1_graph_info.txt b/csrc/mkf/test/data1_graph_info.txt new file mode 100644 index 0000000..b7ff398 --- /dev/null +++ b/csrc/mkf/test/data1_graph_info.txt @@ -0,0 +1,11 @@ +width = 640, height = 480, x = 0, y = 0 +width = 108, height = 105, x = 55, y = 53 +width = 116, height = 113, x = 59, y = 57 +width = 107, height = 92, x = 51, y = 51 +width = 114, height = 99, x = 55, y = 54 +width = 98, height = 90, x = 51, y = 42 +width = 103, height = 98, x = 53, y = 46 +width = 53, height = 18, x = 27, y = 9 +width = 58, height = 19, x = 29, y = 10 +width = 76, height = 91, x = 37, y = 45 +width = 90, height = 107, x = 45, y = 52 diff --git a/csrc/mkf/test/dump1.c b/csrc/mkf/test/dump1.c new file mode 100644 index 0000000..072d95b --- /dev/null +++ b/csrc/mkf/test/dump1.c @@ -0,0 +1,28 @@ +/* gcc -m32 -I.. dump1.c ../mkf.c ../mkf_decompress.c -o dump1 */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "mkf.h" + +int pixel_fmt = 1; + +int main(int argc, char *argv[]) +{ + int mkf = load_mkf("Data.mkf"); + struct spr_smp *data1 = (struct spr_smp*)read_mkf(mkf, 1, NULL, NULL); + + for (int i = 0; i < data1->nchunk; i++) { + struct graph_st *gi = &data1->chunk_tab[i]; + printf("width = %hd, height = %hd, x = %hd, y = %hd\n", + gi->width, gi->height, gi->x, gi->y); + + char fn[16]; + sprintf(fn, "data1.%02d.data", i); + FILE *fp = fopen(fn, "wb"); + fwrite(gi->gdata, 1, gi->width * gi->height * 2, fp); + fclose(fp); + } + free(data1); + unload_mkf(mkf); +} diff --git a/csrc/mkf/test/runtest.sh b/csrc/mkf/test/runtest.sh index a4252a8..29d30b2 100755 --- a/csrc/mkf/test/runtest.sh +++ b/csrc/mkf/test/runtest.sh @@ -4,12 +4,18 @@ set -e TESTDIR=/tmp/rich4.test mkdir -p ${TESTDIR} -gcc -m32 -DMKF_INFO=1 -I.. dump_data.c ../mkf.c ../mkf_decompress.c -o dump_data +gcc -m32 -DMKF_INFO=1 -I.. dump_data.c ../mkf.c ../mkf_decompress.c -o "${TESTDIR}/dump_data" +gcc -m32 -I.. dump1.c ../mkf.c ../mkf_decompress.c -o "${TESTDIR}/dump1" if sha1sum -c Data.mkf.sha1 then - cp Data.mkf dump_data mkfdata.sha1 ${TESTDIR} + cp Data.mkf mkfdata.sha1 data1.sha1 data1_graph_info.txt ${TESTDIR} cd ${TESTDIR} ./dump_data --no-smp-spr sha1sum -c mkfdata.sha1 + echo "Data.mkf dumping tested." + ./dump1 > info.txt + sha1sum -c data1.sha1 + diff info.txt data1_graph_info.txt + echo "First mkf datum of Data.mkf dumping tested." fi |