kyanite 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. data/Div +6 -32
  2. data/{History.txt → History.rdoc} +8 -0
  3. data/{License.txt → License.rdoc} +0 -0
  4. data/Manifest.txt +6 -21
  5. data/README.rdoc +44 -0
  6. data/Rakefile.rb +19 -68
  7. data/console.rb +2 -4
  8. data/lib/kyanite.rb +151 -14
  9. data/lib/kyanite/array.rb +127 -4
  10. data/lib/kyanite/basics.rb +3 -7
  11. data/lib/kyanite/dictionary.rb +19 -21
  12. data/lib/kyanite/enumerable/enumerable_enumerables.rb +22 -24
  13. data/lib/kyanite/enumerable/enumerable_numerics.rb +51 -49
  14. data/lib/kyanite/enumerable/enumerable_strings.rb +18 -25
  15. data/lib/kyanite/enumerable/structure.rb +46 -58
  16. data/lib/kyanite/general/callerutils.rb +30 -28
  17. data/lib/kyanite/general/classutils.rb +73 -63
  18. data/lib/kyanite/general/kernel.rb +45 -64
  19. data/lib/kyanite/general/object.rb +22 -46
  20. data/lib/kyanite/general/true_false.rb +33 -27
  21. data/lib/kyanite/general/undoable.rb +12 -16
  22. data/lib/kyanite/hash.rb +63 -58
  23. data/lib/kyanite/numeric.rb +14 -1
  24. data/lib/kyanite/numeric/float.rb +32 -22
  25. data/lib/kyanite/numeric/integer.rb +12 -20
  26. data/lib/kyanite/optimizer.rb +41 -24
  27. data/lib/kyanite/range.rb +42 -22
  28. data/lib/kyanite/set.rb +56 -63
  29. data/lib/kyanite/string.rb +1 -2
  30. data/lib/kyanite/string/cast.rb +61 -37
  31. data/lib/kyanite/string/chars.rb +66 -36
  32. data/lib/kyanite/string/chars_const.rb +4 -3
  33. data/lib/kyanite/string/diff.rb +64 -34
  34. data/lib/kyanite/string/include.rb +16 -9
  35. data/lib/kyanite/string/list.rb +38 -8
  36. data/lib/kyanite/string/misc.rb +64 -0
  37. data/lib/kyanite/string/nested.rb +39 -22
  38. data/lib/kyanite/string/random.rb +117 -47
  39. data/lib/kyanite/string/split.rb +84 -45
  40. data/lib/kyanite/symbol.rb +30 -21
  41. data/lib/kyanite/tree.rb +33 -28
  42. data/test/_start_all.rb +18 -15
  43. data/test/array/test_array.rb +5 -7
  44. data/test/enumerable/test_enumerable_enumerables.rb +11 -15
  45. data/test/enumerable/test_enumerable_numerics.rb +50 -54
  46. data/test/enumerable/test_enumerable_strings.rb +8 -11
  47. data/test/enumerable/test_structure.rb +6 -8
  48. data/test/general/test_classutils.rb +9 -9
  49. data/test/general/test_object.rb +4 -5
  50. data/test/general/test_true_false.rb +4 -5
  51. data/test/numeric/test_numeric_integer.rb +6 -6
  52. data/test/string/test_cast.rb +4 -5
  53. data/test/string/test_chars.rb +6 -7
  54. data/test/string/test_diff.rb +4 -5
  55. data/test/string/test_list.rb +4 -5
  56. data/test/string/test_misc.rb +58 -0
  57. data/test/string/test_nested.rb +4 -5
  58. data/test/string/test_split.rb +10 -5
  59. data/test/test_dictionary.rb +4 -6
  60. data/test/test_hash.rb +5 -7
  61. data/test/test_optimizer.rb +4 -5
  62. data/test/test_range.rb +8 -9
  63. data/test/test_set.rb +7 -7
  64. data/test/test_tree.rb +7 -10
  65. data/version.rb +8 -0
  66. metadata +32 -33
  67. data/README.txt +0 -47
  68. data/lib/kyanite/array/array.rb +0 -140
  69. data/lib/kyanite/array/array2.rb +0 -142
  70. data/lib/kyanite/array/matrix2.rb +0 -120
  71. data/lib/kyanite/hoe.rb +0 -2
  72. data/lib/kyanite/matrix2.rb +0 -2
  73. data/lib/kyanite/numeric/numeric.rb +0 -54
  74. data/lib/kyanite/operation.rb +0 -5
  75. data/lib/kyanite/operation/call_tracker.rb +0 -69
  76. data/lib/kyanite/operation/hoe.rb +0 -12
  77. data/lib/kyanite/operation/rake.rb +0 -298
  78. data/lib/kyanite/operation/regexp.rb +0 -28
  79. data/lib/kyanite/operation/unit_test.rb +0 -50
  80. data/lib/kyanite/rake.rb +0 -2
  81. data/lib/kyanite/smart_load_path.rb +0 -6
  82. data/lib/kyanite/string/div.rb +0 -28
  83. data/lib/kyanite/string/mgsub.rb +0 -43
  84. data/lib/kyanite/unit_test.rb +0 -2
  85. data/test/array/test_matrix2.rb +0 -166
  86. data/test/string/test_mgsub.rb +0 -58
