PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches
cu_in_encoded_polyline.c
Go to the documentation of this file.
1/**********************************************************************
2*
3* PostGIS - Spatial Types for PostgreSQL
4* http://postgis.net
5*
6* Copyright 2014 Kashif Rasul <kashif.rasul@gmail.com> and
7* Shoaib Burq <saburq@gmail.com>
8*
9* This is free software; you can redistribute and/or modify it under
10* the terms of the GNU General Public Licence. See the COPYING file.
11*
12**********************************************************************/
13
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17#include "CUnit/Basic.h"
18
19#include "liblwgeom_internal.h"
20#include "cu_tester.h"
21
22static void do_encoded_polyline_test(char * in, int precision, char * out)
23{
24 LWGEOM *g;
25 char * h;
26 size_t size;
27
29 h = lwgeom_to_wkt(g, WKT_EXTENDED, 15, &size);
30
31 if (strcmp(h, out))
32 fprintf(stderr, "\nIn: %s\nOut: %s\nTheo: %s\n", in, h, out);
33
34 ASSERT_STRING_EQUAL(h, out);
35
36 lwgeom_free(g);
37 if ( h ) lwfree(h);
38}
39
41{
43 "_p~iF~ps|U_ulLnnqC_mqNvxq`@",
44 5,
45 "SRID=4326;LINESTRING(-120.2 38.5,-120.95 40.7,-126.453 43.252)");
46}
47
49{
51 "o}~~|AdshNoSsBgd@eGoBlm@wKhj@~@?",
52 6,
53 "SRID=4326;LINESTRING(-0.250691 49.283048,-0.250633 49.283376,-0.250502 49.283972,-0.251245 49.284028,-0.251938 49.284232,-0.251938 49.2842)");
54}
55
56/*
57** Used by test harness to register the tests in this file.
58*/
61{
62 CU_pSuite suite = CU_add_suite("encoded_polyline_input", NULL, NULL);
65}
static void in_encoded_polyline_test_precision(void)
void in_encoded_polyline_suite_setup(void)
static void do_encoded_polyline_test(char *in, int precision, char *out)
static void in_encoded_polyline_test_geoms(void)
static uint8_t precision
Definition cu_in_twkb.c:25
#define PG_ADD_TEST(suite, testfunc)
#define ASSERT_STRING_EQUAL(o, e)
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define WKT_EXTENDED
Definition liblwgeom.h:2221
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
Definition lwout_wkt.c:708
LWGEOM * lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision)
Create an LWGEOM object from an Encoded Polyline representation.
void lwfree(void *mem)
Definition lwutil.c:248