8000 Move existing wrappers tests to TAP tests · postgrespro/libblobstamper@88d6e72 · GitHub
[go: up one dir, main page]

Skip to content

Commit 88d6e72

Browse files
Move existing wrappers tests to TAP tests
1 parent 079fe9a commit 88d6e72

File tree

4 files changed

+59
-37
lines changed

4 files changed

+59
-37
lines changed

Makefile

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,31 @@ blobstamper/stamp.o \
1212
blobstamper/stamp_atomic.o \
1313
blobstamper/stamp_pg_type_geo.o \
1414

15+
WRAPPERS_OBJ = pg_op_wrappers.o
1516

1617

17-
.PHONY: all
18-
all: blob-stamper-all test test_pg_op_wrappers
18+
.PHONY: all blob-stamper-all blob-stamper-clean clean test
19+
all: blob-stamper-all $(WRAPPERS_OBJ)
1920
@echo All done!
2021

21-
.PHONY: blob-stamper-all
2222
blob-stamper-all:
2323
$(MAKE) -C blobstamper
2424

25-
test_pg_op_wrappers: blob-stamper-all $(LIB_OBJS) test_pg_op_wrappers.o pg_op_wrappers.o
26-
$(CXX) $(LDFLAGS) $@.o -o $@ $(LDLIBS) $(BLOB_STAMPER_OBJ) pg_op_wrappers.o
27-
2825
%.o: %.cpp $(DEPS)
2926
$(CXX) -c -g $(CFLAGS) $<
3027

3128
%.o: %.c $(DEPS)
3229
$(CC) -c -g $(CXXFLAGS) $<
3330

34-
.PHONY: blob-stamper-clean
35-
3631
blob-stamper-clean:
3732
$(MAKE) -C blobstamper clean
3833
$(MAKE) -C t clean
3934
$(MAKE) -C libtappp clean
4035

41-
42-
43-
.PHONY: clean
4436
clean: blob-stamper-clean
45-
rm -f *.o test test_pg_op_wrappers test_libblobstamper
37+
rm -f *.o
4638
@echo Clean done!
4739

48-
.PHONY: test
49-
5040
test:
5141
$(MAKE) -C t test
5242

t/700-wrapper-pg-type-geo.cpp

Lines changed: 53 additions & 0 deletions
26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <string.h>
2+
3+
#include <exception>
4+
#include <string>
5+
#include <cstdlib>
6+
7+
#define WANT_TEST_EXTRAS
8+
#include <tap++/tap++.h>
9+
10+
#include <string.h>
11+
#include <stdio.h>
12+
#include <stdlib.h>
13+
14+
extern "C" {
15+
#include "pg_op_wrappers.h"
16+
}
17+
18+
using namespace TAP;
19+
20+
21+
/* Tests for postgres geo type stamps */
22+
23+
double sample_data[] = {1, 2, 3, 4.2e01, 5, 6, 7};
24+
25+
int
+
main()
27+
{
28+
char * char_sample_data = (char *) sample_data;
29+
size_t sample_data_size = sizeof(double) * 7;
30+
31+
TEST_START(3);
32+
{
33+
char *res1, *res2;
34+
poly_contain_prepare(char_sample_data, sample_data_size, &res1, &res2);
35+
36+
ok(!strcmp(res1, "(1, 2)"),"first argument of poly_contain_pt op");
37+
ok(!strcmp(res2, "((3, 42), (5, 6))"),"second argument of poly_contain_pt op");
38+
39+
if (res1) free(res1);
40+
if (res2) free(res2);
41+
}
42+
43+
{
44+
char *res;
45+
poly_center_prepare(char_sample_data, sample_data_size, &res);
46+
47+
ok(!strcmp(res, "((1, 2), (3, 42), (5, 6))"),"the only argument of poly_center op");
48+
49+
if (res) free(res);
50+
}
51+
52+
TEST_END;
53+
}

t/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ DEBUG := -ggdb3 -DDEBUG
66
CXXFLAGS := $(DEBUG) $(WARNINGS) -fPIC
77
PREFIX := /usr/local
88
LIBRARY_VAR := LD_LIBRARY_PATH
9-
TEST_GOALS := ./00-sanity.t ./001-blob-generic.t ./100-stamp-base.t ./110-stamp-atomic.t ./500-stamp-pg-type-geo.t
9+
TEST_GOALS := ./00-sanity.t ./001-blob-generic.t ./100-stamp-base.t ./110-stamp-atomic.t ./500-stamp-pg-type-geo.t ./700-wrapper-pg-type-geo.t
1010

1111
all: $(TEST_GOALS)
1212

@@ -18,6 +18,7 @@ BLOB_STAMPER_OBJ = ../blobstamper/blob.o \
1818
../blobstamper/stamp.o \
1919
../blobstamper/stamp_atomic.o \
2020
../blobstamper/stamp_pg_type_geo.o \
21+
../pg_op_wrappers.o \
2122

2223

2324
build-libtappp:

test_pg_op_wrappers.c

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0