Exemple #1
0
int main(int argc, char **argv)
{
  const Pvoid_t params = read_parameters();
  test_param(params, "test1", "1,2,3");
  test_param(params, "one two three", "dim\ndam\n");
  test_param(params, "dummy", "value");
  msg("All parameters ok!");

  const char DVAL[] = "dkey";
  p_entry *dkey = dxmalloc(sizeof(p_entry) + sizeof(DVAL));
  dkey->len = sizeof(DVAL) - 1;
  memcpy(dkey->data, DVAL, dkey->len);

  int i = 0;
  p_entry *key = NULL;
  p_entry *val = NULL;
  while (read_kv(&key, &val)){
    msg("Got key <%s> val <%s>", key->data, val->data);
    if (!key->len)
      key = dkey;
    write_num_prefix(3);
    write_kv(key, val);
    write_kv(key, val);
    write_kv(key, val);
    ++i;
  }
  msg("%d key-value pairs read ok", i);
  return 0;
}
static bool
test_tes_params(void)
{
	bool pass = true;
	int i;

	for (i = 0; i < ARRAY_SIZE(tes_params); ++i) {
		prog = piglit_build_simple_program_multiple_shaders(
				GL_VERTEX_SHADER, vs_source,
				GL_TESS_EVALUATION_SHADER, tes_params[i].source,
				0);

		pass = test_param(GL_TESS_GEN_MODE,
				  tes_params[i].prim_mode,
				  tes_params[i].source) && pass;
		pass = test_param(GL_TESS_GEN_SPACING,
				  tes_params[i].vertex_spacing,
				  tes_params[i].source) && pass;
		pass = test_param(GL_TESS_GEN_VERTEX_ORDER,
				  tes_params[i].ordering,
				  tes_params[i].source) && pass;
		pass = test_param(GL_TESS_GEN_POINT_MODE,
				  tes_params[i].point_mode,
				  tes_params[i].source) && pass;

		glDeleteProgram(prog);
	}
	return pass;
}
Exemple #3
0
static int get_test_param(int idx, int def)
{
	char *p = test_param(idx);

	if (!p)
		return def;

	return atoi(p);
}
Exemple #4
0
int main()
{
    test_bool_vals();
    test_bool_ops();
    test_cmp_ops();
    test_arithmetic();
    test_attr();
    test_param();
    test_compound();
    test_conv();

    return 0;
}
Exemple #5
0
int main()
{
    int tx_port = 0;
    char *source = "test/test_defs.b";

    sys_init(0);
    tx_server(source, "bin/state", &tx_port);
    vol_init(0, "bin/volume");

    char *code = sys_load(source);
    env = env_new(source, code);
    mem_free(code);

    int len = 0;
    char **files = sys_list("test/data", &len);

    vars = vars_new(len);
    rvars = vars_new(len);
    for (int i = 0; i < len; ++i) {
        vars_add(rvars, files[i], 0, NULL);
        vars_add(vars, files[i], 0, NULL);
    }
    vars_add(vars, "___param", 0, NULL);

    test_vars();
    test_load();
    test_param();
    test_clone();
    test_eq();
    test_store();
    test_select();
    test_rename();
    test_extend();
    test_join();
    test_project();
    test_semidiff();
    test_summary();
    test_union();
    test_compound();
    test_call();

    tx_free();
    env_free(env);
    mem_free(files);
    vars_free(vars);
    vars_free(rvars);

    return 0;
}