コード例 #1
0
ファイル: simple.c プロジェクト: 6thimage/pal
int tc_against_gold_v(struct ut_suite *suite, struct ut_tcase *tcase)
{
    size_t i;

    /* Skip test if we're generation gold data */
    if (generate_gold_flag)
        return UT_SKIP;

    for (i = 0; i < gold_size; i++) {
#if IS_UNARY
        ut_assert_msg(compare(res[i], gold[i].gold), "%s(%f): %f != %f",
                      XSTRING(FUNCTION), ai[i], res[i], gold[i].gold);
#else
        ut_assert_msg(compare(res[i], gold[i].gold), "%s(%f, %f): %f != %f",
                      XSTRING(FUNCTION), ai[i], bi[i], res[i], gold[i].gold);
#endif
#ifdef SCALAR_OUTPUT /* Scalar output so only first address is valid */
        i++;
        break;
#endif
    }
    ut_assert_msg(res[i] == OUTPUT_END_MARKER,
                  "Output end marker was overwritten");

    return 0;
}
コード例 #2
0
ファイル: check_p_xcorr_f32.c プロジェクト: joerg-h/pal
int tc_against_gold_v(struct ut_suite *suite, struct ut_tcase *tcase)
{
    size_t i;
    for (i = 0; i < ARRAY_SIZE(out1); i++) {
        ut_assert_msg(check_data(test_out1[i], out1[i], MAX_REL_DIFF) == OK,
                      "p_xcorr_f32() Test 1: Large diff for index: %d, ref: %f, test: %f, rel: %f\n",
                      i, out1[i], test_out1[i], test_out1[i]/out1[i]);
    }

    for (i = 0; i < ARRAY_SIZE(out2); i++) {
        ut_assert_msg(check_data(test_out2[i], out2[i], MAX_REL_DIFF) == OK,
                      "p_xcorr_f32() Test 1: Large diff for index: %d, ref: %f, test: %f, rel: %f\n",
                      i, out2[i], test_out2[i], test_out2[i]/out2[i]);
    }

#if 0
    //  This test is not used, since the code today requires nx >= ny
    for (i = 0; i < ARRAY_SIZE(out3); i++) {
        ut_assert_msg(check_data(test_out3[i], out3[i], MAX_REL_DIFF) == OK,
                      "p_xcorr_f32() Test 1: Large diff for index: %d, ref: %f, test: %f, rel: %f\n",
                      i, out3[i], test_out3[i], test_out3[i]/out3[i]);
    }
#endif

    return 0;
}
コード例 #3
0
ファイル: check_p_box3x3_f32.c プロジェクト: hongyunnchen/pal
int tc_against_gold_v(struct ut_suite *suite, struct ut_tcase *tcase)
{
    size_t i;
    for (i = 0; i < ARRAY_SIZE(expected); i++) {
        ut_assert_msg(compare(test_out[i], expected[i]),
                      "p_box3x3_f32(): Large diff for index: %d, ref: %f, test: %f, diff: %f\n",
                      i, expected[i], test_out[i], expected[i]-test_out[i]);
    }

    ut_assert_msg((*(int*)(&test_out[ARRAY_SIZE(test_out) - 1]) == CANARY),
                  "p_box3x3_f32(): CANARY overwritten\n");

    return 0;
}
コード例 #4
0
ファイル: check_p_sincos.c プロジェクト: ifzz/pal
int tc_against_ref_v(struct ut_suite *suite, struct ut_tcase *tcase)
{
    size_t i;

    for (i = 0; i < gold_size; i++) {
        ut_assert_msg(compare(resSin[i], sinf(gold[i].ai)),
                      "p_sincos_f32(%f): sin: %f != %f",
                      ai[i], resSin[i], sinf(gold[i].ai));
        ut_assert_msg(compare(resCos[i], cosf(gold[i].ai)),
                      "p_sincos_f32(%f): cos: %f != %f",
                      ai[i], resCos[i], cosf(gold[i].ai));
    }

    return 0;
}
コード例 #5
0
ファイル: check_p_sincos.c プロジェクト: ifzz/pal
int tc_against_gold_v(struct ut_suite *suite, struct ut_tcase *tcase)
{
    size_t i;

    for (i = 0; i < gold_size; i++) {
        ut_assert_msg(compare(resSin[i], gold[i].bi),
                      "p_sincos(%f): sin: %f != %f",
                      ai[i], resSin[i], gold[i].bi);
        ut_assert_msg(compare(resCos[i], gold[i].gold),
                      "p_sincos(%f): cos: %f != %f",
                      ai[i], resCos[i], gold[i].gold);
    }
    ut_assert_msg(resSin[i] == OUTPUT_END_MARKER,
                  "Output end marker was overwritten");
    ut_assert_msg(resCos[i] == OUTPUT_END_MARKER,
                  "Output end marker was overwritten");

    return 0;
}
コード例 #6
0
int tc_against_gold_v(struct ut_suite *suite, struct ut_tcase *tcase)
{
    size_t i;

    for ( i = 0; i < out_size; i++ ) {
        ut_assert_msg((check_data(test_out[i], out[i], MAX_REL_DIFF) == OK),
                      "p_rgb2greyscale_f32(): Large diff for index: %d, ref: %f, test: %f, rel: %f\n",
                      i, out[i], test_out[i], out[i]/test_out[i]);
    }

    return 0;
}
コード例 #7
0
ファイル: simple.c プロジェクト: 6thimage/pal
int tc_against_ref_v(struct ut_suite *suite, struct ut_tcase *tcase)
{
    size_t i;

    generate_ref(ref, gold_size);

    for (i = 0; i < gold_size; i++) {
#if IS_UNARY
        ut_assert_msg(compare(res[i], ref[i]), "%s(%f): %f != %f",
                      XSTRING(FUNCTION), ai[i], res[i], ref[i]);
#else
        ut_assert_msg(compare(res[i], ref[i]), "%s(%f, %f): %f != %f",
                      XSTRING(FUNCTION), ai[i], bi[i], res[i], ref[i]);
#endif
#ifdef SCALAR_OUTPUT /* Scalar output so only first address is valid */
        i++;
        break;
#endif
    }

    return 0;
}