From: Emil Velikov <[email protected]> There is no need to (potentially) call the function twice in a roll, as there are no waffle calls inbetween that can trigger a change.
Use a switch (as opposed to if-else 'spaghetti'), which has the benefit of slightly improved readability. While we're here, fix the copy/paste in the related comment. Signed-off-by: Emil Velikov <[email protected]> --- tests/functional/gl_basic_test.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/functional/gl_basic_test.c b/tests/functional/gl_basic_test.c index 10a7af8..02d4712 100644 --- a/tests/functional/gl_basic_test.c +++ b/tests/functional/gl_basic_test.c @@ -320,15 +320,14 @@ gl_basic_draw__(void **state, struct gl_basic_draw_args__ args) assert_true(waffle_error_get_code() == expect_error); return; } else if (ts->config == NULL) { - if (waffle_error_get_code() == WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM) { - skip(); - } - else if (waffle_error_get_code() == WAFFLE_ERROR_UNKNOWN) { + switch (waffle_error_get_code()) { + case WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM: + // fall-through + case WAFFLE_ERROR_UNKNOWN: // Assume that the native platform rejected the requested - // context flavor. + // config flavor. skip(); - } - else { + default: assert_true(0); } } @@ -338,15 +337,14 @@ gl_basic_draw__(void **state, struct gl_basic_draw_args__ args) ts->ctx = waffle_context_create(ts->config, NULL); if (ts->ctx == NULL) { - if (waffle_error_get_code() == WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM) { - skip(); - } - else if (waffle_error_get_code() == WAFFLE_ERROR_UNKNOWN) { + switch (waffle_error_get_code()) { + case WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM: + // fall-through + case WAFFLE_ERROR_UNKNOWN: // Assume that the native platform rejected the requested // context flavor. skip(); - } - else { + default: assert_true(0); } } -- 2.6.2 _______________________________________________ waffle mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/waffle

