This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, generate has been updated via 8a3762309b457c34c0da176d12b3bc76e2f486e9 (commit) from 4d23481d197e7e0187bff3b2e9002d76d96497bb (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/8a3762309b457c34c0da176d12b3bc76e2f48...
commit 8a3762309b457c34c0da176d12b3bc76e2f486e9 Author: Cyril Hrubis metan@ucw.cz Date: Sun Aug 21 11:34:47 2011 +0200
Quick and dirty tests for GP_WritePixel (byte aligned pixels only).
diff --git a/tests/core/GP_WritePixel.test.gen.c.t b/tests/core/GP_WritePixel.test.gen.c.t new file mode 100644 index 0000000..902a8b7 --- /dev/null +++ b/tests/core/GP_WritePixel.test.gen.c.t @@ -0,0 +1,71 @@ +%% extends "base.test.c.t" + +%% block body +#include "GP_Tests.h" +#include "GP_WritePixel.h" +#include "GP_TestingCore.h" + +GP_SUITE(GP_WritePixel) + +static void dump_buffer(const char *name, char *buf, unsigned int buf_len) +{ + unsigned int i; + + printf("%s = {", name); + + for (i = 0; i < buf_len; i++) { + printf("0x%02x", buf[i]); + if (i != buf_len - 1) + printf(", "); + } + + printf("}n"); +} + +/* + * Compares two statically defined buffers + */ +#define COMPARE_BUFFERS(buf1, buf2) do { + unsigned int buf1_len = sizeof(buf1)/sizeof(*buf1); + unsigned int buf2_len = sizeof(buf2)/sizeof(*buf2); + unsigned int i; + + fail_unless(buf1_len == buf2_len); + + for (i = 0; i < buf1_len; i++) + if(buf1[i] != buf2[i]) { + dump_buffer("write", buf1, buf1_len); + dump_buffer("gen ", buf2, buf2_len); + fail("buffers are different"); + } +} while (0) + +%% for pixelsize in [8, 16, 24, 32] +%% for offset in range(0, 4) +%% for len in range(0, 4) +%% for aligment in [0, 1] +GP_TEST(GP_WritePixel{{ "%i_%i_%i_%i"|format(pixelsize, offset, len, aligment) }}, {{ ""offset=%i len=%i aligment=%i""|format(offset, len, aligment) }}) +{ + char write_buf[{{ 9 * pixelsize//8 }}] = {}; + char gen_buf[{{9 * pixelsize//8 }}] = {}; + + /* + * Fill the compare buffer + */ +%% for i in range(0, len) +%% for j in range(0, pixelsize//8) + gen_buf[{{aligment + offset * pixelsize//8 + i * pixelsize//8 + j}}] = 0xff; +%% endfor +%% endfor + + GP_WritePixels{{ pixelsize }}bpp(write_buf + {{aligment + offset * pixelsize//8}}, {{ len }}, 0xffffffff>>{{32 - pixelsize}}); + + COMPARE_BUFFERS(write_buf, gen_buf); +} +GP_ENDTEST +%% endfor +%% endfor +%% endfor +%% endfor + +%% endblock body diff --git a/tests/core/Makefile b/tests/core/Makefile index c03633a..00e696e 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -3,7 +3,7 @@ TOPDIR=../.. LIBNAME=core TESTSUITE=core_suite LDLIBS+=-lGP -L$(TOPDIR)/build/ -lcheck -GENSOURCES+=GP_Convert.test.gen.c +GENSOURCES+=GP_Convert.test.gen.c GP_WritePixel.test.gen.c
include $(TOPDIR)/tests.mk include $(TOPDIR)/include.mk
-----------------------------------------------------------------------
Summary of changes: tests/core/GP_WritePixel.test.gen.c.t | 71 +++++++++++++++++++++++++++++++++ tests/core/Makefile | 2 +- 2 files changed, 72 insertions(+), 1 deletions(-) create mode 100644 tests/core/GP_WritePixel.test.gen.c.t
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.