Permalink
Browse files

Added boilerplate to start testing trie.remove()

  • Loading branch information...
1 parent 690542c commit c974d68ae93814123d2a8c8f24e429dfeee1e0b8 @matthewmueller committed Sep 25, 2011
Showing with 43 additions and 0 deletions.
  1. +43 −0 tests/remove.coffee
View
@@ -0,0 +1,43 @@
+vows = require "vows"
+assert = require "assert"
+trie = require "../trie"
+fs = require "fs"
+_ = require "underscore"
+suite = vows.describe "Find countries"
+
+findTest = (trie, query, expected) ->
+ result = trie.find query
+ assert.equal result, expected
+
+
+###
+ Test should go here...
+###
+
+# ...
+
+###
+ END
+###
+
+test =
+ "when searching the trie..." :
+ topic : () ->
+ countries = require("./fixtures/countries.js");
+ return trie(countries)
+
+expectedFuncs = {}
+
+for query, expected of tests
+ do (query, expected) ->
+ key = '"' + query + '" --> "' + expected + '"'
+ expectedFuncs[key] = (trie) ->
+ findTest trie, query, expected
+
+_.extend test["when searching the trie..."], expectedFuncs
+
+# Add the test to the batch
+suite.addBatch test
+
+# Export the suite
+suite.export module

0 comments on commit c974d68

Please sign in to comment.