Created
October 25, 2011 09:45
-
-
Save timcowlishaw/1312065 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "AhoCorasick" do | |
it "returns matched substrings" do | |
a = AhoCorasick.new(["ab"]) | |
a.match("abcde").should include("ab") | |
end | |
it "returns multiple matched substrings" do | |
a = AhoCorasick.new(["ab", "cd"]) | |
a.match("cd123ab").to_set.should == ["ab", "cd"].to_set | |
end | |
it "returns overlapping matched substrings" do | |
a = AhoCorasick.new(["ab", "bc"]) | |
a.match("abc").to_set.should == ["ab", "bc"].to_set | |
end | |
it "does not return unmatched substrings" do | |
a = AhoCorasick.new(["ab"]) | |
a.match("abc").should_not include("bc") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment