Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First implementation of wild character '*'
- Loading branch information
Showing
4 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Wild Wild West Movie |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- encoding: utf-8 -*- | ||
# To test use | ||
# rake TEST=test/test_wild_search.rb | ||
require 'test/unit' | ||
require 'code_zauker' | ||
|
||
# See ri Test::Unit::Assertions | ||
# for assertion documentation | ||
class FileScannerBasicSearch < Test::Unit::TestCase | ||
#This test can search very uinque things... | ||
def test_foolish_wild1 | ||
fs=CodeZauker::FileScanner.new() | ||
fs.load("./test/fixture/wildtest.txt") | ||
files=fs.wsearch("Wild*West") | ||
assert(files.include?("./test/fixture/wildtest.txt")== true, | ||
"Expected file not found. Files found:#{files}") | ||
assert(files.length==1) | ||
end | ||
|
||
def test_foolish_wild2 | ||
fs=CodeZauker::FileScanner.new() | ||
fs.load("./test/fixture/wildtest.txt") | ||
files=fs.wsearch("Wild*West*Movie") | ||
assert(files.include?("./test/fixture/wildtest.txt")== true, | ||
"Expected file not found. Files found:#{files}") | ||
assert(files.length==1) | ||
end | ||
|
||
# Also unordered match will work | ||
# So the negative match is difficult | ||
def test_foolish_wild3 | ||
fs=CodeZauker::FileScanner.new() | ||
fs.load("./test/fixture/wildtest.txt") | ||
files=fs.wsearch("West*Wild*NotOnTheSameLineForSure") | ||
assert(files.include?("./test/fixture/wildtest.txt")== false, | ||
"Expected not matching wildtest.txt file. Matches:#{files}") | ||
end | ||
|
||
|
||
end |