@@ -1,91 +1,87 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/enumerable/enumerable_numerics'
10
9
 
11
- class Array
12
- include EnumerableNumerics
13
- end
14
10
 
15
11
 
16
- # Tests für EnumerableNumerics
17
- #
12
+
13
+ # @!macro enum_of_numerics
18
14
  class TestKyaniteEnumerableNumerics < UnitTest
19
15
 
20
16
 
21
17
  def test_01_sum
22
- assert_equal 2, [2].summation
23
- assert_equal 4, [2,2].summation
24
- assert_equal 6, [2,2,2].summation
25
- assert_equal 8, [2,2,2,2].summation
26
- assert_equal 8.5, [2,2,2,2,0.5].summation
18
+ assert_equal 2, [2].to_array_of_numerics.summation
19
+ assert_equal 4, [2,2].to_array_of_numerics.summation
20
+ assert_equal 6, [2,2,2].to_array_of_numerics.summation
21
+ assert_equal 8, [2,2,2,2].to_array_of_numerics.summation
22
+ assert_equal 8.5, [2,2,2,2,0.5].to_array_of_numerics.summation
27
23
  end
28
24
 
29
25
 
30
26
 
31
27
  def test_01_prd
32
- assert_equal 2, [2].prd
33
- assert_equal 6, [2,3].prd
34
- assert_equal -12, [2,2,-3].prd
35
- assert_equal 1, [0.5,0.5,2,2].prd
36
- assert_equal 5000, [50, 100].prd
28
+ assert_equal 2, [2].to_array_of_numerics.prd
29
+ assert_equal 6, [2,3].to_array_of_numerics.prd
30
+ assert_equal -12, [2,2,-3].to_array_of_numerics.prd
31
+ assert_equal 1, [0.5,0.5,2,2].to_array_of_numerics.prd
32
+ assert_equal 5000, [50, 100].to_array_of_numerics.prd
37
33
  end
38
34
 
39
35
 
40
36
  def test_avg
41
- a = [1,2,3,4,5,6,7,8,9]
37
+ a = [1,2,3,4,5,6,7,8,9].to_array_of_numerics
42
38
  assert_equal 5.0, a.average
43
39
 
44
- assert_equal 2, ([2].avg * 100000000).round / 100000000.0
45
- assert_equal 2.5, ([2,3].avg * 100000000).round / 100000000.0
46
- assert_equal 2.5, ([3,2].avg * 100000000).round / 100000000.0
47
- assert_equal 0.33333333, ([2,2,-3].avg * 100000000).round / 100000000.0
48
- assert_equal 1.25, ([0.5,0.5,2,2].avg * 100000000).round / 100000000.0
40
+ assert_equal 2, ([2].to_array_of_numerics.avg * 100000000).round / 100000000.0
41
+ assert_equal 2.5, ([2,3].to_array_of_numerics.avg * 100000000).round / 100000000.0
42
+ assert_equal 2.5, ([3,2].to_array_of_numerics.avg * 100000000).round / 100000000.0
43
+ assert_equal 0.33333333, ([2,2,-3].to_array_of_numerics.avg * 100000000).round / 100000000.0
44
+ assert_equal 1.25, ([0.5,0.5,2,2].to_array_of_numerics.avg * 100000000).round / 100000000.0
49
45
 
