Started writing basic regression tests
This commit is contained in:
parent
d52f8f7555
commit
608607e3bd
|
@ -1,5 +1,9 @@
|
||||||
*.swp
|
*.swp
|
||||||
*.o
|
*.o
|
||||||
*.so
|
*.so
|
||||||
tools/get_sizeof_phone_number
|
/tools/get_sizeof_phone_number
|
||||||
/pg_libphonenumber--*.sql
|
/pg_libphonenumber--*.sql
|
||||||
|
regression.diffs
|
||||||
|
regression.out
|
||||||
|
/results/
|
||||||
|
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -5,10 +5,13 @@ EXTENSION := pg_libphonenumber
|
||||||
version := 1.0
|
version := 1.0
|
||||||
extension_script := $(EXTENSION)--$(version).sql
|
extension_script := $(EXTENSION)--$(version).sql
|
||||||
DATA_built := $(extension_script)
|
DATA_built := $(extension_script)
|
||||||
|
REGRESS := regression
|
||||||
|
|
||||||
|
#Build options
|
||||||
cpp_files := $(wildcard *.cpp)
|
cpp_files := $(wildcard *.cpp)
|
||||||
|
|
||||||
MODULE_big := pg_libphonenumber
|
MODULE_big := pg_libphonenumber
|
||||||
|
|
||||||
OBJS := $(patsubst %.cpp,%.o,$(cpp_files))
|
OBJS := $(patsubst %.cpp,%.o,$(cpp_files))
|
||||||
PG_CPPFLAGS := -fPIC -std=c++11
|
PG_CPPFLAGS := -fPIC -std=c++11
|
||||||
ifeq ($(CONFIG),debug)
|
ifeq ($(CONFIG),debug)
|
||||||
|
@ -18,12 +21,15 @@ else
|
||||||
endif
|
endif
|
||||||
SHLIB_LINK := -lphonenumber -lstdc++
|
SHLIB_LINK := -lphonenumber -lstdc++
|
||||||
|
|
||||||
|
#Clean options
|
||||||
EXTRA_CLEAN := $(extension_script) tools/get_sizeof_phone_number
|
EXTRA_CLEAN := $(extension_script) tools/get_sizeof_phone_number
|
||||||
|
|
||||||
|
#Load PGXS.
|
||||||
PG_CONFIG := pg_config
|
PG_CONFIG := pg_config
|
||||||
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||||
include $(PGXS)
|
include $(PGXS)
|
||||||
|
|
||||||
|
#How to build the extension script:
|
||||||
$(extension_script): $(EXTENSION).sql.template tools/get_sizeof_phone_number
|
$(extension_script): $(EXTENSION).sql.template tools/get_sizeof_phone_number
|
||||||
sed "s/SIZEOF_PHONE_NUMBER/$(shell tools/get_sizeof_phone_number)/" $< > $@
|
sed "s/SIZEOF_PHONE_NUMBER/$(shell tools/get_sizeof_phone_number)/" $< > $@
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
CREATE EXTENSION IF NOT EXISTS pg_libphonenumber;
|
||||||
|
|
||||||
|
--Test phone number parsing
|
||||||
|
select parse_phone_number('555-555-5555', 'US');
|
||||||
|
--These two should produce errors because the number is too long.
|
||||||
|
select parse_phone_number('555-555-5555555555', 'US');
|
||||||
|
select parse_phone_number('555-555-55555555555', 'US');
|
||||||
|
|
Loading…
Reference in New Issue