rex 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +50 -0
- data/lib/rex.rb +23 -0
- data/lib/rex/array.rb +13 -0
- data/lib/rex/kernel.rb +11 -0
- data/lib/rex/modules/boolean.rb +14 -0
- data/lib/rex/modules/caller_name.rb +15 -0
- data/lib/rex/modules/ordinal.rb +35 -0
- data/lib/rex/modules/propercase.rb +15 -0
- data/lib/rex/modules/roman.rb +41 -0
- data/lib/rex/modules/scrub.rb +66 -0
- data/lib/rex/modules/stacktrace.rb +31 -0
- data/lib/rex/modules/swap.rb +13 -0
- data/lib/rex/modules/to_proc.rb +13 -0
- data/lib/rex/modules/tuple.rb +14 -0
- data/lib/rex/modules/wrap.rb +15 -0
- data/lib/rex/numeric.rb +19 -0
- data/lib/rex/string.rb +21 -0
- data/lib/rex/symbol.rb +13 -0
- data/test/boolean.rb +64 -0
- data/test/caller_name.rb +26 -0
- data/test/ordinal.rb +609 -0
- data/test/propercase.rb +40 -0
- data/test/roman.rb +335 -0
- data/test/scrub.rb +27 -0
- data/test/stacktrace.rb +24 -0
- data/test/swap.rb +44 -0
- data/test/to_proc.rb +24 -0
- data/test/tuple.rb +26 -0
- data/test/wrap.rb +44 -0
- metadata +92 -0
data/test/to_proc.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# to_proc.rb
|
4
|
+
# Symbol#to_proc unit tests
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require 'pathname'
|
8
|
+
dir = Pathname.new(File.expand_path(__FILE__)).realpath
|
9
|
+
require File.join(File.dirname(dir.to_s), '../lib/rex')
|
10
|
+
|
11
|
+
class ToProcTests < Test::Unit::TestCase
|
12
|
+
def test_to_proc
|
13
|
+
expected = 5050
|
14
|
+
actual = nil
|
15
|
+
|
16
|
+
assert_nothing_raised do
|
17
|
+
actual = (1..100).inject(&:+)
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_not_nil(actual)
|
21
|
+
assert_equal(Fixnum, actual.class)
|
22
|
+
assert_equal(expected, actual)
|
23
|
+
end
|
24
|
+
end
|
data/test/tuple.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# tuple.rb
|
4
|
+
# Kernel#Tuple unit tests
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
|
8
|
+
require 'pathname'
|
9
|
+
dir = Pathname.new(File.expand_path(__FILE__)).realpath
|
10
|
+
require File.join(File.dirname(dir.to_s), '../lib/rex')
|
11
|
+
|
12
|
+
class TupleTests < Test::Unit::TestCase
|
13
|
+
def test_tuple
|
14
|
+
expected = true
|
15
|
+
actual = false
|
16
|
+
|
17
|
+
assert_nothing_raised do
|
18
|
+
t1 = Tuple([1,2,3])
|
19
|
+
t2 = Tuple(1, 3, 4)
|
20
|
+
actual = t1 < t2
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_instance_of(TrueClass, actual)
|
24
|
+
assert_equal(expected, actual)
|
25
|
+
end
|
26
|
+
end
|
data/test/wrap.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# wrap.rb
|
4
|
+
# String#wrap unit tests
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require 'pathname'
|
8
|
+
dir = Pathname.new(File.expand_path(__FILE__)).realpath
|
9
|
+
require File.join(File.dirname(dir.to_s), '../lib/rex')
|
10
|
+
|
11
|
+
class WrapTests < Test::Unit::TestCase
|
12
|
+
def test_wrap_empty
|
13
|
+
expected = ''
|
14
|
+
actual = nil
|
15
|
+
|
16
|
+
assert_nothing_raised do
|
17
|
+
actual = ''.wrap
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_not_nil(actual)
|
21
|
+
assert_equal(String, actual.class)
|
22
|
+
assert_equal(true, actual.empty?)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_wrap_data
|
26
|
+
expected_size = 1097
|
27
|
+
actual = nil
|
28
|
+
|
29
|
+
assert_nothing_raised do
|
30
|
+
begin
|
31
|
+
f = File.open("#{File.dirname(__FILE__)}/data/wrap_in.txt", 'r')
|
32
|
+
s = f.readline
|
33
|
+
actual = s.wrap
|
34
|
+
ensure
|
35
|
+
f.close if !f.nil?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
assert_not_nil(actual)
|
40
|
+
assert_instance_of(String, actual)
|
41
|
+
assert_equal(false, actual.empty?)
|
42
|
+
assert_equal(expected_size, actual.size)
|
43
|
+
end
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ramsey Dow
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-02-26 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: yesmar @nospam@ speakeasy.net
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
files:
|
25
|
+
- lib/rex.rb
|
26
|
+
- lib/rex/array.rb
|
27
|
+
- lib/rex/kernel.rb
|
28
|
+
- lib/rex/numeric.rb
|
29
|
+
- lib/rex/string.rb
|
30
|
+
- lib/rex/symbol.rb
|
31
|
+
- lib/rex/modules/boolean.rb
|
32
|
+
- lib/rex/modules/caller_name.rb
|
33
|
+
- lib/rex/modules/ordinal.rb
|
34
|
+
- lib/rex/modules/propercase.rb
|
35
|
+
- lib/rex/modules/roman.rb
|
36
|
+
- lib/rex/modules/scrub.rb
|
37
|
+
- lib/rex/modules/stacktrace.rb
|
38
|
+
- lib/rex/modules/swap.rb
|
39
|
+
- lib/rex/modules/to_proc.rb
|
40
|
+
- lib/rex/modules/tuple.rb
|
41
|
+
- lib/rex/modules/wrap.rb
|
42
|
+
- test/boolean.rb
|
43
|
+
- test/caller_name.rb
|
44
|
+
- test/data
|
45
|
+
- test/ordinal.rb
|
46
|
+
- test/propercase.rb
|
47
|
+
- test/roman.rb
|
48
|
+
- test/scrub.rb
|
49
|
+
- test/stacktrace.rb
|
50
|
+
- test/swap.rb
|
51
|
+
- test/to_proc.rb
|
52
|
+
- test/tuple.rb
|
53
|
+
- test/wrap.rb
|
54
|
+
- README
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: http://rexgem.rubyforge.org/
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
version:
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project: http://rubyforge.org/projects/rexgem/
|
77
|
+
rubygems_version: 1.0.1
|
78
|
+
signing_key:
|
79
|
+
specification_version: 2
|
80
|
+
summary: Ruby Extension Library
|
81
|
+
test_files:
|
82
|
+
- test/boolean.rb
|
83
|
+
- test/caller_name.rb
|
84
|
+
- test/ordinal.rb
|
85
|
+
- test/propercase.rb
|
86
|
+
- test/roman.rb
|
87
|
+
- test/scrub.rb
|
88
|
+
- test/stacktrace.rb
|
89
|
+
- test/swap.rb
|
90
|
+
- test/to_proc.rb
|
91
|
+
- test/tuple.rb
|
92
|
+
- test/wrap.rb
|