50
- assert_equal 75, ([ 50, 100 ].mean_arithmetric * 100000000).round / 100000000.0
51
- assert_equal 66.66666667, ([ 50, 100 ].mean_harmonic * 100000000).round / 100000000.0
52
- assert_equal 70.71067812, ([ 50, 100 ].mean_geometric * 100000000).round / 100000000.0
46
+ assert_equal 75, ([ 50, 100 ].to_array_of_numerics.mean_arithmetric * 100000000).round / 100000000.0
47
+ assert_equal 66.66666667, ([ 50, 100 ].to_array_of_numerics.mean_harmonic * 100000000).round / 100000000.0
48
+ assert_equal 70.71067812, ([ 50, 100 ].to_array_of_numerics.mean_geometric * 100000000).round / 100000000.0
53
49
 
54
- assert_equal 66.66666667, ([ 100, 0, 100 ].mean_arithmetric * 100000000).round / 100000000.0
55
- assert_equal 66.6666667, ([ 100, 0.0000001, 100 ].mean_arithmetric * 100000000).round / 100000000.0
56
- assert_equal 0.0, ([ 100, 0, 100 ].mean_harmonic * 100000000).round / 100000000.0
57
- assert_equal 3.0e-007, ([ 100, 0.0000001, 100 ].mean_harmonic * 100000000).round / 100000000.0
58
- assert_equal 0, ([ 100, 0, 100 ].mean_geometric * 100000000).round / 100000000.0
59
- assert_equal 0.1, ([ 100, 0.0000001, 100 ].mean_geometric * 100000000).round / 100000000.0
50
+ assert_equal 66.66666667, ([ 100, 0, 100 ].to_array_of_numerics.mean_arithmetric * 100000000).round / 100000000.0
51
+ assert_equal 66.6666667, ([ 100, 0.0000001, 100 ].to_array_of_numerics.mean_arithmetric * 100000000).round / 100000000.0
52
+ assert_equal 0.0, ([ 100, 0, 100 ].to_array_of_numerics.mean_harmonic * 100000000).round / 100000000.0
53
+ assert_equal 3.0e-007, ([ 100, 0.0000001, 100 ].to_array_of_numerics.mean_harmonic * 100000000).round / 100000000.0
54
+ assert_equal 0, ([ 100, 0, 100 ].to_array_of_numerics.mean_geometric * 100000000).round / 100000000.0
55
+ assert_equal 0.1, ([ 100, 0.0000001, 100 ].to_array_of_numerics.mean_geometric * 100000000).round / 100000000.0
60
56
  end
61
57
 
62
58
 
63
59
  def test_mean_harmonic
