summaryrefslogtreecommitdiffstatsci
path: root/src/fill.cpp
diff options
context:
space:
mode:
authorBryce Harrington <b.harrington@samsung.com>2013-10-28 13:38:08 -0700
committerBryce Harrington <b.harrington@samsung.com>2013-10-30 18:10:04 -0700
commit5ba31b6f73ce490f69a28ffe27d8e80994849198 (patch)
tree90c2a7e7184f1829aa2ffc45cfe8b1d84b5464f7 /src/fill.cpp
parentb2356653469b7ea05cf6bcb92d4ac4dc23f2b5ab (diff)
Make the caskbench executable run the individual tests
Diffstat (limited to 'src/fill.cpp')
-rw-r--r--src/fill.cpp62
1 files changed, 13 insertions, 49 deletions
diff --git a/src/fill.cpp b/src/fill.cpp
index 3a41826..c3c81b2 100644
--- a/src/fill.cpp
+++ b/src/fill.cpp
@@ -4,58 +4,22 @@
#include "caskbench.h"
-void
-randomize_color(cairo_t *cr)
+int
+setup_fill(cairo_t *cr)
{
- double red, green, blue, alpha;
-
- red = (double)rand()/RAND_MAX;
- green = (double)rand()/RAND_MAX;
- blue = (double)rand()/RAND_MAX;
- alpha = (double)rand()/RAND_MAX;
+ cairo_arc (cr, 40, 40, 30, 0, 2*M_PI);
+ return 1;
+}
- cairo_set_source_rgba (cr, red, green, blue, alpha);
+void
+teardown_fill(void)
+{
}
int
-main(int argc, char *argv[]) {
- int i;
- int iterations_requested = 16*1024;
- int iterations = iterations_requested;
- cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 800, 80);
- cairo_t *cr = cairo_create (surface);
- int status = 0;
-
- srand(0xdeadbeef);
- cairo_arc (cr, 40, 40, 30, 0, 2*M_PI);
-
- while (iterations--) {
- try {
- randomize_color (cr);
- cairo_fill_preserve (cr);
- status = 1;
- } catch (...) {
- printf("Exception encountered\n");
- status = 3;
- goto FINAL;
- }
- }
-
- cairo_surface_write_to_png (surface, "fill.png");
-
- FINAL:
- printf(" {\n");
- printf(" \"case\": \"fill\",\n");
- printf(" \"iterations\": %d,\n", iterations_requested - iterations);
- printf(" \"minimum run time (s)\": %f,\n", 40.123);
- printf(" \"median run time (s)\": %f,\n", 42.123);
- printf(" \"standard deviation (%%)\": %f,\n", 42.123);
- printf(" \"status\": \"%d\"\n", status);
- printf(" }");
- printf("\n");
-
- cairo_destroy (cr);
- cairo_surface_destroy (surface);
- return 0;
+test_fill(cairo_t *cr)
+{
+ randomize_color (cr);
+ cairo_fill_preserve (cr);
+ return 1;
}
-