pasort2 = pc_patch_sort(pa, X_Y, 2); CU_ASSERT_EQUAL(pc_patch_is_sorted(pasort2, X, 1, PC_TRUE), PC_TRUE); CU_ASSERT_EQUAL(pc_patch_is_sorted(pasort2, Y, 1, PC_TRUE), PC_TRUE); CU_ASSERT_EQUAL(pc_patch_is_sorted(pasort2, X_Y, 2, PC_TRUE), PC_TRUE); // free pcfree(wkb); pc_patch_free(pasort1); pc_patch_free(pasort2); pc_patch_free(pa); } /* REGISTER ***********************************************************/ CU_TestInfo sort_tests[] = { PC_TEST(test_sort_simple), PC_TEST(test_sort_consistency), PC_TEST(test_sort_one_point), PC_TEST(test_sort_stable), PC_TEST(test_sort_patch_is_sorted_no_compression), PC_TEST(test_sort_patch_is_sorted_compression_dimensional_none), PC_TEST(test_sort_patch_is_sorted_compression_dimensional_zlib), PC_TEST(test_sort_patch_is_sorted_compression_dimensional_sigbits), PC_TEST(test_sort_patch_is_sorted_compression_dimensional_rle), PC_TEST(test_sort_patch_ndims), CU_TEST_INFO_NULL }; CU_SuiteInfo sort_suite = { .pName = "sort", .pInitFunc = init_suite,
ibox[1][3] = 20.0; obox = li_box4d_affine(ibox, a, b, c, d, e, f, g, h, i, xoff, yoff, zoff); CU_ASSERT((*obox)[0][0] == -1.0); CU_ASSERT_DOUBLE_EQUAL((*obox)[0][1], -sqrt(2.0), 0.000001); CU_ASSERT_DOUBLE_EQUAL((*obox)[0][2], -sqrt(2.0), 0.000001); CU_ASSERT((*obox)[0][3] == 10.0); CU_ASSERT((*obox)[1][0] == 3.0); CU_ASSERT_DOUBLE_EQUAL((*obox)[1][1], sqrt(2.0), 0.000001); CU_ASSERT_DOUBLE_EQUAL((*obox)[1][2], sqrt(2.0), 0.000001); CU_ASSERT((*obox)[1][3] == 20.0); pcfree(obox); } /* REGISTER ***********************************************************/ CU_TestInfo li_box4d_tests[] = { PC_TEST(test_rotate_quaternion), PC_TEST(test_affine), CU_TEST_INFO_NULL }; CU_SuiteInfo li_box4d_suite = { .pName = "li_box4d", .pInitFunc = init_suite, .pCleanupFunc = clean_suite, .pTests = li_box4d_tests };
CU_ASSERT_STRING_EQUAL(str, "01000000000000000000000000000000000A00"); pcfree(str); pcfree(wkb); pc_point_free(pt); pc_patch_free(pa); pc_schema_free(nschema); pc_patch_free((PCPATCH*) pau); pc_pointlist_free(pl); } /* REGISTER ***********************************************************/ CU_TestInfo patch_tests[] = { PC_TEST(test_endian_flip), PC_TEST(test_patch_hex_in), PC_TEST(test_patch_hex_out), PC_TEST(test_schema_xy), PC_TEST(test_patch_dimensional), PC_TEST(test_patch_dimensional_compression), PC_TEST(test_patch_dimensional_extent), PC_TEST(test_patch_union), PC_TEST(test_patch_wkb), PC_TEST(test_patch_filter), #if defined(HAVE_LIBGHT) && defined(HAVE_LAZPERF) PC_TEST(test_patch_compress_from_ght_to_lazperf), #endif PC_TEST(test_patch_pointn_last_first), PC_TEST(test_patch_pointn_no_compression), PC_TEST(test_patch_pointn_dimensional_compression_none),
CU_ASSERT_DOUBLE_EQUAL(a3, b3, 0.0000001); CU_ASSERT_DOUBLE_EQUAL(a4, b4, 0.0000001); /* as a double array */ rv = pc_point_set_double_by_index(pt, 0, a1); rv = pc_point_set_double_by_index(pt, 1, a2); rv = pc_point_set_double_by_index(pt, 2, a3); rv = pc_point_set_double_by_index(pt, 3, a4); allvals = pc_point_to_double_array(pt); CU_ASSERT_DOUBLE_EQUAL(allvals[0], a1, 0.0000001); CU_ASSERT_DOUBLE_EQUAL(allvals[1], a2, 0.0000001); //printf("allvals[2]:%g\n", allvals[2]); CU_ASSERT_DOUBLE_EQUAL(allvals[2], a3, 0.0000001); //printf("allvals[3]:%g\n", allvals[3]); CU_ASSERT_DOUBLE_EQUAL(allvals[3], a4, 0.0000001); pcfree(allvals); pc_point_free(pt); } /* REGISTER ***********************************************************/ CU_TestInfo point_tests[] = { PC_TEST(test_point_hex_inout), PC_TEST(test_point_access), CU_TEST_INFO_NULL }; CU_SuiteInfo point_suite = {"point", init_suite, clean_suite, point_tests};
// pt XYMI = 1 2 3 4, scale = 1 2 4 1, geom XYM = 1 4 12 test_point_geometry_bytes(schema_xym, 5+3*8, "00000000010000000100000002000000030004", "0101000040000000000000F03F00000000000010400000000000002840" ); // pt XYZMI = 1 2 3 4 5, scale = 1 2 4 8 1, geom XYZM = 1 4 12 32 test_point_geometry_bytes(schema_xyzm, 5+4*8, "0000000001000000010000000200000003000000040005", "01010000C0000000000000F03F000000000000104000000000000028400000000000004040" ); } /* REGISTER ***********************************************************/ CU_TestInfo point_tests[] = { PC_TEST(test_point_hex_inout), PC_TEST(test_point_access), PC_TEST(test_point_xyzm), PC_TEST(test_point_geometry), CU_TEST_INFO_NULL }; CU_SuiteInfo point_suite = { .pName = "point", .pInitFunc = init_suite, .pCleanupFunc = clean_suite, .pTests = point_tests };
//cleaning pc_pointlist_free(pl1); pc_pointlist_free(pl2); pc_patch_free(pa1); pc_patch_free(pa3); //pc_patch_free(pa4); //pc_patch_free(pa2); return; } /* REGISTER ***********************************************************/ CU_TestInfo patch_tests[] = { PC_TEST(test_endian_flip), PC_TEST(test_patch_hex_in), PC_TEST(test_patch_hex_out), PC_TEST(test_schema_xy), PC_TEST(test_patch_dimensional), PC_TEST(test_patch_dimensional_compression), PC_TEST(test_patch_union), PC_TEST(test_patch_wkb), PC_TEST(test_patch_filter), PC_TEST(test_patch_subset), CU_TEST_INFO_NULL }; CU_SuiteInfo patch_suite = {"patch", init_suite, clean_suite, patch_tests};