PostGIS  2.4.9dev-r@@SVN_REVISION@@
cu_bytebuffer.c
Go to the documentation of this file.
1 /**********************************************************************
2  * $Id$
3  *
4  * PostGIS - Spatial Types for PostgreSQL
5  * http://postgis.net
6  *
7  * Copyright 2012 Sandro Santilli <strk@kbt.io>
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 "bytebuffer.h"
20 #include "cu_tester.h"
21 
22 #if 0
23 
24 static void test_bytebuffer_append(void)
25 {
26  bytebuffer_t *bb1;
27  int64_t res;
29 
30  bytebuffer_append_varint(bb1,(int64_t) -12345);
31 
32 
34 
35  res= bytebuffer_read_varint(bb1);
36 
37  CU_ASSERT_EQUAL(res, -12345);
38 
39  bytebuffer_destroy(bb1);
40 }
41 
42 
43 /* TODO: add more... */
44 
45 
46 
47 /*
48 ** Used by the test harness to register the tests in this file.
49 */
50 void bytebuffer_suite_setup(void);
51 void bytebuffer_suite_setup(void)
52 {
53  PG_TEST(test_bytebuffer_append),
54  CU_TEST_INFO_NULL
55 };
56 CU_SuiteInfo bytebuffer_suite = {"bytebuffer", NULL, NULL, bytebuffer_tests };
57 
58 #endif
int64_t bytebuffer_read_varint(bytebuffer_t *b)
Reads a signed varInt from the buffer.
Definition: bytebuffer.c:353
tuple res
Definition: window.py:78
bytebuffer_t * bytebuffer_create_with_size(size_t size)
Allocate a new bytebuffer_t.
Definition: bytebuffer.c:44
void bytebuffer_reset_reading(bytebuffer_t *s)
Set the read cursor to the beginning.
Definition: bytebuffer.c:119
void bytebuffer_destroy(bytebuffer_t *s)
Free the bytebuffer_t and all memory managed within it.
Definition: bytebuffer.c:91
void bytebuffer_append_varint(bytebuffer_t *b, const int64_t val)
Writes a signed varInt to the buffer.
Definition: bytebuffer.c:239