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, master has been updated
via 101233f4b4f483e4633302fe978f051ee5c4e472 (commit)
from 7d30cb21d991fc207b0cc99038494e647307a598 (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/101233f4b4f483e4633302fe978f051ee5c4…
commit 101233f4b4f483e4633302fe978f051ee5c4e472
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Oct 20 11:13:41 2012 +0200
tests: framework: Add UNTESTED test status.
diff --git a/tests/framework/test.c b/tests/framework/test.c
index f4a8692..ccef65d 100644
--- a/tests/framework/test.c
+++ b/tests/framework/test.c
@@ -186,11 +186,25 @@ int fail_FILE(void)
return TST_SUCCESS;
}
+/*
+ * This status is returned when the could not be started
+ * because of unsufficient configuration
+ */
static int skipped_fn(void)
{
return TST_SKIPPED;
}
+/*
+ * This status is returned when there was failure prior
+ * the actuall testing so we could not test the feature
+ * at all.
+ */
+static int untested_fn(void)
+{
+ return TST_UNTESTED;
+}
+
static int res_fn(void)
{
if (access("test.c", R_OK) == 0)
@@ -226,6 +240,7 @@ const struct tst_suite tst_suite = {
.tests = {
{.name = "Success test", .tst_fn = success_fn},
{.name = "Skipped test", .tst_fn = skipped_fn},
+ {.name = "Untested test", .tst_fn = untested_fn},
{.name = "Sigsegv test", .tst_fn = sigsegv_fn},
{.name = "Failed test", .tst_fn = failed_fn},
{.name = "Stack overflow test", .tst_fn = stack_overflow_fn},
diff --git a/tests/framework/tst_job.c b/tests/framework/tst_job.c
index a1f7272..8a0789b 100644
--- a/tests/framework/tst_job.c
+++ b/tests/framework/tst_job.c
@@ -77,6 +77,9 @@ static void stop_test(struct tst_job *job)
case TST_SKIPPED:
result = "[ e[1;30mSKIPPEDe[0m ]";
break;
+ case TST_UNTESTED:
+ result = "[ e[1;34mUNTESTEDe[0m ]";
+ break;
case TST_INTERR:
result = "[ e[1;31mINTERNAL ERRORe[0m ]";
break;
diff --git a/tests/framework/tst_log.c b/tests/framework/tst_log.c
index 772b20b..a70f8c0 100644
--- a/tests/framework/tst_log.c
+++ b/tests/framework/tst_log.c
@@ -36,6 +36,8 @@ static const char *ret_to_bg_color(enum tst_ret ret)
return "#008000";
case TST_SKIPPED:
return "#888888";
+ case TST_UNTESTED:
+ return "#0000bb";
case TST_INTERR:
return "#800000";
case TST_SIGSEGV:
@@ -64,6 +66,8 @@ static const char *ret_to_str(enum tst_ret ret)
return "Success";
case TST_SKIPPED:
return "Skipped";
+ case TST_UNTESTED:
+ return "Untested";
case TST_INTERR:
return "Internal Error";
case TST_SIGSEGV:
diff --git a/tests/framework/tst_test.h b/tests/framework/tst_test.h
index b9a0c17..c6ef4fe 100644
--- a/tests/framework/tst_test.h
+++ b/tests/framework/tst_test.h
@@ -24,15 +24,16 @@
#define TST_TEST_H
enum tst_ret {
- TST_SUCCESS, /* Test succedded */
- TST_SKIPPED, /* Test skipped due to not enough memory, ENOSYS ... */
- TST_INTERR, /* Test framework error */
- TST_SIGSEGV, /* Test ended with SIGSEGV */
- TST_TIMEOUT, /* Test hasn't finished in time */
- TST_ABORTED, /* The abort() was called (possible double free) */
- TST_FPE, /* Floating point exception */
- TST_MEMLEAK, /* Memory leak was detected */
- TST_FAILED, /* Test failed */
+ TST_SUCCESS, /* Test succedded */
+ TST_SKIPPED, /* Test skipped due to not enough memory, ENOSYS ... */
+ TST_UNTESTED, /* Test not finished because of failure */
+ TST_INTERR, /* Test framework error */
+ TST_SIGSEGV, /* Test ended with SIGSEGV */
+ TST_TIMEOUT, /* Test hasn't finished in time */
+ TST_ABORTED, /* The abort() was called (possible double free) */
+ TST_FPE, /* Floating point exception */
+ TST_MEMLEAK, /* Memory leak was detected */
+ TST_FAILED, /* Test failed */
TST_MAX = TST_FAILED+1,
};
-----------------------------------------------------------------------
Summary of changes:
tests/framework/test.c | 15 +++++++++++++++
tests/framework/tst_job.c | 3 +++
tests/framework/tst_log.c | 4 ++++
tests/framework/tst_test.h | 19 ++++++++++---------
4 files changed, 32 insertions(+), 9 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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, master has been updated
via 7d30cb21d991fc207b0cc99038494e647307a598 (commit)
from f5e28f46785b6f44488672e5a1a6a878137a44be (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/7d30cb21d991fc207b0cc99038494e647307…
commit 7d30cb21d991fc207b0cc99038494e647307a598
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Oct 20 00:17:14 2012 +0200
tests: framework: Fix benchmark JSON output.
diff --git a/tests/framework/tst_log.c b/tests/framework/tst_log.c
index b1e43b8..772b20b 100644
--- a/tests/framework/tst_log.c
+++ b/tests/framework/tst_log.c
@@ -341,7 +341,7 @@ static void append_benchmark_json(struct tst_job *job, FILE *f)
fprintf(f, "tttt"Iterations": %in", job->bench_iter);
- fprintf(f, "ttt}n");
+ fprintf(f, "ttt},n");
}
static int hack_json_start = 0;
-----------------------------------------------------------------------
Summary of changes:
tests/framework/tst_log.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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, master has been updated
via f5e28f46785b6f44488672e5a1a6a878137a44be (commit)
from a5f3ffffa6adc218386bcec41f5cd1ebe691a7df (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/f5e28f46785b6f44488672e5a1a6a878137a…
commit f5e28f46785b6f44488672e5a1a6a878137a44be
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Oct 19 23:30:11 2012 +0200
tests: core: Created GetPutPixel test.
diff --git a/tests/core/GetPutPixel.gen.c.t b/tests/core/GetPutPixel.gen.c.t
new file mode 100644
index 0000000..b462bce
--- /dev/null
+++ b/tests/core/GetPutPixel.gen.c.t
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim 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 *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+%% extends "base.test.c.t"
+
+%% block body
+
+#include <stdio.h>
+
+#include <core/GP_Context.h>
+#include <core/GP_GetPutPixel.h>
+
+#include "tst_test.h"
+
+static void fill_context(GP_Context *c, GP_Pixel p)
+{
+ GP_Coord x, y;
+
+ for (x = 0; x < c->w; x++)
+ for (y = 0; y < c->h; y++)
+ GP_PutPixel(c, x, y, p);
+}
+
+static int check_filled(GP_Context *c)
+{
+ GP_Coord x, y;
+ GP_Pixel p;
+
+ p = GP_GetPixel(c, 0, 0);
+
+ for (x = 0; x < c->w; x++)
+ for (y = 0; y < c->h; y++)
+ if (p != GP_GetPixel(c, x, y)) {
+ tst_report(0, "Pixels different %i %i", x, y);
+ return 1;
+ }
+
+ return 0;
+}
+
+static int try_pattern(GP_Context *c, GP_Pixel p)
+{
+ fill_context(c, p);
+
+ tst_report(0, "Filling pattern 0x%x", p);
+
+ if (check_filled(c))
+ return 1;
+
+ return 0;
+}
+
+%% for pt in pixeltypes
+%% if not pt.is_unknown()
+static int GetPutPixel_{{ pt.name }}(void)
+{
+ GP_Context *c;
+ int err = 0;
+
+ c = GP_ContextAlloc(100, 100, GP_PIXEL_{{ pt.name }});
+
+ if (c == NULL) {
+ tst_report(0, "GP_ContextAlloc() failed");
+ return TST_FAILED;
+ }
+
+ if (try_pattern(c, 0x55555555 & {{ 2 ** pt.pixelsize.size - 1}}))
+ err++;
+
+ if (try_pattern(c, 0xaaaaaaaa & {{ 2 ** pt.pixelsize.size - 1}}))
+ err++;
+
+ if (try_pattern(c, 0x0f0f0f0f & {{ 2 ** pt.pixelsize.size - 1}}))
+ err++;
+
+ if (try_pattern(c, 0xf0f0f0f0 & {{ 2 ** pt.pixelsize.size - 1}}))
+ err++;
+
+ GP_ContextFree(c);
+
+ if (err)
+ return TST_FAILED;
+
+ return TST_SUCCESS;
+}
+%% endif
+%% endfor
+
+const struct tst_suite tst_suite = {
+ .suite_name = "GetPutPixel Testsuite",
+ .tests = {
+%% for pt in pixeltypes
+%% if not pt.is_unknown()
+ {.name = "GetPutPixel {{ pt.name }}",
+ .tst_fn = GetPutPixel_{{ pt.name }}},
+%% endif
+%% endfor
+
+ {.name = NULL}
+ }
+};
+
+%% endblock body
diff --git a/tests/core/Makefile b/tests/core/Makefile
index 6b8b9a0..54d105a 100644
--- a/tests/core/Makefile
+++ b/tests/core/Makefile
@@ -7,9 +7,9 @@ CSOURCES=Context.c
# hack
LIBNAME=core
-GENSOURCES+=WritePixel_testsuite.gen.c
+GENSOURCES+=WritePixel_testsuite.gen.c GetPutPixel.gen.c
-APPS=WritePixel_testsuite.gen Context
+APPS=WritePixel_testsuite.gen Context GetPutPixel.gen
include ../tests.mk
diff --git a/tests/core/runtest.sh b/tests/core/runtest.sh
index a392647..7e20739 100755
--- a/tests/core/runtest.sh
+++ b/tests/core/runtest.sh
@@ -11,3 +11,4 @@ export LIBC_FATAL_STDERR_=1
LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./WritePixel_testsuite.gen "$@"
LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Context "$@"
+LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./GetPutPixel.gen "$@"
-----------------------------------------------------------------------
Summary of changes:
tests/core/{Context.c => GetPutPixel.gen.c.t} | 127 ++++++++++++++-----------
tests/core/Makefile | 4 +-
tests/core/runtest.sh | 1 +
3 files changed, 74 insertions(+), 58 deletions(-)
copy tests/core/{Context.c => GetPutPixel.gen.c.t} (57%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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, master has been updated
via a5f3ffffa6adc218386bcec41f5cd1ebe691a7df (commit)
from 54a1f43dff8349c620ab43306651236f9143e5ee (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/a5f3ffffa6adc218386bcec41f5cd1ebe691…
commit a5f3ffffa6adc218386bcec41f5cd1ebe691a7df
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Oct 19 22:16:01 2012 +0200
core+all: Finally GP_RetCode free.
diff --git a/doc/drawing_api.txt b/doc/drawing_api.txt
index 75b6aa2..0304138 100644
--- a/doc/drawing_api.txt
+++ b/doc/drawing_api.txt
@@ -247,8 +247,8 @@ typedef enum GP_TextAlign {
GP_VALIGN_BELOW = 0x40 /* below the point */
} GP_TextAlign;
-GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int align, const char *str, GP_Pixel pixel);
+void GP_Text(GP_Context *context, const GP_TextStyle *style,
+ int x, int y, int align, const char *str, GP_Pixel pixel);
--------------------------------------------------------------------------------
Draws text at the position x and y; the alignment of the text in relation
diff --git a/include/SDL/GP_SDL_Context.h b/include/SDL/GP_SDL_Context.h
index af53f54..5f27a4a 100644
--- a/include/SDL/GP_SDL_Context.h
+++ b/include/SDL/GP_SDL_Context.h
@@ -27,8 +27,7 @@
#define GP_SDL_CONTEXT_H
#include "GP.h"
-#include "core/GP_RetCode.h"
-GP_RetCode GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf);
+int GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf);
#endif /* GP_SDL_CONTEXT_H */
diff --git a/include/SDL/GP_SDL_VideoInit.h b/include/SDL/GP_SDL_VideoInit.h
index 99927b6..ad26c10 100644
--- a/include/SDL/GP_SDL_VideoInit.h
+++ b/include/SDL/GP_SDL_VideoInit.h
@@ -27,9 +27,8 @@
#define GP_SDL_VIDEOINIT_H
#include "GP.h"
-#include "core/GP_RetCode.h"
-GP_RetCode GP_SDL_VideoInit(GP_Context *context, int width, int height,
+int GP_SDL_VideoInit(GP_Context *context, int width, int height,
int argc, char **argv);
#endif /* GP_SDL_VIDEOINIT_H */
diff --git a/include/core/GP_RetCode.h b/include/core/GP_RetCode.h
deleted file mode 100644
index ce875fd..0000000
--- a/include/core/GP_RetCode.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#ifndef CORE_GP_RETCODE_H
-#define CORE_GP_RETCODE_H
-
-typedef enum GP_RetCode {
- GP_ESUCCESS,
- GP_EINVAL,
- GP_ENOIMPL,
- GP_EUNPRECISE,
- GP_ENULLPTR, /* some argument was unexpectedly NULL */
- GP_ENOBACKEND, /* no backend available */
- GP_EBACKENDLOST, /* lost connection to the backend */
- GP_EBADCONTEXT, /* context contains invalid data */
- GP_EBADFILE, /* error in file, or bad file format */
- GP_ENOENT, /* no such file or another object */
- GP_ENOMEM, /* not enough memory */
- GP_EINTR, /* operation interrupted by user */
- GP_EMAX,
-} GP_RetCode;
-
-const char *GP_RetCodeName(GP_RetCode code);
-
-#endif /* CORE_GP_RETCODE_H */
diff --git a/libs/SDL/GP_SDL_Context.c b/libs/SDL/GP_SDL_Context.c
index 5ced9cc..cbe5ca4 100644
--- a/libs/SDL/GP_SDL_Context.c
+++ b/libs/SDL/GP_SDL_Context.c
@@ -31,14 +31,14 @@
#include "GP_SDL.h"
-GP_RetCode GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf)
+int GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf)
{
if (surf == NULL || surf->pixels == NULL || context == NULL)
- return GP_ENULLPTR;
+ return 1;
/* sanity checks on the SDL surface */
if (surf->format->BytesPerPixel == 0 || surf->format->BytesPerPixel > 4)
- return GP_ENOIMPL;
+ return 1;
enum GP_PixelType pixeltype = GP_PixelRGBMatch(surf->format->Rmask,
surf->format->Gmask,
@@ -47,7 +47,7 @@ GP_RetCode GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf)
surf->format->BitsPerPixel);
if (pixeltype == GP_PIXEL_UNKNOWN)
- return GP_ENOIMPL;
+ return 1;
/* basic structure and size */
context->pixels = surf->pixels;
@@ -62,7 +62,7 @@ GP_RetCode GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf)
context->x_swap = 0;
context->y_swap = 0;
- return GP_ESUCCESS;
+ return 0;
}
#endif /* HAVE_LIBSDL */
diff --git a/libs/SDL/GP_SDL_VideoInit.c b/libs/SDL/GP_SDL_VideoInit.c
index 8ce6419..b7462ff 100644
--- a/libs/SDL/GP_SDL_VideoInit.c
+++ b/libs/SDL/GP_SDL_VideoInit.c
@@ -33,11 +33,11 @@
#include <stdio.h>
#include <string.h>
-GP_RetCode GP_SDL_VideoInit(GP_Context *context, int width, int height,
+int GP_SDL_VideoInit(GP_Context *context, int width, int height,
int argc, char **argv)
{
if (context == NULL)
- return GP_ENULLPTR;
+ return 1;
/* switches that can be set on the command line */
int display_bpp = 0;
@@ -46,7 +46,7 @@ GP_RetCode GP_SDL_VideoInit(GP_Context *context, int width, int height,
if (argc > 0) {
if (argv == NULL)
- return GP_ENULLPTR;
+ return 1;
/* extract settings from the command line */
int i;
@@ -69,7 +69,7 @@ GP_RetCode GP_SDL_VideoInit(GP_Context *context, int width, int height,
fprintf(stderr, "Error: Could not initialize SDL: %sn",
SDL_GetError());
}
- return GP_EBACKENDLOST;
+ return 1;
}
SDL_Surface *display = NULL;
@@ -80,7 +80,7 @@ GP_RetCode GP_SDL_VideoInit(GP_Context *context, int width, int height,
SDL_GetError());
}
SDL_Quit();
- return GP_EINVAL;
+ return 1;
}
if (debug) {
@@ -94,18 +94,16 @@ GP_RetCode GP_SDL_VideoInit(GP_Context *context, int width, int height,
display->format->Bmask, display->format->Amask);
}
- GP_RetCode retcode;
- retcode = GP_SDL_ContextFromSurface(context, display);
- if (retcode != GP_ESUCCESS) {
+ int retcode = GP_SDL_ContextFromSurface(context, display);
+ if (retcode != 0) {
if (debug) {
- fprintf(stderr, "Error: Could not create context: %sn",
- GP_RetCodeName(retcode));
+ fprintf(stderr, "Error: Could not create context");
}
SDL_Quit();
return retcode;
}
- return GP_ESUCCESS;
+ return 0;
}
#endif /* HAVE_LIBSDL */
diff --git a/libs/core/GP_RetCode.c b/libs/core/GP_RetCode.c
deleted file mode 100644
index f14b5cc..0000000
--- a/libs/core/GP_RetCode.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include "GP_RetCode.h"
-
-/* Names of return codes; must be in the same order as the codes */
-static char *ret_code_names[] = {
- "Success",
- "Invalid operation",
- "Not implemented",
- "Imprecise result",
- "Unexpected null pointer",
- "No backend available",
- "Connection with backend lost",
- "Bad context",
- "Bad file",
- "Not found",
- "Not enough memory",
- "Operation interrupted"
-};
-
-const char *GP_RetCodeName(GP_RetCode code)
-{
- if (code >= GP_EMAX)
- return "Invalid return code";
-
- return ret_code_names[code];
-}
-----------------------------------------------------------------------
Summary of changes:
doc/drawing_api.txt | 4 +-
include/SDL/GP_SDL_Context.h | 3 +-
include/SDL/GP_SDL_VideoInit.h | 3 +-
include/core/GP_RetCode.h | 47 -------------------------------------
libs/SDL/GP_SDL_Context.c | 10 ++++----
libs/SDL/GP_SDL_VideoInit.c | 20 +++++++--------
libs/core/GP_RetCode.c | 50 ----------------------------------------
7 files changed, 18 insertions(+), 119 deletions(-)
delete mode 100644 include/core/GP_RetCode.h
delete mode 100644 libs/core/GP_RetCode.c
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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, master has been updated
via 5f13bc0a920bfb4b903a6982b66a091825c4228e (commit)
via f4623e257dda0ce2f5afffc51be40f4f9022160e (commit)
via 5fb5fa695cc7e152587edb6f8d76ed531f0cc6cb (commit)
from 472dae1467a2add6bd116bd024c68ff6a5557534 (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/5f13bc0a920bfb4b903a6982b66a091825c4…
commit 5f13bc0a920bfb4b903a6982b66a091825c4228e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Oct 19 20:09:36 2012 +0200
tests: Remove trianglefps.
diff --git a/tests/SDL/Makefile b/tests/SDL/Makefile
index c11568d..9dd15e9 100644
--- a/tests/SDL/Makefile
+++ b/tests/SDL/Makefile
@@ -8,7 +8,7 @@ ifeq ($(HAVE_LIBSDL),yes)
CSOURCES=$(shell echo *.c)
APPS=pixeltest fonttest linetest randomshapetest- symbolstest textaligntest trianglefps blittest subcontext+ symbolstest textaligntest blittest subcontext aatest mixpixeltest
endif
diff --git a/tests/SDL/trianglefps.c b/tests/SDL/trianglefps.c
deleted file mode 100644
index 5eda430..0000000
--- a/tests/SDL/trianglefps.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
- * <jiri.bluebear.dluhos(a)gmail.com> *
- * *
- * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <SDL/SDL.h>
-
-#include "GP.h"
-#include "GP_SDL.h"
-
-/* Draw filled triangles? */
-int filled = 0;
-
-/* The surface used as a display (in fact it is a software surface). */
-SDL_Surface *display = NULL;
-GP_Context context;
-
-/* Frames per second. */
-int fps = 0, fps_min = 1000000, fps_max = 0;
-
-/* Color pixel values in display format. */
-GP_Pixel black, white;
-
-/*
- * Timer used for FPS measurement and key reactions.
- * SDL_USEREVENT is triggered each second.
- */
-
-SDL_TimerID timer;
-
-SDL_UserEvent timer_event;
-
-Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
- __attribute__((unused)) void * param)
-{
- timer_event.type = SDL_USEREVENT;
- SDL_PushEvent((SDL_Event *) &timer_event);
- return 1000;
-}
-
-
-void draw_frame(void)
-{
- int x0 = 0;
- int y0 = random() % display->h;
- int x1 = display->w;
- int y1 = random() % display->h;
- int x2 = display->w/2;
- int y2 = random() % display->h;
-
- GP_Pixel pixel;
- pixel = GP_RGBToPixel(random() % 255, random() % 255,
- random() % 255, context.pixel_type);
-
- if (filled)
- GP_FillTriangle(&context, x0, y0, x1, y1, x2, y2, pixel);
- else
- GP_Triangle(&context, x0, y0, x1, y1, x2, y2, pixel);
-}
-
-void event_loop(void)
-{
- SDL_Event event;
-
- for (;;) {
- while (SDL_PollEvent(&event) > 0) {
- switch (event.type) {
- case SDL_USEREVENT:
- SDL_Flip(display);
- fprintf(stdout, "%d triangles/second, min = %d, max = %dr", fps, fps_min, fps_max);
- fflush(stdout);
-
- /* Update frames per second */
- if (fps < fps_min)
- fps_min = fps;
- if (fps > fps_max)
- fps_max = fps;
- fps = 0;
- break;
- case SDL_KEYDOWN:
- case SDL_QUIT:
- return;
- }
- }
- draw_frame();
- fps++;
- }
-}
-
-int main(int argc, char ** argv)
-{
- int bit_depth = 0;
-
- int i;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-f") == 0) {
- filled = 1;
- }
- else if (strcmp(argv[i], "-16") == 0) {
- bit_depth = 16;
- }
- else if (strcmp(argv[i], "-24") == 0) {
- bit_depth = 24;
- }
- else if (strcmp(argv[i], "-32") == 0) {
- bit_depth = 32;
- }
- }
-
- /* Initialize SDL */
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
- fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError());
- return 1;
- }
-
- /* Create a window with a software back surface */
- display = SDL_SetVideoMode(640, 480, bit_depth, SDL_SWSURFACE);
- if (display == NULL) {
- fprintf(stderr, "Could not open display: %sn", SDL_GetError());
- goto fail;
- }
-
- /* Print basic information about the surface */
- printf("Display surface properties:n");
- printf(" width: %4d, height: %4d, pitch: %4dn",
- display->w, display->h, display->pitch);
- printf(" bits per pixel: %2d, bytes per pixel: %2dn",
- display->format->BitsPerPixel, display->format->BytesPerPixel);
- printf("Machine properties:n");
- printf(" sizeof(int) = %u, sizeof(long) = %un",
- (unsigned int)sizeof(int), (unsigned int)sizeof(long));
-
- /* Set up a clipping rectangle to test proper clipping of pixels */
- SDL_Rect clip_rect = { 10, 10, 620, 460 };
- SDL_SetClipRect(display, &clip_rect);
-
- GP_SDL_ContextFromSurface(&context, display);
-
- white = GP_ColorToContextPixel(GP_COL_WHITE, &context);
- black = GP_ColorToContextPixel(GP_COL_BLACK, &context);
-
- /* Set up the timer */
- timer = SDL_AddTimer(1000, timer_callback, NULL);
- if (timer == 0) {
- fprintf(stderr, "Could not set up timer: %sn", SDL_GetError());
- goto fail;
- }
-
- /* Enter the event loop */
- event_loop();
-
- /* Preserve the last result by a newline */
- fprintf(stdout, "n");
-
- /* We're done */
- SDL_Quit();
- return 0;
-
-fail:
- SDL_Quit();
- return 1;
-}
-
http://repo.or.cz/w/gfxprim.git/commit/f4623e257dda0ce2f5afffc51be40f4f9022…
commit f4623e257dda0ce2f5afffc51be40f4f9022160e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Oct 19 20:06:47 2012 +0200
tests: Remove more unused files.
diff --git a/tests/common/GP_TestingRandom.c b/tests/common/GP_TestingRandom.c
deleted file mode 100644
index 17281a9..0000000
--- a/tests/common/GP_TestingRandom.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include <stdlib.h>
-
-#include "GP_Common.h"
-#include "GP_TestingRandom.h"
-
-/*
- * State array for testing random generator
- *
- * The idea is to have a seperate random generator for generating
- * random inputs for tests in case tested algorithms also use
- * the random generator. Change in the tested algorithm must not
- * change the input data generated for this or other part of the test.
- *
- * Take care when changing the values - unrelated test might start
- * exhibiting a bug, some tests may rely on the exact result.
- */
-#define GP_RandomStateSize 256
-static char GP_RandomTestingState[GP_RandomStateSize];
-static struct random_data GP_RandomTestingData;
-
-long int GP_TestingRandom(void)
-{
- int32_t r;
- GP_ASSERT(random_r(&GP_RandomTestingData, &r) == 0);
- return r;
-}
-
-void GP_InitTestingRandom(const char *text, uint64_t seed)
-{
- const char *p = text;
- for (; (p) && (*p); p++)
- seed = ((seed * 327) + *p) % 0x7B391D50A10A3LL; // TODO replace with large primes
- GP_ASSERT(initstate_r(seed, GP_RandomTestingState, GP_RandomStateSize,
- &GP_RandomTestingData) == 0);
-}
-
diff --git a/tests/common/GP_TestingRandom.h b/tests/common/GP_TestingRandom.h
deleted file mode 100644
index 9f267fb..0000000
--- a/tests/common/GP_TestingRandom.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-/*
- * These routines use a pseudorandom generator with internal state.
- * Use this only to provide tests with pseudo-random inputs.
- * The seed is initialized with the test name, so the random numbers
- * (and therefore inputs) are the same for a test, and do not depend
- * on random() called in the tested routines or other tests.
- */
-
-#ifndef GP_TESTING_RANDOM_H
-#define GP_TESTING_RANDOM_H
-
-#include <stdint.h>
-
-/*
- * Return next random value from the testing random generator
- */
-long int GP_TestingRandom(void);
-
-/*
- * Initialize the random generator to a seed computed from the given string
- * and the given seed value. Needs to be called at least once.
- *
- * The string may be for example the name of the test, the seed the number of test iteration.
- */
-void GP_InitTestingRandom(const char *text, uint64_t seed);
-
-#endif /* GP_TESTING_RANDOM_H */
diff --git a/tests/common/GP_Tests.c b/tests/common/GP_Tests.c
deleted file mode 100644
index 736c05c..0000000
--- a/tests/common/GP_Tests.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <check.h>
-
-typedef Suite* (SuiteFactory)(void);
-
-/*
- * Declare all the manualy created Suite-generating functions here:
- */
-
-SuiteFactory* manual_suites[] = {
- NULL /* Sentinel */
-};
-
-/*
- * Generated function creating and adding all the suites
- */
-
-void GP_AddSuitesToSRunner(SRunner *sr);
-
-
-const char usage[] = "Usage:n%s [-v] [-q]n";
-
-int main(int argc, char *argv[])
-{
- int verb = CK_NORMAL;
-
- int opt;
- while((opt = getopt(argc, argv, "vq")) >= 0)
- switch(opt) {
- case 'v':
- verb = CK_VERBOSE;
- break;
- case 'q':
- verb = CK_SILENT;
- break;
- default:
- fprintf(stderr, usage, argv[0]);
- return(EXIT_FAILURE);
- }
-
- SRunner *sr = srunner_create(NULL);
-
- SuiteFactory **s;
- for (s = manual_suites; *s; s++) {
- srunner_add_suite(sr, (*s)());
- }
- GP_AddSuitesToSRunner(sr);
-
- srunner_run_all(sr, verb);
- int number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/tests/common/GP_Tests.h b/tests/common/GP_Tests.h
deleted file mode 100644
index 72c83bb..0000000
--- a/tests/common/GP_Tests.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-/*
- * Wrappers around check.h unit-test library
- *
- * Create a .test.c file with (example):
- *
- * GP_SUITE(suite_name)
- *
- * GP_TEST(test1)
- * {
- * fail_unless(1 == 1);
- * fail_if(1 < 0, "Impossible!");
- * int i = 3;
- * if (1 + 1 == i) fail("Arrgh, 1 + 1 is %d", i);
- * }
- * GP_ENDTEST
- *
- * The tests are collected automatically by find_tests.py.
- * See below for more options.
- */
-
-#include <check.h>
-#include "GP_TestingRandom.h"
-
-/*
- * Helper macro to allow auto-generation of test-cases and suites.
- * Searched for by find_tests.py.
- *
- * Use alone on a line as
- * GP_TEST(testname)
- * or
- * GP_TEST(testname, "foo=1, bar='baz'")
- * The optional string is passed as parameters to Python dict() as parameters
- * for the testcase-generator.
- * Currently, the following parameters are recognized:
- * suite -- name of the suite
- * loop_start -- test will be repeated as with:
- * loop_end for (int _i = loop_start; _i < loop_end; i++) { ... }
- * expect_exit -- expect the function to exit with given exitcode
- * expect_signal -- expect the function to exit with given exitcode
- *
- * Parameters name, fname, line are used internally, do not use them
- */
-
-#define GP_TEST(name, ...) static void name(int); void GP_TEST_##name(int i) {- GP_InitTestingRandom( #name, i); name(i); } - START_TEST(name)
-
-#define GP_ENDTEST END_TEST
-
-/*
- * Helper macro to allow auto-generation of suites.
- * Defines suite from this point until EOF or redefinition.
- * Searched for by find_tests.py
- *
- * Use alone on a line as
- * GP_SUITE(suitename)
- */
-
-#define GP_SUITE(name, ...)
-
http://repo.or.cz/w/gfxprim.git/commit/5fb5fa695cc7e152587edb6f8d76ed531f0c…
commit 5fb5fa695cc7e152587edb6f8d76ed531f0cc6cb
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Oct 19 20:04:09 2012 +0200
tests: core: Add simple context test.
diff --git a/tests/core/Context.c b/tests/core/Context.c
new file mode 100644
index 0000000..ec83876
--- /dev/null
+++ b/tests/core/Context.c
@@ -0,0 +1,107 @@
+/*****************************************************************************
+ * This file is part of gfxprim library. *
+ * *
+ * Gfxprim is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Lesser General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2.1 of the License, or (at your option) any later version. *
+ * *
+ * Gfxprim 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 *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with gfxprim; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA *
+ * *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+/*
+
+ Very basic GP_Context tests.
+
+ */
+
+#include <core/GP_Context.h>
+
+#include "tst_test.h"
+
+/*
+ * Check that Context is correctly allocated and freed
+ */
+static int Context_Alloc_Free(void)
+{
+ GP_Context *c;
+
+ c = GP_ContextAlloc(100, 200, GP_PIXEL_RGB888);
+
+ if (c == NULL) {
+ tst_report(0, "GP_ContextAlloc() failed");
+ return TST_FAILED;
+ }
+
+ /* Assert context properties */
+ if (c->bpp != 24) {
+ tst_report(0, "Context->bpp != 24 (== %i)", c->bpp);
+ return TST_FAILED;
+ }
+
+ if (c->bytes_per_row != 3 * c->w) {
+ tst_report(0, "Context->bytes_per_row != %i (== %i)",
+ 3 * c->w, c->bytes_per_row);
+ return TST_FAILED;
+ }
+
+ if (c->w != 100) {
+ tst_report(0, "Context->w != 100 (== %i)", c->w);
+ return TST_FAILED;
+ }
+
+ if (c->h != 200) {
+ tst_report(0, "Context->h != 200 (== %i)", c->h);
+ return TST_FAILED;
+ }
+
+ if (c->offset != 0) {
+ tst_report(0, "Context->offset != 0");
+ return TST_FAILED;
+ }
+
+ if (c->pixel_type != GP_PIXEL_RGB888) {
+ tst_report(0, "Context->pixel_type != GP_PIXEL_RGB888");
+ return TST_FAILED;
+ }
+
+ if (c->gamma != NULL) {
+ tst_report(0, "Context->gamma != NULL");
+ return TST_FAILED;
+ }
+
+ if (c->axes_swap != 0 || c->x_swap != 0 || c->y_swap != 0) {
+ tst_report(0, "Wrong default orientation %i %i %i",
+ c->axes_swap, c->x_swap, c->y_swap);
+ return TST_FAILED;
+ }
+
+ /* access the pixel buffer */
+ *(char*)GP_PIXEL_ADDR(c, 0, 0) = 0;
+ *(char*)GP_PIXEL_ADDR(c, 100, 100) = 0;
+
+ GP_ContextFree(c);
+
+ return TST_SUCCESS;
+}
+
+const struct tst_suite tst_suite = {
+ .suite_name = "Context Testsuite",
+ .tests = {
+ {.name = "Context Alloc Free", .tst_fn = Context_Alloc_Free,
+ .flags = TST_CHECK_MALLOC},
+
+ {.name = NULL},
+ }
+};
diff --git a/tests/core/Makefile b/tests/core/Makefile
index f030894..6b8b9a0 100644
--- a/tests/core/Makefile
+++ b/tests/core/Makefile
@@ -2,14 +2,14 @@ TOPDIR=../..
include $(TOPDIR)/pre.mk
-#CSOURCES=$(shell echo *.c)
+CSOURCES=Context.c
# hack
LIBNAME=core
GENSOURCES+=WritePixel_testsuite.gen.c
-APPS=WritePixel_testsuite.gen
+APPS=WritePixel_testsuite.gen Context
include ../tests.mk
diff --git a/tests/core/runtest.sh b/tests/core/runtest.sh
index 0a9821e..a392647 100755
--- a/tests/core/runtest.sh
+++ b/tests/core/runtest.sh
@@ -10,3 +10,4 @@
export LIBC_FATAL_STDERR_=1
LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./WritePixel_testsuite.gen "$@"
+LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Context "$@"
-----------------------------------------------------------------------
Summary of changes:
tests/SDL/Makefile | 2 +-
tests/SDL/trianglefps.c | 186 -------------------------
tests/common/GP_TestingRandom.c | 58 --------
tests/common/GP_TestingRandom.h | 49 -------
tests/common/GP_Tests.c | 79 -----------
tests/common/GP_Tests.h | 82 -----------
tests/{framework/tst_job.h => core/Context.c} | 127 +++++++++--------
tests/core/Makefile | 4 +-
tests/core/runtest.sh | 1 +
9 files changed, 73 insertions(+), 515 deletions(-)
delete mode 100644 tests/SDL/trianglefps.c
delete mode 100644 tests/common/GP_TestingRandom.c
delete mode 100644 tests/common/GP_TestingRandom.h
delete mode 100644 tests/common/GP_Tests.c
delete mode 100644 tests/common/GP_Tests.h
copy tests/{framework/tst_job.h => core/Context.c} (51%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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, master has been updated
via fccae75f5221a0307cb52a5e8d7aa6cf820ec6df (commit)
from 8caa76a32fdad0cc36b1a4ac6038b205f17b504e (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/fccae75f5221a0307cb52a5e8d7aa6cf820e…
commit fccae75f5221a0307cb52a5e8d7aa6cf820ec6df
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Oct 13 20:23:37 2012 +0200
core: Remove unused GP_Counter.
diff --git a/include/core/GP_Core.h b/include/core/GP_Core.h
index cd5555d..d10152f 100644
--- a/include/core/GP_Core.h
+++ b/include/core/GP_Core.h
@@ -71,9 +71,6 @@
/* Threads utils */
#include "core/GP_Threads.h"
-/* Debug counters */
-#include "core/GP_Counter.h"
-
/* Mix Pixel */
#include "core/GP_MixPixels.h"
diff --git a/include/core/GP_Counter.h b/include/core/GP_Counter.h
deleted file mode 100644
index 0429df9..0000000
--- a/include/core/GP_Counter.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
- * Copyright (C) 2012 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#ifndef CORE_GP_COUNTER_H
-#define CORE_GP_COUNTER_H
-
-/*
- * Simple global named 64-bit counters.
- *
- * Intended for accounting of expensive operations ("quantitative warnings").
- * All operations accept NULL as GP_Counter.
- *
- * If GP_IMPLEMENT_COUNTERS is undefined, all operations are NOP and
- * no memory is allocated.
- */
-#define GP_IMPLEMENT_COUNTERS
-
-/*
- * Maximum length of counter name,
- * maximum number of counters (~40 bytes each)
- */
-#define GP_COUNTER_NAME_LEN 24
-#define GP_COUNTER_MAX 256
-
-/*
- * Basic types.
- * Only use GP_Counter in your programs.
- */
-typedef int64_t GP_Counter_t;
-typedef GP_Counter_t *GP_Counter;
-
-/*
- * Increase a counter by 1.
- */
-static inline void GP_IncCounter(GP_Counter counter)
-{
-#ifdef GP_IMPLEMENT_COUNTERS
- if (!counter)
- return;
- (*counter)++;
-#endif /* GP_IMPLEMENT_COUNTERS */
-}
-
-/*
- * Increase a counter by delta (may be negative).
- * No checks for underflow.
- */
-static inline void GP_AddCounter(GP_Counter counter, GP_Counter_t delta)
-{
-#ifdef GP_IMPLEMENT_COUNTERS
- if (!counter)
- return;
- (*counter) += delta;
-#endif /* GP_IMPLEMENT_COUNTERS */
-}
-
-/*
- * Set counter to given value.
- */
-static inline void GP_SetCounter(GP_Counter counter, GP_Counter_t value)
-{
-#ifdef GP_IMPLEMENT_COUNTERS
- if (!counter)
- return;
- (*counter) = value;
-#endif /* GP_IMPLEMENT_COUNTERS */
-}
-
-/*
- * Return counter value
- */
-static inline GP_Counter_t GP_CounterVal(GP_Counter counter)
-{
-#ifdef GP_IMPLEMENT_COUNTERS
- if (!counter)
- return 0;
- return *counter;
-#else /* GP_IMPLEMENT_COUNTERS */
- return 0;
-#endif /* GP_IMPLEMENT_COUNTERS */
-}
-
-/*
- * Pretty-printing of all counters and their values to f
- * Includes info about counter-list overflow
- */
-#include <stdio.h>
-void GP_PrintCounters(FILE *f);
-
-/*
- * Lookup a counter by name, possibly creating a new one.
- *
- * May return NULL if no space is left in the counter list.
- * The returned value is not unallocated in any way.
- *
- * NOTE: Current implementation has very slow adds (O(current_counters)),
- * but the lookup is reasonably fast (bisection)
- */
-GP_Counter GP_GetCounter(const char *name);
-
-#endif /* CORE_GP_COUNTER_H */
diff --git a/libs/core/GP_Counter.c b/libs/core/GP_Counter.c
deleted file mode 100644
index 7ba619e..0000000
--- a/libs/core/GP_Counter.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
- * Copyright (C) 2012 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include <string.h>
-#include "GP_Common.h"
-#include "GP_Counter.h"
-
-/*
- * Internal struct used in counter list
- */
-struct GP_CounterRecord {
- char name[GP_COUNTER_NAME_LEN];
- GP_Counter counter;
-};
-
-/*
- * variables local to module (static)
- */
-#ifdef GP_IMPLEMENT_COUNTERS
-
-static GP_Counter_t GP_counters[GP_COUNTER_MAX];
-static int GP_used_counters = 0;
-static struct GP_CounterRecord GP_counter_list[GP_COUNTER_MAX];
-static GP_Counter_t GP_counter_list_overflow = 0;
-
-#endif /* GP_IMPLEMENT_COUNTERS */
-
-void GP_PrintCounters(FILE *f)
-{
-#ifdef GP_IMPLEMENT_COUNTERS
- int i;
- GP_CHECK(f != NULL);
- if (GP_used_counters == 0)
- fprintf(f, "[ no counters defined ]n");
- for (i = 0; i < GP_used_counters; i++)
- fprintf(f, "%*s : %llun", -GP_COUNTER_NAME_LEN,
- GP_counter_list[i].name,
- (long long unsigned int)*(GP_counter_list[i].counter));
- if (GP_counter_list_overflow > 0)
- fprintf(f, "[ unable to allocate new counter %llu times ]n",
- (long long unsigned int)GP_counter_list_overflow);
-#endif /* GP_IMPLEMENT_COUNTERS */
-}
-
-GP_Counter GP_GetCounter(const char *name)
-{
-#ifdef GP_IMPLEMENT_COUNTERS
- int l = 0;
- int r = GP_used_counters;
-
- GP_CHECK(name != NULL);
- GP_CHECK(strlen(name) + 1 <= GP_COUNTER_NAME_LEN);
-
- /*
- * Bisect GP_counter_list to find either the counter or a place for it
- * interval [l, r) (not incl. r)
- */
- while (r > l) {
- int med = (r + l) / 2; /* Here never equal to r, might be l */
- int cmp = strcmp(GP_counter_list[med].name, name);
- if (cmp == 0)
- return GP_counter_list[med].counter;
- if (cmp < 0)
- l = med + 1;
- else
- r = med;
- }
- GP_CHECK(l == r);
- if ((l < GP_used_counters) && (strcmp(GP_counter_list[l].name, name) == 0))
- return GP_counter_list[l].counter;
-
- /* Add a new counter */
- if (GP_used_counters >= GP_COUNTER_MAX) {
- GP_counter_list_overflow++;
- return NULL;
- }
-
- /* Move the counter records up and initialize a new one */
- memmove(GP_counter_list + l + 1, GP_counter_list + l,
- sizeof(struct GP_CounterRecord) * GP_used_counters - l);
- strcpy(GP_counter_list[l].name, name);
- GP_counter_list[l].counter = GP_counters + GP_used_counters;
-
- GP_used_counters++;
- return GP_counter_list[l].counter;
-#else /* GP_IMPLEMENT_COUNTERS */
- return NULL;
-#endif /* GP_IMPLEMENT_COUNTERS */
-}
diff --git a/pylib/gfxprim/core/core.i b/pylib/gfxprim/core/core.i
index 67777dd..6ddfc29 100644
--- a/pylib/gfxprim/core/core.i
+++ b/pylib/gfxprim/core/core.i
@@ -9,14 +9,11 @@
* Basic types and common methods
*/
-ERROR_ON_NULL(GP_GetCounter);
-
%include "GP_Common.h"
%include "GP_Core.h"
%include "GP_Debug.h"
%include "GP_Types.h"
%include "GP_Transform.h"
-%include "GP_Counter.h"
%include "GP_GetSetBits.h"
%include "GP_Transform.h"
%include "GP_ProgressCallback.h"
diff --git a/tests/core_old/GP_Counter.test.c b/tests/core_old/GP_Counter.test.c
deleted file mode 100644
index 6bd9ab7..0000000
--- a/tests/core_old/GP_Counter.test.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*****************************************************************************
- * This file is part of gfxprim library. *
- * *
- * Gfxprim is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * Gfxprim 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 *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with gfxprim; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
- * Boston, MA 02110-1301 USA *
- * *
- * Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-#include <string.h>
-#include <stdio.h>
-
-#include "GP_Tests.h"
-#include "GP_Counter.h"
-
-GP_SUITE(GP_Counter)
-
-GP_TEST(Smoke)
-{
- fail_unless(GP_CounterVal(NULL) == 0);
- GP_IncCounter(NULL);
- GP_AddCounter(NULL, -10);
- fail_unless(GP_GetCounter("") != NULL);
-
- GP_IncCounter(GP_GetCounter("a"));
- fail_unless(GP_CounterVal(GP_GetCounter("a")) == 1);
-
- GP_PrintCounters(fopen("/dev/null","wt"));
-}
-END_TEST
-
-GP_TEST(Allocation)
-{
- /* random-like operations with counters,
- * should test reasonably many combinations */
- GP_SetCounter(GP_GetCounter("a"), 11);
- GP_AddCounter(GP_GetCounter("e"), -42);
- GP_Counter b = GP_GetCounter("b");
- GP_IncCounter(GP_GetCounter("a"));
- GP_GetCounter("d");
- GP_AddCounter(GP_GetCounter("c"), 21);
- GP_IncCounter(GP_GetCounter("b"));
- GP_AddCounter(GP_GetCounter("b"), -8);
- GP_IncCounter(b);
- GP_SetCounter(GP_GetCounter("f"), 91);
- GP_SetCounter(GP_GetCounter("f"), -1);
-
- fail_unless(GP_CounterVal(GP_GetCounter("a")) == 12);
- fail_unless(GP_CounterVal(GP_GetCounter("b")) == -6);
- fail_unless(GP_CounterVal(GP_GetCounter("c")) == 21);
- fail_unless(GP_CounterVal(GP_GetCounter("d")) == 0);
- fail_unless(GP_CounterVal(GP_GetCounter("e")) == -42);
- fail_unless(GP_CounterVal(GP_GetCounter("f")) == -1);
-}
-END_TEST
-
-GP_TEST(Overflow)
-{
- char buf[8];
- int i;
- for (i = 0; i < GP_COUNTER_MAX; i++) {
- sprintf(buf, "%d", i);
- fail_if(GP_GetCounter(buf) == NULL);
- }
- fail_unless(GP_GetCounter("next") == NULL);
-}
-END_TEST
-
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Core.h | 3 -
include/core/GP_Counter.h | 121 --------------------------------------
libs/core/GP_Counter.c | 109 ----------------------------------
pylib/gfxprim/core/core.i | 3 -
tests/core_old/GP_Counter.test.c | 81 -------------------------
5 files changed, 0 insertions(+), 317 deletions(-)
delete mode 100644 include/core/GP_Counter.h
delete mode 100644 libs/core/GP_Counter.c
delete mode 100644 tests/core_old/GP_Counter.test.c
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")