Exemplo n.º 1
0
void test_polygon__can_compute_longest_edge(void) {
	float longest2_quad = poly_max_edge_length2(quad);
	float longest2_right = poly_max_edge_length2(square);

	cl_assert_(longest2_quad == 1.0, "Longest squared side of a unit square is a unit");
	cl_assert_(longest2_right == 2.0, "Hyp^2 of right unit triangle is 2");
}
Exemplo n.º 2
0
void test_polygon__can_compute_min_edge(void) {
	float shortest2_quad = poly_min_edge_length2(quad);
	float shortest2_right = poly_min_edge_length2(square);

	cl_assert_(shortest2_quad == 1.0, "Shortest squared side of a unit square is a unit");
	cl_assert_(shortest2_right == 1.0, "Hyp^2 of right unit triangle is 2, and sides are 1");
}
Exemplo n.º 3
0
void test_bsp__tree_can_produce_triangles_from_quads(void) {
	klist_t(poly) *quad = kl_init(poly);
	// I'll make a quad by making a triangle with a missing
	// vertex, then pushing the extra vertex after and recomputing
	float3 quad_verts[] = {{-1.0, 1.0, 0.0},
						  {-1.0, -1.0, 0.0},
						  {1.0, -1.0, 0.0},
						  {1.0, 1.0, 0.0}};
	poly_t *poly = poly_make_triangle(quad_verts[0], quad_verts[1], quad_verts[2]);
	cl_assert_(poly != NULL, "Can't make triangle for test");

	poly_push_vertex(poly, quad_verts[3]);

	cl_assert_(poly_vertex_count(poly) == 4, "Failed to add vertex into quad");
	poly_update(poly);

	// Build a tree of the quad
	klist_t(poly) *lpoly = kl_init(poly);
	*kl_pushp(poly, lpoly) = poly;
	bsp_node_t *quad_bsp = bsp_build(NULL, lpoly, 1);
	cl_assert(quad_bsp);

	klist_t(poly) *tris = bsp_to_polygons(quad_bsp, 1, NULL);
	cl_assert_equal_i(tris->size, 2);

	kl_destroy(poly, quad);
	kl_destroy(poly, lpoly);
	if(tris) kl_destroy(poly, tris);
}
Exemplo n.º 4
0
void
test_searpc__pipe_large_request (void)
{
    gchar* result;
    GError *error = NULL;

    // 10MB
    int size = 10 * 1024 * 1024;
    GString *large_string = g_string_sized_new(size);
    while (large_string->len < size) {
        g_string_append(large_string, "aaaa");
    }

    // Large request
    result = searpc_client_call__string (client_with_pipe_transport, "get_substring", &error,
                                         2, "string", large_string->str, "int", 2);
    cl_assert_ (error == NULL, error ? error->message : "");
    cl_assert_ (strcmp(result, "aa") == 0, result);
    g_free (result);

    // Large request & Large response
    result = searpc_client_call__string (client_with_pipe_transport, "get_substring", &error,
                                         2, "string", large_string->str, "int", size - 2);
    cl_assert_ (error == NULL, error ? error->message : "");
    // cl_assert (strcmp(result, "aa") == 0);
    g_free (result);

    g_string_free (large_string, TRUE);
}
Exemplo n.º 5
0
void test_mtrx_suite__mtrx_make_diag_dom(void) {
  matrix_t *matrix = mtrx_init("1 -3 2; 3 -2 1; -1 2 4");
  cl_assert_(!mtrx_is_diag_dom(matrix), "Matrix should not be diag dom.");
  matrix_t *diag_dom_matrix = mtrx_make_diag_dom(matrix);
  cl_assert_(mtrx_is_diag_dom(diag_dom_matrix), "Matrix should be diag dom.");
  mtrx_destroy(matrix);
  mtrx_destroy(diag_dom_matrix);
}
Exemplo n.º 6
0
void test_mtrx_suite__mtrx_is_diag_dom(void) {
  matrix_t *matrix = mtrx_init("3 -2 1; 1 -3 2; -1 2 4");
  cl_assert_(mtrx_is_diag_dom(matrix), "Matrix should be diag dom.");
  mtrx_destroy(matrix);

  matrix = mtrx_init("-2 2 1; 1 3 2; 1 -2 0");
  cl_assert_(!mtrx_is_diag_dom(matrix), "Matrix should not be diag dom.");
  mtrx_destroy(matrix);
}
Exemplo n.º 7
0
void test_mtrx_suite__mtrx_inv(void) {
  matrix_t *matrix = mtrx_empty(3, 3);
  matrix->values[0][0] = 1;
  matrix->values[0][1] = 3;
  matrix->values[0][2] = 1;

  matrix->values[1][0] = 1;
  matrix->values[1][1] = 1;
  matrix->values[1][2] = 2;

  matrix->values[2][0] = 2;
  matrix->values[2][1] = 3;
  matrix->values[2][2] = 4;

  matrix_t *inv = mtrx_inv(matrix);
  cl_assert_(inv->values[0][0] == 2, "Inverse error!");
  cl_assert_(inv->values[0][1] == 9, "Inverse error!");
  cl_assert_(inv->values[0][2] == -5, "Inverse error!");

  cl_assert_(inv->values[1][0] == 0, "Inverse error!");
  cl_assert_(inv->values[1][1] == -2, "Inverse error!");
  cl_assert_(inv->values[1][2] == 1, "Inverse error!");

  cl_assert_(inv->values[2][0] == -1, "Inverse error!");
  cl_assert_(inv->values[2][1] == -3, "Inverse error!");
  cl_assert_(inv->values[2][2] == 2, "Inverse error!");

  mtrx_destroy(matrix);
  mtrx_destroy(inv);
}
Exemplo n.º 8
0
void test_mtrx_suite__mtrx_mult_simple(void) {
  matrix_t *A = mtrx_empty(3, 3);
  A->values[0][0] = 1;
  A->values[0][1] = 2;
  A->values[0][2] = 3;
  A->values[1][0] = 4;
  A->values[1][1] = 5;
  A->values[1][2] = 6;
  A->values[2][0] = 7;
  A->values[2][1] = 8;
  A->values[2][2] = 9;

  matrix_t *B = mtrx_mult(A, A);
  cl_assert_(B->values[0][0] == 30, "Multiplication error!");
  cl_assert_(B->values[0][1] == 36, "Multiplication error!");
  cl_assert_(B->values[0][2] == 42, "Multiplication error!");
  cl_assert_(B->values[1][0] == 66, "Multiplication error!");
  cl_assert_(B->values[1][1] == 81, "Multiplication error!");
  cl_assert_(B->values[1][2] == 96, "Multiplication error!");
  cl_assert_(B->values[2][0] == 102, "Multiplication error!");
  cl_assert_(B->values[2][1] == 126, "Multiplication error!");
  cl_assert_(B->values[2][2] == 150, "Multiplication error!");

  mtrx_destroy(A);
  mtrx_destroy(B);
}
Exemplo n.º 9
0
void test_mtrx_suite__mtrx_from_row_vector(void) {
  vector_t *vector = vctr_ones(5);
  matrix_t *matrix = mtrx_from_row_vector(vector);

  cl_assert_(matrix->rows == 1, "Conversion error.");
  cl_assert_(matrix->columns == 5, "Conversion error.");
  assert_all_elements_equal(matrix, 1);

  mtrx_destroy(matrix);
  vctr_destroy(vector);
}
Exemplo n.º 10
0
void test_mtrx_suite__mtrx_col_swap(void) {
  matrix_t *original = mtrx_rnd(10, 10, 100);
  matrix_t *copy = mtrx_copy(original);

  mtrx_col_swap(copy, 4, 5);

  for (size_t i = 0; i < original->rows; ++i) {
    cl_assert_(copy->values[i][4] == original->values[i][5],
        "Column swap error!");
    cl_assert_(copy->values[i][5] == original->values[i][4],
        "Column swap error!");
  }
  mtrx_destroy(original);
  mtrx_destroy(copy);
}
Exemplo n.º 11
0
void test_bsp__root_has_front_poly(void) {
	cl_assert_(bsp->front != NULL, "No front tree.");
	cl_assert_equal_i(bsp->front->polygons->size, 1);

	bsp_node_t *back_tree = bsp->front->back;
	cl_assert_(back_tree != NULL, "No front->back tree.");
	cl_assert_equal_i(back_tree->polygons->size, 1);

	cl_assert_(back_tree->back == NULL, "Too many back trees.");

	bsp_node_t *front_tree = bsp->front->front;
	cl_assert_(front_tree != NULL, "No front->front tree.");
	cl_assert_equal_i(front_tree->polygons->size, 1);

	cl_assert_(front_tree->back == NULL, "Too many front trees.");
}
Exemplo n.º 12
0
void test_bsp__tree_can_clip_tree(void) {
	klist_t(poly) *polys = kl_init(poly);
	float3 tr1[] = {{-0.2, 0.0, 0.0},
					{0.2, 0.0, 0.0},
					{0.0, 0.2, 0.0}};
	float3 tr2[] = {{-0.2, 0.0, 100.0},
					{0.2, 0.0, 100.0},
					{0.0, 0.2, 1000.0}};

	*kl_pushp(poly, polys) = poly_make_triangle(tr1[0], tr1[1], tr1[2]);
	*kl_pushp(poly, polys) = poly_make_triangle(tr2[0], tr2[1], tr2[2]);
	cl_assert_equal_i(polys->size, 2);

	bsp_node_t *tr_bsp = bsp_build(NULL, polys, 1);
	cl_assert(tr_bsp != NULL);

	cl_assert(bsp_clip(tr_bsp, cube_bsp) != NULL);

	klist_t(poly) *clipped = bsp_to_polygons(tr_bsp, 0, NULL);

	cl_assert_equal_i(clipped->size, 1);

	// Make sure we clipped the poly inside the cube, and kept
	// the poly outside
	float3 *v = &kl_val(kl_begin(clipped))->vertices[0];
	cl_assert_((*v)[2] >= 99.0, "Should have kept the vertex outside the cube, not inside.");

	kl_destroy(poly, polys);
}
Exemplo n.º 13
0
void test_mtrx_suite__mtrx_pow(void) {
  matrix_t *matrix = mtrx_empty(2, 2);
  matrix->values[0][0] = 1;
  matrix->values[0][1] = 2;
  matrix->values[1][0] = 3;
  matrix->values[1][1] = 4;

  matrix_t *result = mtrx_pw_pow(matrix, matrix);
  cl_assert_(result->values[0][0] == 1, "PW pow error!");
  cl_assert_(result->values[0][1] == 4, "PW pow error!");
  cl_assert_(result->values[1][0] == 27, "PW pow error!");
  cl_assert_(result->values[1][1] == 256, "PW pow error!");

  mtrx_destroy(matrix);
  mtrx_destroy(result);
}
Exemplo n.º 14
0
void test_mtrx_suite__mtrx_pw_mult(void) {
  matrix_t *matrix = mtrx_empty(2, 2);
  matrix->values[0][0] = 1;
  matrix->values[0][1] = 2;
  matrix->values[1][0] = 3;
  matrix->values[1][1] = 4;

  matrix_t *result = mtrx_pw_mult(matrix, matrix);
  cl_assert_(result->values[0][0] == 1, "PW multiplication error!");
  cl_assert_(result->values[0][1] == 4, "PW multiplication error!");
  cl_assert_(result->values[1][0] == 9, "PW multiplication error!");
  cl_assert_(result->values[1][1] == 16, "PW multiplication error!");

  mtrx_destroy(matrix);
  mtrx_destroy(result);
}
Exemplo n.º 15
0
void test_mtrx_suite__mtrx_not_eq_dim(void) {
  matrix_t *A = mtrx_empty(6, 10);
  matrix_t *B = mtrx_empty(10, 6);
  cl_assert_(!mtrx_eq_dim(A, B), "Matrices should not have equal dimensions.");
  mtrx_destroy(A);
  mtrx_destroy(B);
}
Exemplo n.º 16
0
void test_index_version__v4_uses_path_compression(void)
{
	git_index_entry entry;
	git_index *index;
	char path[250], buf[1];
	struct stat st;
	char i, j;

	memset(path, 'a', sizeof(path));
	memset(buf, 'a', sizeof(buf));

	memset(&entry, 0, sizeof(entry));
	entry.path = path;
	entry.mode = GIT_FILEMODE_BLOB;

	g_repo = cl_git_sandbox_init("indexv4");
	cl_git_pass(git_repository_index(&index, g_repo));

	/* write 676 paths of 250 bytes length */
	for (i = 'a'; i <= 'z'; i++) {
		for (j = 'a'; j < 'z'; j++) {
			path[ARRAY_SIZE(path) - 3] = i;
			path[ARRAY_SIZE(path) - 2] = j;
			path[ARRAY_SIZE(path) - 1] = '\0';
			cl_git_pass(git_index_add_frombuffer(index, &entry, buf, sizeof(buf)));
		}
	}

	cl_git_pass(git_index_write(index));
	cl_git_pass(p_stat(git_index_path(index), &st));

	/*
	 * Without path compression, the written paths would at
	 * least take
	 *
	 *    (entries * pathlen) = len
	 *    (676 * 250) = 169000
	 *
	 *  bytes. As index v4 uses suffix-compression and our
	 *  written paths only differ in the last two entries,
	 *  this number will be much smaller, e.g.
	 *
	 *    (1 * pathlen) + (675 * 2) = len
	 *    676 + 1350 = 2026
	 *
	 *    bytes.
	 *
	 *    Note that the above calculations do not include
	 *    additional metadata of the index, e.g. OIDs or
	 *    index extensions. Including those we get an index
	 *    of approx. 200kB without compression and 40kB with
	 *    compression. As this is a lot smaller than without
	 *    compression, we can verify that path compression is
	 *    used.
	 */
	cl_assert_(st.st_size < 75000, "path compression not enabled");

	git_index_free(index);
}
Exemplo n.º 17
0
void test_mtrx_suite__mtrx_subtract_null(void) {
  matrix_t *A = mtrx_empty(4, 2);
  matrix_t *B = mtrx_empty(2, 4);
  matrix_t *C = mtrx_subtract(A, B);
  cl_assert_(C == NULL, "Cannot subtract matrices with unequal dimensions.");
  mtrx_destroy(A);
  mtrx_destroy(B);
}
Exemplo n.º 18
0
void test_object_tree_read__largefile(void)
{
	git_reference *ref;
	git_commit *commit;
	git_tree *tree;
	git_oid oid;
	const git_tree_entry *entry;
	git_object *object;
	git_buf file = GIT_BUF_INIT;
	int fd;
	git_index *idx;

	if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE"))
		cl_skip();

	cl_git_pass(git_reference_lookup(&ref, g_repo, "refs/heads/master"));
	cl_git_pass(git_repository_index(&idx, g_repo));

	cl_git_pass(git_buf_puts(&file, git_repository_workdir(g_repo)));
	cl_git_pass(git_buf_joinpath(&file, file.ptr, BIGFILE));

	fd = p_open(git_buf_cstr(&file), O_CREAT|O_RDWR, 0644);
	cl_assert_(fd >= 0, "invalid file descriptor");

	cl_must_pass(p_fallocate(fd, 0, BIGFILE_SIZE));
	cl_must_pass(p_close(fd));

	cl_git_pass(git_index_add_bypath(idx, BIGFILE));
	cl_repo_commit_from_index(&oid, g_repo, NULL, 0, "bigfile");

	cl_git_pass(git_commit_lookup(&commit, g_repo, &oid));
	cl_git_pass(git_commit_tree(&tree, commit));

	entry = git_tree_entry_byname(tree, BIGFILE);
	cl_assert_(entry, "entry was NULL");

	cl_git_pass(git_tree_entry_to_object(&object, g_repo, entry));

	git_buf_dispose(&file);
	git_object_free(object);
	git_tree_free(tree);
	git_index_free(idx);
	git_commit_free(commit);
	git_reference_free(ref);
}
Exemplo n.º 19
0
void test_mtrx_suite__mtrx_eq(void) {
  matrix_t *A = mtrx_rnd(10, 10, 10);
  matrix_t *B = mtrx_copy(A);

  cl_assert_(mtrx_eq_within_tol(A, B, 0), "Matrices should be equal.");

  mtrx_destroy(A);
  mtrx_destroy(B);
}
Exemplo n.º 20
0
void test_reader__can_read_stl(void) {
	mesh_t *stl = reader_load(path_to_cube);
	cl_assert(stl != NULL);

	int poly_count = stl->poly_count(stl);
	cl_assert_((poly_count > 11) && (poly_count < 20), "A cube should have somewhere between 11-20 polys");

	stl->destroy(stl);
}
Exemplo n.º 21
0
static void assert_workdir_matches_tree(
    git_repository *repo, const git_oid *id, const char *root, bool recurse)
{
    git_object *obj;
    git_tree *tree;
    size_t i, max_i;
    git_buf path = GIT_BUF_INIT;

    if (!root)
        root = git_repository_workdir(repo);
    cl_assert(root);

    cl_git_pass(git_object_lookup(&obj, repo, id, GIT_OBJ_ANY));
    cl_git_pass(git_object_peel((git_object **)&tree, obj, GIT_OBJ_TREE));
    git_object_free(obj);

    max_i = git_tree_entrycount(tree);

    for (i = 0; i < max_i; ++i) {
        const git_tree_entry *te = git_tree_entry_byindex(tree, i);
        cl_assert(te);

        cl_git_pass(git_buf_joinpath(&path, root, git_tree_entry_name(te)));

        switch (git_tree_entry_type(te)) {
        case GIT_OBJ_COMMIT:
            assert_dir_exists(path.ptr);
            break;
        case GIT_OBJ_TREE:
            assert_dir_exists(path.ptr);
            if (recurse)
                assert_workdir_matches_tree(
                    repo, git_tree_entry_id(te), path.ptr, true);
            break;
        case GIT_OBJ_BLOB:
            switch (git_tree_entry_filemode(te)) {
            case GIT_FILEMODE_BLOB:
            case GIT_FILEMODE_BLOB_EXECUTABLE:
                assert_file_exists(path.ptr);
                /* because of cross-platform, don't confirm exec bit yet */
                break;
            case GIT_FILEMODE_LINK:
                cl_assert_(git_path_exists(path.ptr), path.ptr);
                /* because of cross-platform, don't confirm link yet */
                break;
            default:
                cl_assert(false); /* really?! */
            }
            break;
        default:
            cl_assert(false); /* really?!! */
        }
    }

    git_tree_free(tree);
    git_buf_free(&path);
}
Exemplo n.º 22
0
void test_polygon__inverting_top_makes_bottom_front(void) {
	cl_assert_equal_i(poly_classify_poly(top, bottom), BACK);
	poly_t *p = poly_invert(top);
	cl_assert_(p == top, "poly_invert() should return identity");

	cl_assert_equal_i(poly_classify_poly(top, bottom), FRONT);
	poly_update(top);
	cl_assert_equal_i(poly_classify_poly(top, bottom), FRONT);
}
Exemplo n.º 23
0
Arquivo: open.c Projeto: 1336/libgit2
void test_repo_open__gitlinked(void)
{
	/* need to have both repo dir and workdir set up correctly */
	git_repository *repo = cl_git_sandbox_init("empty_standard_repo");
	git_repository *repo2;

	make_gitlink_dir("alternate", "gitdir: ../empty_standard_repo/.git");

	cl_git_pass(git_repository_open(&repo2, "alternate"));

	cl_assert(git_repository_path(repo2) != NULL);
	cl_assert_(git__suffixcmp(git_repository_path(repo2), "empty_standard_repo/.git/") == 0, git_repository_path(repo2));
	cl_assert_equal_s(git_repository_path(repo), git_repository_path(repo2));

	cl_assert(git_repository_workdir(repo2) != NULL);
	cl_assert_(git__suffixcmp(git_repository_workdir(repo2), "alternate/") == 0, git_repository_workdir(repo2));

	git_repository_free(repo2);
}
Exemplo n.º 24
0
void test_mtrx_suite__mtrx_init(void) {
  matrix_t *master = mtrx_empty(2, 2);
  master->values[0][0] = 1.5;
  master->values[0][1] = 2;
  master->values[1][0] = -3.2;
  master->values[1][1] = 4.365;

  // Normal case.
  matrix_t *matrix = mtrx_init("1.5 2; -3.2 4.365");
  cl_assert_(mtrx_eq_within_tol(master, matrix, 0.00001), "Matrices inequal!");
  mtrx_destroy(matrix);

  // Weird spacing case.
  matrix = mtrx_init("  1.5 2  ; -3.2    4.365     ");
  cl_assert_(mtrx_eq_within_tol(master, matrix, 0.00001), "Matrices inequal!");
  mtrx_destroy(matrix);

  mtrx_destroy(master);
}
Exemplo n.º 25
0
void text_mtrx_suite__mtrx_get_row(void) {
  matrix_t *matrix = mtrx_rnd(10, 10, 100);
  vector_t *row = mtrx_get_row(matrix, 2);

  for (size_t i = 0; i < row->length; ++i)
    cl_assert_(row->values[i] == matrix->values[2][i], "get_row error!");

  mtrx_destroy(matrix);
  vctr_destroy(row);
}
Exemplo n.º 26
0
void text_mtrx_suite__mtrx_get_col(void) {
  matrix_t *matrix = mtrx_rnd(10, 10, 100);
  vector_t *col = mtrx_get_col(matrix, 2);

  for (size_t i = 0; i < col->length; ++i)
    cl_assert_(col->values[i] == matrix->values[i][2], "get_col error!");

  mtrx_destroy(matrix);
  vctr_destroy(col);
}
Exemplo n.º 27
0
void test_mtrx_suite__mtrx_sub_matrix(void) {
  matrix_t *matrix = mtrx_rnd(4, 4, 100);

  indexer_t *indexer = indexer_init(2);
  indexer->values[0] = 1;
  indexer->values[1] = 3;

  matrix_t *sub_matrix = mtrx_sub_matrix(matrix, indexer, indexer);

  cl_assert_(sub_matrix->values[0][0] == matrix->values[1][1],
      "Sub-matrix error!");
  cl_assert_(sub_matrix->values[0][1] == matrix->values[1][3],
      "Sub-matrix error!");
  cl_assert_(sub_matrix->values[1][0] == matrix->values[3][1],
      "Sub-matrix error!");
  cl_assert_(sub_matrix->values[1][1] == matrix->values[3][3],
      "Sub-matrix error!");

  mtrx_destroy(matrix);
  mtrx_destroy(sub_matrix);
}
Exemplo n.º 28
0
void test_mtrx_suite__mtrx_subtract_manual(void) {
  matrix_t *A = mtrx_empty(3, 2);
  A->values[0][0] = -3;
  A->values[0][1] = -2;
  A->values[1][0] = -1;
  A->values[1][1] = 0;
  A->values[2][0] = 1;
  A->values[2][1] = 2;

  matrix_t *B = mtrx_empty(3, 2);
  B->values[0][0] = -5;
  B->values[0][1] = 6;
  B->values[1][0] = -1;
  B->values[1][1] = 3;
  B->values[2][0] = 2;
  B->values[2][1] = -1;

  matrix_t *C = mtrx_subtract(A, B);
  cl_assert_(C->values[0][0] == 2, "Subtract error!");
  cl_assert_(C->values[0][1] == -8, "Subtract error!");
  cl_assert_(C->values[1][0] == 0, "Subtract error!");
  cl_assert_(C->values[1][1] == -3, "Subtract error!");
  cl_assert_(C->values[2][0] == -1, "Subtract error!");
  cl_assert_(C->values[2][1] == 3, "Subtract error!");

  mtrx_destroy(A);
  mtrx_destroy(B);
  mtrx_destroy(C);
}
Exemplo n.º 29
0
void test_mtrx_suite__mtrx_add_manual(void) {
  matrix_t *A = mtrx_empty(3, 2);
  A->values[0][0] = -3;
  A->values[0][1] = -2;
  A->values[1][0] = -1;
  A->values[1][1] = 0;
  A->values[2][0] = 1;
  A->values[2][1] = 2;

  matrix_t *B = mtrx_empty(3, 2);
  B->values[0][0] = -5;
  B->values[0][1] = 6;
  B->values[1][0] = -1;
  B->values[1][1] = 3;
  B->values[2][0] = 2;
  B->values[2][1] = -1;

  matrix_t *C = mtrx_add(A, B);
  cl_assert_(C->values[0][0] == -8, "Addition error!");
  cl_assert_(C->values[0][1] == 4, "Addition error!");
  cl_assert_(C->values[1][0] == -2, "Addition error!");
  cl_assert_(C->values[1][1] == 3, "Addition error!");
  cl_assert_(C->values[2][0] == 3, "Addition error!");
  cl_assert_(C->values[2][1] == 1, "Addition error!");

  mtrx_destroy(A);
  mtrx_destroy(B);
  mtrx_destroy(C);
}
Exemplo n.º 30
0
void
test_searpc__json_param_type (void)
{
    json_t *result;
    GError *error = NULL;

    json_t *param = json_object();
    json_object_set_new (param, "a", json_integer (1));
    json_object_set_new (param, "b", json_integer (2));

    result = searpc_client_call__json (client, "count_json_kvs",
                                       &error, 1,
                                       "json", param);

    cl_assert_ (error == NULL, error ? error->message : "");
    int count = json_integer_value(json_object_get((json_t*)result, "number_of_kvs"));
    char *msg = json_dumps(result, JSON_INDENT(2));
    cl_assert_(count == 2, msg);
    free (msg);
    json_decref(param);
    json_decref(result);
}