64
- assert_equal 66.66666667, ([ 50, 100 ].mean_harmonic * 100000000).round / 100000000.0
65
- assert_equal 0.0, ([ 100, 0, 100 ].mean_harmonic * 100000000).round / 100000000.0
66
- assert_equal 3.0e-007, ([ 100, 0.0000001, 100 ].mean_harmonic * 100000000).round / 100000000.0
67
- assert_equal 4, ([ 1, -2 ].mean_harmonic * 100000000).round / 100000000.0 # formal richtig, aber sinnlos
68
- assert_equal -0.5, ([ 1, -2 ].mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
69
- assert_equal -0.5, ([ 1, 1, -2, -2 ].mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
70
- assert_equal -2, ([ -2, -2 ].mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
71
- assert_equal 2, ([ 2, 2 ].mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
72
- assert_equal 0, ([ -2, 2 ].mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
73
- assert_equal 0, ([ 2, -2 ].mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
74
- assert_equal 0.66666667, ([ 2, 2, -2 ].mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
60
+ assert_equal 66.66666667, ([ 50, 100 ].to_array_of_numerics.mean_harmonic * 100000000).round / 100000000.0
61
+ assert_equal 0.0, ([ 100, 0, 100 ].to_array_of_numerics.mean_harmonic * 100000000).round / 100000000.0
62
+ assert_equal 3.0e-007, ([ 100, 0.0000001, 100 ].to_array_of_numerics.mean_harmonic * 100000000).round / 100000000.0
63
+ assert_equal 4, ([ 1, -2 ].to_array_of_numerics.mean_harmonic * 100000000).round / 100000000.0 # formal richtig, aber sinnlos
64
+ assert_equal -0.5, ([ 1, -2 ].to_array_of_numerics.mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
65
+ assert_equal -0.5, ([ 1, 1, -2, -2 ].to_array_of_numerics.mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
66
+ assert_equal -2, ([ -2, -2 ].to_array_of_numerics.mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
67
+ assert_equal 2, ([ 2, 2 ].to_array_of_numerics.mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
68
+ assert_equal 0, ([ -2, 2 ].to_array_of_numerics.mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
69
+ assert_equal 0, ([ 2, -2 ].to_array_of_numerics.mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
70
+ assert_equal 0.66666667, ([ 2, 2, -2 ].to_array_of_numerics.mean_harmonic(:allow_negative => true) * 100000000).round / 100000000.0
75
71
  end
76
72
 
77
73
 
78
74
  def test_parallel
79
- assert_equal 1, ([1].parallel * 100000000).round / 100000000.0
80
- assert_equal 0.5, ([1,1].parallel * 100000000).round / 100000000.0
81
- assert_equal 0.33333333, ([1,1,1].parallel * 100000000).round / 100000000.0
82
- assert_equal 0.25, ([1,1,1,1].parallel * 100000000).round / 100000000.0
75
+ assert_equal 1, ([1].to_array_of_numerics.parallel * 100000000).round / 100000000.0
76
+ assert_equal 0.5, ([1,1].to_array_of_numerics.parallel * 100000000).round / 100000000.0
77
+ assert_equal 0.33333333, ([1,1,1].to_array_of_numerics.parallel * 100000000).round / 100000000.0
78
+ assert_equal 0.25, ([1,1,1,1].to_array_of_numerics.parallel * 100000000).round / 100000000.0
83
79
 
84
- assert_equal 2, ([2].parallel * 100000000).round / 100000000.0
85
- assert_equal 1, ([2,2].parallel * 100000000).round / 100000000.0
86
- assert_equal 0.66666667, ([2,2,2].parallel * 100000000).round / 100000000.0
87
- assert_equal 0.5, ([2,2,2,2].parallel * 100000000).round / 100000000.0
88
- assert_equal 0.5, ([2,2,1].parallel * 100000000).round / 100000000.0
80
+ assert_equal 2, ([2].to_array_of_numerics.parallel * 100000000).round / 100000000.0
81
+ assert_equal 1, ([2,2].to_array_of_numerics.parallel * 100000000).round / 100000000.0
82
+ assert_equal 0.66666667, ([2,2,2].to_array_of_numerics.parallel * 100000000).round / 100000000.0
83
+ assert_equal 0.5, ([2,2,2,2].to_array_of_numerics.parallel * 100000000).round / 100000000.0
84
+ assert_equal 0.5, ([2,2,1].to_array_of_numerics.parallel * 100000000).round / 100000000.0
89
85
  end
90
86
 
91
87
 
@@ -1,25 +1,22 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/enumerable/enumerable_strings'
10
9
 
11
- class Array
12
- include EnumerableStrings
13
- end
14
10
 
15
11
 
16
- # Tests für EnumerableStrings
17
- #
12
+
13
+ # @!macro enum_of_strings
18
14
  class TestKyaniteEnumerableStrings < UnitTest
19
15
 
20
16
  def test_palindrom_rumpf
21
- test = ['lut', 'lutr', 'lutmi', 'lutmil', 'lutmila', 'lutrika', 'lutrik', 'lutri', 'lutr', 'lut']
22
- assert_equal ['lutmi', 'lutmil', 'lutmila', 'lutrika', 'lutrik', 'lutri'], test.palindrom_rumpf
17
+ test = ['lut', 'lutr', 'lutmi', 'lutmil', 'lutmila', 'lutrika', 'lutrik', 'lutri', 'lutr', 'lut'].to_array_of_strings
18
+ result = ['lutmi', 'lutmil', 'lutmila', 'lutrika', 'lutrik', 'lutri'].to_array_of_strings
19
+ assert_equal result, test.palindrom_rumpf
23
20
  end
24
21
 
25
22
  end # class
@@ -1,20 +1,18 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/enumerable/structure'
10
- require 'kyanite/dictionary'
9
+ #require 'kyanite/dictionary'
11
10
  require 'kyanite/set'
12
- require 'kyanite/hash'
11
+ #require 'kyanite/hash'
13
12
 
14
13
 
15
14
 
16
- # Tests für Enumerable
17
- #
15
+ # @!macro enumerable
18
16
  class TestKyaniteEnumerableStructure < UnitTest
19
17
 
20
18
  def test_is_collection
@@ -1,26 +1,26 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
7
+ require 'drumherum/unit_test'
8
8
  require 'transparent_nil' unless defined? TransparentNil
9
- require 'kyanite/unit_test'
10
9
  require 'kyanite/general/classutils'
11
10
 
12
-
13
- class DummyClass1 # :nodoc:
11
+ # @private
12
+ class DummyClass1
14
13
  end
15
- module DummyModule # :nodoc:
14
+ # @private
15
+ module DummyModule
16
16
  class DummyClass2 # :nodoc:
17
17
  end
18
18
  end
19
19
 
20
20
 
21
+ # @!group Class Utils
21
22
 
22
- # Tests for String, Symbol, Class
23
- #
23
+ # @!macro class_utils
24
24
  class TestKyaniteClassutils < UnitTest
25
25
 
26
26
  def test_to_class
@@ -1,15 +1,14 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/general/object'
10
9
  require 'kyanite/general/true_false'
11
10
 
12
- # Tests for Object
11
+ # @!macro object
13
12
  class TestKyaniteObject < UnitTest
14
13
 
15
14
  def test_is_numeric
@@ -1,15 +1,14 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/general/true_false'
10
9
 
11
10
 
12
- # Tests for TrueClass, FalseClass
11
+ # @!macro true_false
13
12
  class TestKyaniteTrueFalse < UnitTest
14
13
 
15
14
  def test_0_und_1
@@ -1,18 +1,18 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/numeric'
10
9
 
11
- # Tests for Numeric
10
+
11
+ # @!macro numeric
12
12
  class TestKyaniteNumeric < UnitTest
13
13
 
14
14
  # ---------------------------------------------------------------------------------------------------------------------------------
15
- # :section: Integer
15
+ # @!group Integer
16
16
  #
17
17
 
18
18
  # Tests for Integer
@@ -1,17 +1,16 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/string/cast'
10
9
 
11
10
 
12
11
 
13
12
  # Tests for String
14
- #
13
+ # @!macro string
15
14
  class TestKyaniteStringCast < UnitTest
16
15
 
17
16
  def test_to_nil
@@ -1,22 +1,21 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/string/chars'
10
9
 
11
10
 
12
11
 
13
12
 
14
13
  # Tests for String
15
- #
14
+ # @!macro string
16
15
  class TestKyaniteStringChars < UnitTest
17
16
 
18
17
  # ---------------------------------------------------------------------------------------------------------------------------------
19
- # :section: clear / format text
18
+ # @!group clear / format text
20
19
  #
21
20
 
22
21
 
@@ -156,7 +155,7 @@ ENDOFSTRING
156
155
 
157
156
 
158
157
  # ---------------------------------------------------------------------------------------------------------------------------------
159
- # :section: Groß- und Kleinschreibung
158
+ # @!group Groß- und Kleinschreibung
160
159
  #
161
160
 
162
161
 
@@ -1,16 +1,15 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/string/diff'
10
9
 
11
10
 
12
11
  # Tests for String
13
- #
12
+ # @!macro string
14
13
  class TestKyaniteStringDiff < UnitTest
15
14
 
16
15
  def test_overlap
@@ -1,11 +1,10 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
  if $0 == __FILE__
4
- require File.join(File.dirname(__FILE__), '..', '..', 'smart_load_path.rb' )
5
- smart_load_path
4
+ require 'drumherum'
5
+ smart_init
6
6
  end
7
-
8
- require 'kyanite/unit_test'
7
+ require 'drumherum/unit_test'
9
8
  require 'kyanite/dictionary'
10
9
  require 'kyanite/string/list'
11
10
  require 'kyanite/string/chars'
@@ -13,7 +12,7 @@ WA_ABBREV = :abbrev unless defined?(WA_ABBREV)
13
12
 
14
13
 
15
14
  # Tests for String
16
- #
15
+ # @!macro string
17
16
  class TestKyaniteStringList < UnitTest
18
17
 
19
18
 
@@ -0,0 +1,58 @@
1
+ # ruby encoding: utf-8
2
+ # ü
3
+ if $0 == __FILE__
4
+ require 'drumherum'
5
+ smart_init
6
+ end
7
+ require 'drumherum/unit_test'
8
+ require 'kyanite/string/misc'
9
+
10
+
11
+
12
+ # Tests for String
13
+ # @!macro string
14
+ class TestKyaniteStringMisc < UnitTest
15
+
16
+ def test_mgsub
17
+ assert_equal 'bEtwIIn', 'between'.mgsub([[/ee/, 'II'], [/e/, 'E']])
18
+ assert_equal 'Hallo', 'Hallo'.mgsub([])
19
+ end
20
+
21
+
22
+
23
+
24
+
25
+ end # class
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+