Exemple #1
0
WAFFLE_API int32_t
waffle_attrib_list_length(const int32_t attrib_list[])
{

    wcore_error_reset();
    return wcore_attrib_list_length(attrib_list);
}
Exemple #2
0
static void
test_wcore_error_with_message(void **state) {
    wcore_error_reset();
    wcore_errorf(WAFFLE_ERROR_BAD_PARAMETER, "bad %s (0x%x)", "gl_api", 0x17);
    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_BAD_PARAMETER);
    assert_string_equal(wcore_error_get_info()->message, "bad gl_api (0x17)");
}
Exemple #3
0
static void
test_wcore_error_disable_then_error(void **state) {
    wcore_error_reset();
    wcore_error(WAFFLE_ERROR_NOT_INITIALIZED);
    WCORE_ERROR_DISABLED(
        wcore_error(WAFFLE_ERROR_BAD_ATTRIBUTE);
    );
Exemple #4
0
static void
test_wcore_error_code_bad_attribute(void **state) {
    wcore_error_reset();
    wcore_error(WAFFLE_ERROR_BAD_ATTRIBUTE);
    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_BAD_ATTRIBUTE);
    assert_string_equal(wcore_error_get_info()->message, "");
}
Exemple #5
0
static void
test_wcore_error_first_call_with_message_wins(void **state) {
    wcore_error_reset();
    wcore_errorf(WAFFLE_ERROR_UNKNOWN, "cookies");
    wcore_errorf(WAFFLE_NO_ERROR, "all is well");
    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_UNKNOWN);
    assert_string_equal(wcore_error_get_info()->message, "cookies");
}
Exemple #6
0
static void
test_wcore_error_first_call_without_message_wins(void **state) {
    wcore_error_reset();
    wcore_errorf(WAFFLE_ERROR_UNKNOWN, "cookies");
    wcore_error(WAFFLE_ERROR_BAD_ATTRIBUTE);
    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_UNKNOWN);
    assert_string_equal(wcore_error_get_info()->message, "cookies");
}
Exemple #7
0
static void
test_wcore_error_code_unknown_error(void **state) {
    wcore_error_reset();
    wcore_error(WAFFLE_ERROR_UNKNOWN);
    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_UNKNOWN);
    assert_string_equal(wcore_error_get_info()->message, "");

}
Exemple #8
0
WAFFLE_API bool
waffle_attrib_list_update(
        int32_t *attrib_list,
        int32_t key,
        int32_t value)
{
    wcore_error_reset();
    return wcore_attrib_list_update(attrib_list, key, value);
}
Exemple #9
0
WAFFLE_API bool
waffle_attrib_list_get(
        const int32_t *attrib_list,
        int32_t key,
        int32_t *value)
{
    wcore_error_reset();
    return wcore_attrib_list_get(attrib_list, key, value);
}
Exemple #10
0
WAFFLE_API bool
waffle_attrib_list_get_with_default(
        const int32_t attrib_list[],
        int32_t key,
        int32_t *value,
        int32_t default_value)
{
    wcore_error_reset();
    return wcore_attrib_list_get_with_default(attrib_list, key, value,
                                               default_value);
}
Exemple #11
0
static void
test_wcore_error_internal_error(void **state) {
    char error_location[1024];
    snprintf(error_location, 1024, "%s:%d:", __FILE__, __LINE__ + 3);

    wcore_error_reset();
    wcore_error_internal("%s zoroaster %d", "hello", 5);
    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_INTERNAL);
    assert_true(strstr(wcore_error_get_info()->message, "hello zoroaster 5"));
    assert_true(strstr(wcore_error_get_info()->message, error_location));
}
Exemple #12
0
bool
api_check_entry(const struct api_object *obj_list[], int length)
{
    wcore_error_reset();

    if (!api_platform) {
        wcore_error(WAFFLE_ERROR_NOT_INITIALIZED);
        return false;
    }

    for (int i = 0; i < length; ++i) {
        if (obj_list[i] == NULL) {
            wcore_errorf(WAFFLE_ERROR_BAD_PARAMETER, "null pointer");
            return false;
        }

        if (obj_list[i]->display_id != obj_list[0]->display_id) {
            wcore_error(WAFFLE_ERROR_BAD_DISPLAY_MATCH);
            return false;
        }
    }

    return true;
}