summaryrefslogtreecommitdiff
path: root/node_modules/lunr/perf/token_set_perf.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/lunr/perf/token_set_perf.js')
-rw-r--r--node_modules/lunr/perf/token_set_perf.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/node_modules/lunr/perf/token_set_perf.js b/node_modules/lunr/perf/token_set_perf.js
new file mode 100644
index 0000000..ef0f60a
--- /dev/null
+++ b/node_modules/lunr/perf/token_set_perf.js
@@ -0,0 +1,42 @@
+suite('lunr.TokenSet', function () {
+ var tokenSet = lunr.TokenSet.fromArray([
+ 'january', 'february', 'march', 'april',
+ 'may', 'june', 'july', 'august',
+ 'september', 'october', 'november', 'december'
+ ].sort())
+
+ var noWildcard = lunr.TokenSet.fromString('september')
+ var withWildcard = lunr.TokenSet.fromString('*ber')
+
+ this.add('.fromArray', function () {
+ lunr.TokenSet.fromArray(words)
+ })
+
+ this.add('.fromString (no wildcard)', function () {
+ lunr.TokenSet.fromString('javascript')
+ })
+
+ this.add('.fromString (with wildcard)', function () {
+ lunr.TokenSet.fromString('java*cript')
+ })
+
+ this.add('.fromFuzzyString', function () {
+ lunr.TokenSet.fromFuzzyString('javascript', 2)
+ })
+
+ this.add('#toArray', function () {
+ tokenSet.toArray()
+ })
+
+ this.add('#toString', function () {
+ tokenSet.toString()
+ })
+
+ this.add('#intersect (no wildcard)', function () {
+ tokenSet.intersect(noWildcard)
+ })
+
+ this.add('#intersect (with wildcard)', function () {
+ tokenSet.intersect(withWildcard)
+ })
+})