diff options
Diffstat (limited to 'libdimension/tests')
-rw-r--r-- | libdimension/tests/custom-error-fn.c | 2 | ||||
-rw-r--r-- | libdimension/tests/cxx.cpp | 4 | ||||
-rw-r--r-- | libdimension/tests/dictionary.c | 4 | ||||
-rw-r--r-- | libdimension/tests/display.c | 14 | ||||
-rw-r--r-- | libdimension/tests/error.c | 2 | ||||
-rw-r--r-- | libdimension/tests/gl.c | 16 | ||||
-rw-r--r-- | libdimension/tests/png.c | 14 | ||||
-rw-r--r-- | libdimension/tests/polynomial.c | 22 | ||||
-rw-r--r-- | libdimension/tests/pool.c | 2 | ||||
-rw-r--r-- | libdimension/tests/prtree.c | 2 | ||||
-rw-r--r-- | libdimension/tests/render.c | 24 | ||||
-rw-r--r-- | libdimension/tests/tests.h | 14 | ||||
-rw-r--r-- | libdimension/tests/unit-test.c | 12 | ||||
-rw-r--r-- | libdimension/tests/warning-as-error.c | 2 | ||||
-rw-r--r-- | libdimension/tests/warning.c | 2 |
15 files changed, 68 insertions, 68 deletions
diff --git a/libdimension/tests/custom-error-fn.c b/libdimension/tests/custom-error-fn.c index 9e12457..49a0f9e 100644 --- a/libdimension/tests/custom-error-fn.c +++ b/libdimension/tests/custom-error-fn.c @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *************************************************************************/ -/* Make sure that custom fatal error handlers work. */ +// Make sure that custom fatal error handlers work. #include "dimension.h" #include <stdlib.h> diff --git a/libdimension/tests/cxx.cpp b/libdimension/tests/cxx.cpp index 7405502..104ee1b 100644 --- a/libdimension/tests/cxx.cpp +++ b/libdimension/tests/cxx.cpp @@ -26,10 +26,10 @@ int main(void) { - /* Treat warnings as errors for tests */ + // Treat warnings as errors for tests dmnsn_die_on_warnings(true); - /* Make sure we can to bit-ops on this enum type */ + // Make sure we can to bit-ops on this enum type dmnsn_quality quality = DMNSN_RENDER_PIGMENT | DMNSN_RENDER_LIGHTS; return EXIT_SUCCESS; diff --git a/libdimension/tests/dictionary.c b/libdimension/tests/dictionary.c index ca0c6b0..117887a 100644 --- a/libdimension/tests/dictionary.c +++ b/libdimension/tests/dictionary.c @@ -86,12 +86,12 @@ DMNSN_TEST(dictionary, insert_overwrites) const int value1 = 123, value2 = 456; int value_out; - /* Insert and read back value1 */ + // Insert and read back value1 dmnsn_dictionary_insert(dict, "key", &value1); ck_assert(dmnsn_dictionary_get(dict, "key", &value_out)); ck_assert_int_eq(value_out, value1); - /* Insert and read back value2 */ + // Insert and read back value2 dmnsn_dictionary_insert(dict, "key", &value2); ck_assert(dmnsn_dictionary_get(dict, "key", &value_out)); ck_assert_int_eq(value_out, value2); diff --git a/libdimension/tests/display.c b/libdimension/tests/display.c index 133eb25..9cd71fe 100644 --- a/libdimension/tests/display.c +++ b/libdimension/tests/display.c @@ -31,7 +31,7 @@ struct dmnsn_display { XVisualInfo *vi; }; -/* XIfEvent callback */ +// XIfEvent callback static Bool WaitForNotify(Display *d, XEvent *e, char *arg) { @@ -60,14 +60,14 @@ dmnsn_new_display(const dmnsn_canvas *canvas) display->cx = NULL; display->vi = NULL; - /* Get an X connection */ + // Get an X connection display->dpy = XOpenDisplay(0); if (!display->dpy) { dmnsn_delete_display(display); return NULL; } - /* Get an appropriate visual */ + // Get an appropriate visual display->vi = glXChooseVisual(display->dpy, DefaultScreen(display->dpy), attributeList); if (!display->vi) { @@ -75,14 +75,14 @@ dmnsn_new_display(const dmnsn_canvas *canvas) return NULL; } - /* Create a GLX context */ + // Create a GLX context display->cx = glXCreateContext(display->dpy, display->vi, 0, GL_TRUE); if (!display->cx) { dmnsn_delete_display(display); return NULL; } - /* Create a color map */ + // Create a color map display->cmap = XCreateColormap(display->dpy, RootWindow(display->dpy, display->vi->screen), display->vi->visual, AllocNone); @@ -91,7 +91,7 @@ dmnsn_new_display(const dmnsn_canvas *canvas) return NULL; } - /* Create a window */ + // Create a window swa.colormap = display->cmap; swa.border_pixel = 0; swa.event_mask = StructureNotifyMask; @@ -111,7 +111,7 @@ dmnsn_new_display(const dmnsn_canvas *canvas) XMapWindow(display->dpy, display->win); XIfEvent(display->dpy, &display->event, WaitForNotify, (char*)display->win); - /* Connect the context to the window */ + // Connect the context to the window glXMakeCurrent(display->dpy, display->win, display->cx); glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); diff --git a/libdimension/tests/error.c b/libdimension/tests/error.c index f4ffcee..58a5b43 100644 --- a/libdimension/tests/error.c +++ b/libdimension/tests/error.c @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *************************************************************************/ -/* Make sure that errors terminate us - this test should fail */ +// Make sure that errors terminate us - this test should fail #include "dimension.h" #include <stdlib.h> diff --git a/libdimension/tests/gl.c b/libdimension/tests/gl.c index c46eada..262fecf 100644 --- a/libdimension/tests/gl.c +++ b/libdimension/tests/gl.c @@ -23,17 +23,17 @@ int main(void) { - /* Treat warnings as errors for tests */ + // Treat warnings as errors for tests dmnsn_die_on_warnings(true); - /* Allocate our canvas */ + // Allocate our canvas dmnsn_pool *pool = dmnsn_new_pool(); dmnsn_canvas *canvas = dmnsn_new_canvas(pool, 768, 480); - /* Paint the test pattern */ + // Paint the test pattern dmnsn_paint_test_canvas(canvas); - /* Create a new glX display */ + // Create a new glX display dmnsn_display *display = dmnsn_new_display(canvas); if (!display) { fprintf(stderr, "--- WARNING: Couldn't initialize X or glX! ---\n"); @@ -41,7 +41,7 @@ main(void) return EXIT_SUCCESS; } - /* Draw to OpenGL */ + // Draw to OpenGL printf("Drawing to OpenGL\n"); if (dmnsn_gl_write_canvas(canvas) != 0) { dmnsn_delete_display(display); @@ -55,14 +55,14 @@ main(void) * Now test GL import/export */ - /* Optimize the canvas for GL drawing */ + // Optimize the canvas for GL drawing if (dmnsn_gl_optimize_canvas(canvas) != 0) { dmnsn_delete_pool(pool); fprintf(stderr, "--- Couldn't optimize canvas for GL! ---\n"); return EXIT_FAILURE; } - /* Read the image back from OpenGL */ + // Read the image back from OpenGL printf("Reading from OpenGL\n"); if (dmnsn_gl_read_canvas(canvas, 0, 0) != 0) { dmnsn_delete_display(display); @@ -71,7 +71,7 @@ main(void) return EXIT_FAILURE; } - /* And draw it back */ + // And draw it back printf("Drawing to OpenGL\n"); if (dmnsn_gl_write_canvas(canvas) != 0) { dmnsn_delete_display(display); diff --git a/libdimension/tests/png.c b/libdimension/tests/png.c index ed64b39..1feff72 100644 --- a/libdimension/tests/png.c +++ b/libdimension/tests/png.c @@ -26,24 +26,24 @@ main(void) { int ret = EXIT_SUCCESS; - /* Treat warnings as errors for tests */ + // Treat warnings as errors for tests dmnsn_die_on_warnings(true); - /* Allocate our canvas */ + // Allocate our canvas dmnsn_pool *pool = dmnsn_new_pool(); dmnsn_canvas *canvas = dmnsn_new_canvas(pool, 768, 480); - /* Optimize the canvas for PNG export */ + // Optimize the canvas for PNG export if (dmnsn_png_optimize_canvas(canvas) != 0) { fprintf(stderr, "--- Couldn't optimize canvas for PNG! ---\n"); ret = EXIT_FAILURE; goto exit; } - /* Paint the test pattern */ + // Paint the test pattern dmnsn_paint_test_canvas(canvas); - /* Write the image to PNG */ + // Write the image to PNG printf("Writing scene to PNG\n"); FILE *ofile = fopen("png1.png", "wb"); @@ -66,7 +66,7 @@ main(void) * Now test PNG import/export */ - /* Read the image back from PNG */ + // Read the image back from PNG printf("Reading scene from PNG\n"); FILE *ifile = fopen("png1.png", "rb"); @@ -86,7 +86,7 @@ main(void) fclose(ifile); - /* And write it back */ + // And write it back printf("Writing scene to PNG\n"); ofile = fopen("png2.png", "wb"); diff --git a/libdimension/tests/polynomial.c b/libdimension/tests/polynomial.c index b734cc2..dc172d4 100644 --- a/libdimension/tests/polynomial.c +++ b/libdimension/tests/polynomial.c @@ -69,7 +69,7 @@ dmnsn_assert_roots(const double poly[], size_t degree, size_t nroots_ex, ...) DMNSN_TEST(linear, no_positive_roots) { - /* poly[] = x + 1 */ + // poly[] = x + 1 static const double poly[] = { [1] = 1.0, [0] = 1.0, @@ -79,7 +79,7 @@ DMNSN_TEST(linear, no_positive_roots) DMNSN_TEST(linear, one_root) { - /* poly[] = x - 1 */ + // poly[] = x - 1 static const double poly[] = { [1] = 1.0, [0] = -1.0, @@ -90,7 +90,7 @@ DMNSN_TEST(linear, one_root) DMNSN_TEST(quadratic, no_roots) { - /* poly[] = x^2 + 1 */ + // poly[] = x^2 + 1 static const double poly[] = { [2] = 1.0, [1] = 0.0, @@ -101,7 +101,7 @@ DMNSN_TEST(quadratic, no_roots) DMNSN_TEST(quadratic, no_positive_roots) { - /* poly[] = (x + 1)^2 */ + // poly[] = (x + 1)^2 static const double poly[] = { [2] = 1.0, [1] = 2.0, @@ -112,7 +112,7 @@ DMNSN_TEST(quadratic, no_positive_roots) DMNSN_TEST(quadratic, one_positive_root) { - /* poly[] = (x + 1)*(x - 1) */ + // poly[] = (x + 1)*(x - 1) static const double poly[] = { [2] = 1.0, [1] = 0.0, @@ -123,7 +123,7 @@ DMNSN_TEST(quadratic, one_positive_root) DMNSN_TEST(quadratic, two_roots) { - /* poly[] = (x - 1.2345)*(x - 2.3456) */ + // poly[] = (x - 1.2345)*(x - 2.3456) static const double poly[] = { [2] = 1.0, [1] = -3.5801, @@ -135,7 +135,7 @@ DMNSN_TEST(quadratic, two_roots) DMNSN_TEST(cubic, no_positive_roots) { - /* poly[] = x^3 + 1 */ + // poly[] = x^3 + 1 static const double poly[] = { [3] = 1.0, [2] = 0.0, @@ -147,7 +147,7 @@ DMNSN_TEST(cubic, no_positive_roots) DMNSN_TEST(cubic, one_root) { - /* poly[] = x^3 - 1 */ + // poly[] = x^3 - 1 static const double poly[] = { [3] = 1.0, [2] = 0.0, @@ -171,7 +171,7 @@ DMNSN_TEST(cubic, two_roots) DMNSN_TEST(cubic, three_roots) { - /* poly[] = (x - 1.2345)*(x - 2.3456)*(x - 100) */ + // poly[] = (x - 1.2345)*(x - 2.3456)*(x - 100) static const double poly[] = { [3] = 1.0, [2] = -103.5801, @@ -184,7 +184,7 @@ DMNSN_TEST(cubic, three_roots) DMNSN_TEST(quintic, four_roots) { - /* poly[] = 2*(x + 1)*(x - 1.2345)*(x - 2.3456)*(x - 5)*(x - 100) */ + // poly[] = 2*(x + 1)*(x - 1.2345)*(x - 2.3456)*(x - 5)*(x - 100) static const double poly[] = { [5] = 2.0, [4] = -215.1602, @@ -196,7 +196,7 @@ DMNSN_TEST(quintic, four_roots) dmnsn_assert_roots(poly, 5, 4, 1.2345, 2.3456, 5.0, 100.0); } -/* repeated_root[] = (x - 1)^6 */ +// repeated_root[] = (x - 1)^6 static const double repeated_root[7] = { [6] = 1.0, [5] = -6.0, diff --git a/libdimension/tests/pool.c b/libdimension/tests/pool.c index d12850d..83f25f7 100644 --- a/libdimension/tests/pool.c +++ b/libdimension/tests/pool.c @@ -46,7 +46,7 @@ DMNSN_TEST(pool, simple) *p = i; } - /* Leak checking will tell us if something bad happened */ + // Leak checking will tell us if something bad happened } static int counter = 0; diff --git a/libdimension/tests/prtree.c b/libdimension/tests/prtree.c index fdc5878..3c2b7bf 100644 --- a/libdimension/tests/prtree.c +++ b/libdimension/tests/prtree.c @@ -75,7 +75,7 @@ dmnsn_new_fake_object(dmnsn_pool *pool) int main(void) { - /* Treat warnings as errors for tests */ + // Treat warnings as errors for tests dmnsn_die_on_warnings(true); dmnsn_pool *pool = dmnsn_new_pool(); diff --git a/libdimension/tests/render.c b/libdimension/tests/render.c index 9b830f6..2588937 100644 --- a/libdimension/tests/render.c +++ b/libdimension/tests/render.c @@ -25,7 +25,7 @@ static void dmnsn_test_scene_set_defaults(dmnsn_pool *pool, dmnsn_scene *scene) { - /* Default texture */ + // Default texture scene->default_texture->pigment = dmnsn_new_solid_pigment(pool, DMNSN_TCOLOR(dmnsn_black)); dmnsn_finish *default_finish = &scene->default_texture->finish; default_finish->ambient = dmnsn_new_ambient( @@ -43,7 +43,7 @@ dmnsn_test_scene_add_canvas(dmnsn_pool *pool, dmnsn_scene *scene) static void dmnsn_test_scene_add_camera(dmnsn_pool *pool, dmnsn_scene *scene) { - /* Set up the transformation matrix for the perspective camera */ + // Set up the transformation matrix for the perspective camera dmnsn_matrix trans = dmnsn_scale_matrix( dmnsn_new_vector( ((double)scene->canvas->width)/scene->canvas->height, 1.0, 1.0 @@ -62,7 +62,7 @@ dmnsn_test_scene_add_camera(dmnsn_pool *pool, dmnsn_scene *scene) trans ); - /* Create a perspective camera */ + // Create a perspective camera scene->camera = dmnsn_new_perspective_camera(pool); scene->camera->trans = trans; } @@ -86,7 +86,7 @@ dmnsn_test_scene_add_background(dmnsn_pool *pool, dmnsn_scene *scene) dmnsn_new_vector(0.0, dmnsn_radians(53.0), 0.0) ); } else { - /* Loading png2.png failed, possibly compiled with --disable-png */ + // Loading png2.png failed, possibly compiled with --disable-png fprintf(stderr, "--- WARNING: Couldn't open or read png2.png! ---\n"); png_pigment = dmnsn_new_solid_pigment(pool, DMNSN_TCOLOR(dmnsn_orange)); } @@ -306,16 +306,16 @@ main(void) { int ret = EXIT_FAILURE; - /* Treat warnings as errors for tests */ + // Treat warnings as errors for tests dmnsn_die_on_warnings(true); dmnsn_display *display = NULL; - /* Create the test scene */ + // Create the test scene dmnsn_pool *pool = dmnsn_new_pool(); dmnsn_scene *scene = dmnsn_new_test_scene(pool); - /* Optimize the canvas for PNG export */ + // Optimize the canvas for PNG export bool have_png = true; errno = 0; if (dmnsn_png_optimize_canvas(scene->canvas) != 0) { @@ -327,7 +327,7 @@ main(void) } } - /* Optimize the canvas for GL drawing */ + // Optimize the canvas for GL drawing bool have_gl = true; errno = 0; if (dmnsn_gl_optimize_canvas(scene->canvas) != 0) { @@ -341,7 +341,7 @@ main(void) dmnsn_canvas_clear(scene->canvas, DMNSN_TCOLOR(dmnsn_black)); - /* Create a new glX display */ + // Create a new glX display if (have_gl) { display = dmnsn_new_display(scene->canvas); if (!display) { @@ -349,12 +349,12 @@ main(void) } } - /* Render the scene */ + // Render the scene printf("Rendering scene\n"); dmnsn_future *future = dmnsn_ray_trace_async(scene); - /* Display the scene as it's rendered */ + // Display the scene as it's rendered if (display) { while (!dmnsn_future_is_done(future)) { dmnsn_future_pause(future); @@ -373,7 +373,7 @@ main(void) goto exit; } - /* Make sure we show the completed rendering */ + // Make sure we show the completed rendering if (display) { printf("Drawing to OpenGL\n"); if (dmnsn_gl_write_canvas(scene->canvas) != 0) { diff --git a/libdimension/tests/tests.h b/libdimension/tests/tests.h index 0b8bfce..6e9ad21 100644 --- a/libdimension/tests/tests.h +++ b/libdimension/tests/tests.h @@ -24,19 +24,19 @@ #include <check.h> #ifdef __cplusplus -/* We've been included from a C++ file; mark everything here as extern "C" */ +// We've been included from a C++ file; mark everything here as extern "C" extern "C" { #endif -/** @internal Map to known test cases from their names. */ +/// @internal Map to known test cases from their names. extern dmnsn_dictionary* dmnsn_test_cases; -/** @internal Get the test case with the given name, possibly creating it. */ +/// @internal Get the test case with the given name, possibly creating it. TCase *dmnsn_get_test_case(const char* name); -/** @internal Default test fixture. */ +/// @internal Default test fixture. void dmnsn_test_setup(void); -/** @internal Default test fixture. */ +/// @internal Default test fixture. void dmnsn_test_teardown(void); /** @@ -121,11 +121,11 @@ typedef struct dmnsn_display dmnsn_display; dmnsn_display *dmnsn_new_display(const dmnsn_canvas *canvas); void dmnsn_delete_display(dmnsn_display *display); -/* Flush the GL buffers */ +// Flush the GL buffers void dmnsn_display_flush(dmnsn_display *display); #ifdef __cplusplus } #endif -#endif /* TESTS_H */ +#endif // TESTS_H diff --git a/libdimension/tests/unit-test.c b/libdimension/tests/unit-test.c index 2ba3baf..5d3f699 100644 --- a/libdimension/tests/unit-test.c +++ b/libdimension/tests/unit-test.c @@ -47,7 +47,7 @@ dmnsn_get_test_case(const char* name) void dmnsn_test_setup(void) { - /* Treat warnings as errors for tests */ + // Treat warnings as errors for tests dmnsn_die_on_warnings(true); } @@ -89,21 +89,21 @@ dmnsn_test_suite(void) int main(void) { - /* Treat warnings as errors for tests */ + // Treat warnings as errors for tests dmnsn_die_on_warnings(true); - /* Create the test suite */ + // Create the test suite Suite *suite = dmnsn_test_suite(); SRunner *sr = srunner_create(suite); - /* Run the tests */ + // Run the tests srunner_run_all(sr, CK_VERBOSE); int nfailed = srunner_ntests_failed(sr); - /* Clean up */ + // Clean up srunner_free(sr); - /* Return the right result code */ + // Return the right result code if (nfailed == 0) { return EXIT_SUCCESS; } else { diff --git a/libdimension/tests/warning-as-error.c b/libdimension/tests/warning-as-error.c index dfc08d6..7d0fdb7 100644 --- a/libdimension/tests/warning-as-error.c +++ b/libdimension/tests/warning-as-error.c @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *************************************************************************/ -/* Make sure warnings kill us in strict mode - this test should fail */ +// Make sure warnings kill us in strict mode - this test should fail #include "dimension.h" #include <stdlib.h> diff --git a/libdimension/tests/warning.c b/libdimension/tests/warning.c index 4e5dd75..cc1aed1 100644 --- a/libdimension/tests/warning.c +++ b/libdimension/tests/warning.c @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *************************************************************************/ -/* Make sure warnings don't kill us - this test should pass */ +// Make sure warnings don't kill us - this test should pass #include "dimension.h" #include <stdlib.h> |