Example #1
0
enum piglit_result
piglit_display(void)
{
	static const char *fp_source =
		"!!ARBfp1.0\n"
		"TEX result.color, fragment.texcoord[0], texture[1], 2D;\n"
		"END\n";
	bool pass = true;
	GLuint tex;
	GLuint prog;

	texrect_w = piglit_width / 4 / 2;
	texrect_h = piglit_height / 2;

	glGenProgramsARB(1, &prog);
	glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog);
	glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB,
			   GL_PROGRAM_FORMAT_ASCII_ARB,
			   strlen(fp_source),
			   (const GLubyte *) fp_source);

	glEnable(GL_FRAGMENT_PROGRAM_ARB);

	glActiveTexture(GL_TEXTURE1);
	tex = piglit_rgbw_texture(GL_RGBA, 2, 2, false, false,
				  GL_UNSIGNED_NORMALIZED);

	/* Given that the failure mode we had that led to this test
	 * being written was that the sampler state read was
	 * pseudo-random, go through several statechanges on the
	 * sampler to make sure we're reliably getting our sampler
	 * state.
	 */
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	piglit_draw_rect_tex(-1, -1, 0.5, 2,
			     0, 0, 1, 1);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	piglit_draw_rect_tex(-0.5, -1, 0.5, 2,
			     0, 0, 1, 1);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	piglit_draw_rect_tex(0, -1, 0.5, 2,
			     0, 0, 1, 1);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	piglit_draw_rect_tex(0.5, -1, 0.5, 2,
			     0, 0, 1, 1);

	pass = pass && test_nearest(piglit_width * 0 / 4);
	pass = pass && test_linear(piglit_width * 1 / 4);
	pass = pass && test_nearest(piglit_width * 2 / 4);
	pass = pass && test_linear(piglit_width * 3 / 4);

	piglit_present_results();

	glDeleteTextures(1, &tex);
	glDisable(GL_FRAGMENT_PROGRAM_ARB);
	glDeleteProgramsARB(1, &prog);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Example #2
0
File: test.c Project: FMX/gsl
int
main (void)
{
  gsl_ieee_env_setup();

  /* test linear regression */
  test_linear();

  /* test nonlinear regression */
  test_nonlinear();

  exit (gsl_test_summary ());
}
Example #3
0
int 
main (int argc, char **argv)
{
  int status = 0;

  argc = 0;    /* prevent warnings about unused parameters */
  argv = 0;

  status += test_bsearch();
  status += test_linear();
  status += test_cspline();
  status += test_akima();

  exit (gsl_test_summary());
}
Example #4
0
int main(void)
{
    int ret = 0;

    randinit(&state);
    checkpoint_rand("First Random Word: ");

    ret |= test_rand();
    ret |= test_linear();
    ret |= test_quadratic();

    checkpoint_rand("Last Random Word: ");
    randclear(state);

    return ret;
}
Example #5
0
int main()
{
  int error = 0;
  check_offloading();

  // Clauses
  error += test_aligned();
  error += test_collapsed();
  error += test_lastprivate();
  error += test_linear();
  error += test_private();
  error += test_safelen();

  // report
  printf("done with %d errors\n", error);
  return error;
}
Example #6
0
int main( int argc, char *argv[] )
{   
	test_linear();		
    return 0;
}
Example #7
0
static void test_lookup(void) {
    bool set[64];
    uint8_t data[64];

    printf("size,dicho,linear\n");
    for (int i = 1 ; i < 64 ; ++i) {
        if (i > 32) {
            int selected = 64;
            memset(set, 1, 64 * sizeof(bool));
            while (selected > i) {
                int val = rand() % 64;
                if (set[val]) {
                    set[val] = false;
                    --selected;
                }
            }
        } else {
            int selected = 0;
            memset(set, 0, 64 * sizeof(bool));
            while (selected < i) {
                int val = rand() % 64;
                if (!set[val]) {
                    set[val] = true;
                    ++selected;
                }
            }
        }
        int pos = 0;
        for (int j = 0 ; j < 64 ; ++j) {
            if (set[j]) {
                data[pos] = j;
                ++pos;
            }
        }

        struct timeval start, end;
        double diff_dicho, diff_linear;
        const int iterations = 50000000;

        gettimeofday(&start, NULL);
        for (int k = 0 ; k < iterations ; ++k) {
            for (int j = 0 ; j < 64 ; ++j) {
                test_dicho(data, i, j);
            }
        }
        gettimeofday(&end, NULL);
        diff_dicho = ((end.tv_sec - start.tv_sec) * 10.0)
             + (double)(end.tv_usec - start.tv_usec) / 10e5;

        gettimeofday(&start, NULL);
        for (int k = 0 ; k < iterations ; ++k) {
            for (int j = 0 ; j < 64 ; ++j) {
                test_linear(data, i, j);
            }
        }
        gettimeofday(&end, NULL);
        diff_linear = ((end.tv_sec - start.tv_sec) * 10.0)
             + (double)(end.tv_usec - start.tv_usec) / 10e5;
        printf("%d,%d,%d\n", i, (int)diff_dicho, (int)diff_linear);
    }
}