-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use rake test task, initial stab at a gem, dedication
- Loading branch information
Showing
14 changed files
with
122 additions
and
35 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 |
---|---|---|
@@ -1,15 +1,41 @@ | ||
|
||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/gempackagetask' | ||
|
||
$: << File.expand_path(File.dirname(__FILE__) + '/test') | ||
|
||
task :default => :test | ||
|
||
desc 'Run tests' | ||
task :test do | ||
sh "ruby test/ts_toycipher.rb" | ||
end | ||
desc 'Run all tests' | ||
task :test => 'test:unit' | ||
|
||
namespace 'test' do | ||
namespace :test do | ||
Rake::TestTask.new :unit do |t| | ||
t.libs << 'test' | ||
t.pattern = "test/tc_*.rb" | ||
t.verbose = true | ||
end | ||
|
||
end | ||
|
||
spec = Gem::Specification.new do |s| | ||
s.name = "toycipher" | ||
s.version = "0.5" # FIXME | ||
s.author = "Jeffrey ODell" | ||
s.email = "[email protected]" | ||
s.homepage = "http://github.com/jodell/toycipher" | ||
s.platform = Gem::Platform::RUBY | ||
s.summary = "Ruby implementation of popular ciphers for recreational and educational cryptanalysis" | ||
s.files = FileList["{bin,lib}/**/*"].to_a | ||
s.require_path = "lib" | ||
s.autorequire = "name" | ||
s.test_files = FileList["{test}/**/tc_*.rb"].to_a | ||
s.has_rdoc = false | ||
#s.extra_rdoc_files = ["README"] | ||
end | ||
|
||
Rake::GemPackageTask.new(spec) do |pkg| | ||
pkg.need_tar = true | ||
end | ||
|
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
Binary file not shown.
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
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,33 @@ | ||
|
||
require 'toycipher' | ||
require 'string' | ||
|
||
class TestToyCipherExt < Test::Unit::TestCase | ||
|
||
def setup | ||
end | ||
|
||
def test_phone | ||
assert_equal '2', 'a'.phone | ||
assert_equal '2', 'a'.phone(:foo) | ||
assert_equal '1', 'a'.phone(:legacy) | ||
assert_equal '3', 'd'.phone | ||
end | ||
|
||
def test_basic | ||
assert_equal '22233344455566677778889999', "abcdefghijklmnopqrstuvwxyz".phone | ||
assert_equal '11122233344455566677788899', "ABCDEFGHIJKLMNOPQRSTUVWXYZ".phone(:legacy) | ||
assert_equal '8447 47 2 8378', "THIS IS A TEST".phone | ||
end | ||
|
||
def test_non_alpha | ||
assert_equal '123', '123'.phone | ||
assert_equal '*&2-==[][][', '*&2-==[][]['.phone | ||
end | ||
|
||
def test_mixed_alpha_non_alpha | ||
assert_equal '843 78425 27696 369 586733 6837 843 5299 364!!!', 'The quick brown fox jumped over the lazy dog!!!'.phone | ||
end | ||
|
||
end | ||
|
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
|
||
require 'toycipher' | ||
require 'test/unit' | ||
|
||
class TestPlayfairCipher < Test::Unit::TestCase | ||
|
||
|
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
|
||
require 'toycipher' | ||
require 'test/unit' | ||
|
||
class TestVigenereCipher < Test::Unit::TestCase | ||
|
||
|
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,5 @@ | ||
$: << File.join(File.dirname(__FILE__), "..", "lib") | ||
$: << File.expand_path(File.dirname(__FILE__)) + '/../ext/' | ||
|
||
require 'test/unit' | ||
|
This file was deleted.
Oops, something went wrong.