v2-0002-fuzzystrmatch-Add-test-suite.patch
text/plain
Filename: v2-0002-fuzzystrmatch-Add-test-suite.patch
Type: text/plain
Part: 1
Message:
Re: additional contrib test suites
Patch
Format: format-patch
Series: patch v2-0002
Subject: fuzzystrmatch: Add test suite
| File | + | − |
|---|---|---|
| contrib/fuzzystrmatch/expected/fuzzystrmatch.out | 67 | 0 |
| contrib/fuzzystrmatch/.gitignore | 4 | 0 |
| contrib/fuzzystrmatch/Makefile | 2 | 0 |
| contrib/fuzzystrmatch/sql/fuzzystrmatch.sql | 21 | 0 |
| doc/src/sgml/fuzzystrmatch.sgml | 4 | 4 |
From b61083dc628dd59c08fda3d13f359a782f8b7e25 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Fri, 11 Aug 2017 21:04:04 -0400
Subject: [PATCH v2 2/7] fuzzystrmatch: Add test suite
---
contrib/fuzzystrmatch/.gitignore | 4 ++
contrib/fuzzystrmatch/Makefile | 2 +
contrib/fuzzystrmatch/expected/fuzzystrmatch.out | 67 ++++++++++++++++++++++++
contrib/fuzzystrmatch/sql/fuzzystrmatch.sql | 21 ++++++++
doc/src/sgml/fuzzystrmatch.sgml | 8 +--
5 files changed, 98 insertions(+), 4 deletions(-)
create mode 100644 contrib/fuzzystrmatch/.gitignore
create mode 100644 contrib/fuzzystrmatch/expected/fuzzystrmatch.out
create mode 100644 contrib/fuzzystrmatch/sql/fuzzystrmatch.sql
diff --git a/contrib/fuzzystrmatch/.gitignore b/contrib/fuzzystrmatch/.gitignore
new file mode 100644
index 0000000000..5dcb3ff972
--- /dev/null
+++ b/contrib/fuzzystrmatch/.gitignore
@@ -0,0 +1,4 @@
+# Generated subdirectories
+/log/
+/results/
+/tmp_check/
diff --git a/contrib/fuzzystrmatch/Makefile b/contrib/fuzzystrmatch/Makefile
index 51e215a919..bd6f5e50d1 100644
--- a/contrib/fuzzystrmatch/Makefile
+++ b/contrib/fuzzystrmatch/Makefile
@@ -8,6 +8,8 @@ DATA = fuzzystrmatch--1.1.sql fuzzystrmatch--1.0--1.1.sql \
fuzzystrmatch--unpackaged--1.0.sql
PGFILEDESC = "fuzzystrmatch - similarities and distance between strings"
+REGRESS = fuzzystrmatch
+
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/contrib/fuzzystrmatch/expected/fuzzystrmatch.out b/contrib/fuzzystrmatch/expected/fuzzystrmatch.out
new file mode 100644
index 0000000000..493c95cdfa
--- /dev/null
+++ b/contrib/fuzzystrmatch/expected/fuzzystrmatch.out
@@ -0,0 +1,67 @@
+CREATE EXTENSION fuzzystrmatch;
+SELECT soundex('hello world!');
+ soundex
+---------
+ H464
+(1 row)
+
+SELECT soundex('Anne'), soundex('Ann'), difference('Anne', 'Ann');
+ soundex | soundex | difference
+---------+---------+------------
+ A500 | A500 | 4
+(1 row)
+
+SELECT soundex('Anne'), soundex('Andrew'), difference('Anne', 'Andrew');
+ soundex | soundex | difference
+---------+---------+------------
+ A500 | A536 | 2
+(1 row)
+
+SELECT soundex('Anne'), soundex('Margaret'), difference('Anne', 'Margaret');
+ soundex | soundex | difference
+---------+---------+------------
+ A500 | M626 | 0
+(1 row)
+
+SELECT levenshtein('GUMBO', 'GAMBOL');
+ levenshtein
+-------------
+ 2
+(1 row)
+
+SELECT levenshtein('GUMBO', 'GAMBOL', 2, 1, 1);
+ levenshtein
+-------------
+ 3
+(1 row)
+
+SELECT levenshtein_less_equal('extensive', 'exhaustive', 2);
+ levenshtein_less_equal
+------------------------
+ 3
+(1 row)
+
+SELECT levenshtein_less_equal('extensive', 'exhaustive', 4);
+ levenshtein_less_equal
+------------------------
+ 4
+(1 row)
+
+SELECT metaphone('GUMBO', 4);
+ metaphone
+-----------
+ KM
+(1 row)
+
+SELECT dmetaphone('gumbo');
+ dmetaphone
+------------
+ KMP
+(1 row)
+
+SELECT dmetaphone_alt('gumbo');
+ dmetaphone_alt
+----------------
+ KMP
+(1 row)
+
diff --git a/contrib/fuzzystrmatch/sql/fuzzystrmatch.sql b/contrib/fuzzystrmatch/sql/fuzzystrmatch.sql
new file mode 100644
index 0000000000..f05dc28ffb
--- /dev/null
+++ b/contrib/fuzzystrmatch/sql/fuzzystrmatch.sql
@@ -0,0 +1,21 @@
+CREATE EXTENSION fuzzystrmatch;
+
+
+SELECT soundex('hello world!');
+
+SELECT soundex('Anne'), soundex('Ann'), difference('Anne', 'Ann');
+SELECT soundex('Anne'), soundex('Andrew'), difference('Anne', 'Andrew');
+SELECT soundex('Anne'), soundex('Margaret'), difference('Anne', 'Margaret');
+
+
+SELECT levenshtein('GUMBO', 'GAMBOL');
+SELECT levenshtein('GUMBO', 'GAMBOL', 2, 1, 1);
+SELECT levenshtein_less_equal('extensive', 'exhaustive', 2);
+SELECT levenshtein_less_equal('extensive', 'exhaustive', 4);
+
+
+SELECT metaphone('GUMBO', 4);
+
+
+SELECT dmetaphone('gumbo');
+SELECT dmetaphone_alt('gumbo');
diff --git a/doc/src/sgml/fuzzystrmatch.sgml b/doc/src/sgml/fuzzystrmatch.sgml
index feb06861da..ff5bc08fea 100644
--- a/doc/src/sgml/fuzzystrmatch.sgml
+++ b/doc/src/sgml/fuzzystrmatch.sgml
@@ -133,19 +133,19 @@ <title>Levenshtein</title>
2
(1 row)
-test=# SELECT levenshtein('GUMBO', 'GAMBOL', 2,1,1);
+test=# SELECT levenshtein('GUMBO', 'GAMBOL', 2, 1, 1);
levenshtein
-------------
3
(1 row)
-test=# SELECT levenshtein_less_equal('extensive', 'exhaustive',2);
+test=# SELECT levenshtein_less_equal('extensive', 'exhaustive', 2);
levenshtein_less_equal
------------------------
3
(1 row)
-test=# SELECT levenshtein_less_equal('extensive', 'exhaustive',4);
+test=# SELECT levenshtein_less_equal('extensive', 'exhaustive', 4);
levenshtein_less_equal
------------------------
4
@@ -227,7 +227,7 @@ <title>Double Metaphone</title>
</para>
<screen>
-test=# select dmetaphone('gumbo');
+test=# SELECT dmetaphone('gumbo');
dmetaphone
------------
KMP
--
2.11.0 (Apple Git-81)