pantheios-ruby 0.22.2 → 0.22.3
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.
- checksums.yaml +4 -4
- data/CHANGES.md +26 -0
- data/NEWS.md +1 -0
- data/TODO.md +5 -2
- data/examples/coloured_console_log_service.rb +1 -1
- data/examples/multiple_modules.rb +36 -36
- data/examples/simple_logging.rb +1 -1
- data/examples/threshold_front_end.rb +1 -1
- data/lib/pantheios/api.rb +154 -153
- data/lib/pantheios/application_layer/stock_severity_levels.rb +108 -108
- data/lib/pantheios/application_layer.rb +5 -5
- data/lib/pantheios/core.rb +415 -414
- data/lib/pantheios/front_ends/threshold_front_end.rb +79 -79
- data/lib/pantheios/globals.rb +43 -43
- data/lib/pantheios/services/coloured_console_log_service.rb +94 -94
- data/lib/pantheios/services/common/console.rb +57 -57
- data/lib/pantheios/services/multiplexing_log_service.rb +149 -148
- data/lib/pantheios/services/null_log_service.rb +9 -9
- data/lib/pantheios/services/simple_console_log_service.rb +18 -18
- data/lib/pantheios/services/simple_file_log_service.rb +110 -111
- data/lib/pantheios/services/standard_log_service_adapter.rb +117 -117
- data/lib/pantheios/util/process_util.rb +24 -24
- data/lib/pantheios/util/reflection_util.rb +13 -13
- data/lib/pantheios/util/thread_util.rb +49 -49
- data/lib/pantheios/util/version_util.rb +33 -33
- data/lib/pantheios/version.rb +12 -12
- data/lib/pantheios.rb +11 -11
- data/test/performance/test_perf_simple_statements.rb +58 -58
- data/test/performance/test_perf_trace_variants.rb +43 -57
- data/test/scratch/log_rolling_by_period_daily.rb +3 -3
- data/test/scratch/log_rolling_by_size_and_depth.rb +3 -3
- data/test/scratch/log_using_blocks.rb +12 -12
- data/test/scratch/multiplexing_log_service.rb +32 -32
- data/test/unit/application_layer/tc_param_name_list.rb +13 -13
- data/test/unit/application_layer/tc_stock_severity_levels.rb +102 -102
- data/test/unit/core/tc_core_1.rb +24 -24
- data/test/unit/front_ends/tc_threshold_front_end.rb +65 -65
- data/test/unit/services/tc_multiplexing_log_service.rb +79 -79
- data/test/unit/services/tc_null_log_service.rb +42 -42
- data/test/unit/services/tc_simple_console_log_service.rb +70 -70
- data/test/unit/services/tc_simple_file_log_service.rb +146 -146
- data/test/unit/services/tc_standard_log_service_adapter.rb +94 -96
- data/test/unit/util/tc_process_util.rb +6 -6
- data/test/unit/util/tc_reflection_util.rb +20 -20
- data/test/unit/util/tc_thread_util.rb +46 -46
- data/test/unit/util/tc_version_util.rb +47 -47
- metadata +6 -6
|
@@ -18,151 +18,149 @@ require 'stringio'
|
|
|
18
18
|
|
|
19
19
|
class Test_StandardLogservice < Test::Unit::TestCase
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
include ::Pantheios::Services
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
STOCK_SEVERITY_LEVEL_VALUES = ::Pantheios::ApplicationLayer::StockSeverityLevels::STOCK_SEVERITY_LEVEL_VALUES
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
def test_StandardLogServiceAdapter_type_exists
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
assert defined? StandardLogServiceAdapter
|
|
28
|
+
end
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
if defined?(StandardLogServiceAdapter)
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
def test_StandardLogServiceAdapter_type_is_a_class
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
assert_kind_of(::Class, StandardLogServiceAdapter)
|
|
35
|
+
end
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
def test_StandardLogServiceAdapter_type_has_expected_instance_methods
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
assert_type_has_instance_methods StandardLogServiceAdapter, [ :severity_logged?, :log ]
|
|
40
|
+
end
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
def test_severity_logged
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
logdev = StringIO.new
|
|
45
|
+
logger = ::Logger.new logdev
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
svc = StandardLogServiceAdapter.new logger
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
logger.level = ::Logger::WARN
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
assert_false svc.severity_logged?(:debug4)
|
|
52
|
+
assert_false svc.severity_logged?(:debug3)
|
|
53
|
+
assert_false svc.severity_logged?(:debug2)
|
|
54
|
+
assert_false svc.severity_logged?(:debug1)
|
|
55
|
+
assert_false svc.severity_logged?(:debug0)
|
|
56
|
+
assert_false svc.severity_logged?(:informational)
|
|
57
|
+
assert_false svc.severity_logged?(:notice)
|
|
58
|
+
assert_true svc.severity_logged?(:warning)
|
|
59
|
+
assert_true svc.severity_logged?(:failure)
|
|
60
|
+
assert_true svc.severity_logged?(:critical)
|
|
61
|
+
assert_true svc.severity_logged?(:alert)
|
|
62
|
+
assert_true svc.severity_logged?(:violation)
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
assert_true svc.severity_logged?(nil)
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
assert_false svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:debug4])
|
|
67
|
+
assert_false svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:debug3])
|
|
68
|
+
assert_false svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:debug2])
|
|
69
|
+
assert_false svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:debug1])
|
|
70
|
+
assert_false svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:debug0])
|
|
71
|
+
assert_false svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:informational])
|
|
72
|
+
assert_false svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:notice])
|
|
73
|
+
assert_true svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:warning])
|
|
74
|
+
assert_true svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:failure])
|
|
75
|
+
assert_true svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:critical])
|
|
76
|
+
assert_true svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:alert])
|
|
77
|
+
assert_true svc.severity_logged?(STOCK_SEVERITY_LEVEL_VALUES[:violation])
|
|
78
|
+
end
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
def test_selected_log_with_default_format
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
logdev = StringIO.new
|
|
83
|
+
logger = ::Logger.new logdev
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
svc = StandardLogServiceAdapter.new logger
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
logger.level = ::Logger::WARN
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
prname = ::Pantheios::Util::ProcessUtil.derive_process_name
|
|
89
|
+
t = Time.now
|
|
90
|
+
prname = ::Pantheios::Util::ProcessUtil.derive_process_name
|
|
92
91
|
|
|
93
|
-
|
|
92
|
+
[ :notice, :warning, :critical ].each do |level|
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
svc.log level, t, nil, "a message at #{level}" if svc.severity_logged? level
|
|
95
|
+
end
|
|
97
96
|
|
|
98
|
-
|
|
97
|
+
svc.flush if svc.respond_to? :flush
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
res = logdev.string.split(/\n/)
|
|
101
100
|
|
|
102
|
-
|
|
101
|
+
assert_equal 2, res.size
|
|
103
102
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
assert_match(/W\s*,\s*\[.*##{Process.pid}\s*\]\s*WARN\s*--\s*#{prname}\s*:\s*a message at warning/, res[0])
|
|
104
|
+
assert_match(/E\s*,\s*\[.*##{Process.pid}\s*\]\s*ERROR\s*--\s*#{prname}\s*:\s*a message at critical/, res[1])
|
|
105
|
+
end
|
|
107
106
|
|
|
108
|
-
|
|
107
|
+
def test_selected_log_with_blank_format
|
|
109
108
|
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
logdev = StringIO.new
|
|
110
|
+
logger = ::Logger.new logdev
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
svc = StandardLogServiceAdapter.new logger, format: :simple
|
|
114
113
|
|
|
115
|
-
|
|
114
|
+
logger.level = ::Logger::WARN
|
|
116
115
|
|
|
117
|
-
|
|
116
|
+
t = Time.now
|
|
118
117
|
|
|
119
|
-
|
|
118
|
+
[ :notice, :warning, :critical ].each do |level|
|
|
120
119
|
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
svc.log level, t, nil, "a message at #{level}" if svc.severity_logged? level
|
|
121
|
+
end
|
|
123
122
|
|
|
124
|
-
|
|
123
|
+
svc.flush if svc.respond_to? :flush
|
|
125
124
|
|
|
126
|
-
|
|
125
|
+
res = logdev.string.split(/\n/)
|
|
127
126
|
|
|
128
|
-
|
|
127
|
+
assert_equal 2, res.size
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
assert_equal 'a message at warning', res[0]
|
|
130
|
+
assert_equal 'a message at critical', res[1]
|
|
131
|
+
end
|
|
133
132
|
|
|
134
|
-
|
|
133
|
+
def test_selected_log_with_standard_format
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
logdev = StringIO.new
|
|
136
|
+
logger = ::Logger.new logdev
|
|
138
137
|
|
|
139
|
-
|
|
138
|
+
svc = StandardLogServiceAdapter.new logger, format: :standard
|
|
140
139
|
|
|
141
|
-
|
|
140
|
+
logger.level = ::Logger::WARN
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
ts = t.strftime '%Y-%m-%d %H:%M:%S.%6N'
|
|
142
|
+
t = Time.now
|
|
143
|
+
tid = Thread.current.object_id
|
|
144
|
+
prname = ::Pantheios::Util::ProcessUtil.derive_process_name
|
|
145
|
+
ts = t.strftime '%Y-%m-%d %H:%M:%S.%6N'
|
|
148
146
|
|
|
149
|
-
|
|
147
|
+
[ :notice, :warning, :critical ].each do |level|
|
|
150
148
|
|
|
151
|
-
|
|
149
|
+
pref = "[#{prname} #{tid} #{ts} #{level}]"
|
|
152
150
|
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
svc.log level, t, pref, "a message at #{level}" if svc.severity_logged? level
|
|
152
|
+
end
|
|
155
153
|
|
|
156
|
-
|
|
154
|
+
svc.flush if svc.respond_to? :flush
|
|
157
155
|
|
|
158
|
-
|
|
156
|
+
res = logdev.string.split(/\n/)
|
|
159
157
|
|
|
160
|
-
|
|
158
|
+
assert_equal 2, res.size
|
|
161
159
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
assert_match(/\s*\[\s*#{prname} #{tid} #{ts} warning\s*\]\s*a message at warning/, res[0])
|
|
161
|
+
assert_match(/\s*\[\s*#{prname} #{tid} #{ts} critical\s*\]\s*a message at critical/, res[1])
|
|
162
|
+
end
|
|
163
|
+
end
|
|
166
164
|
end
|
|
167
165
|
|
|
168
166
|
|
|
@@ -10,15 +10,15 @@ require 'test/unit'
|
|
|
10
10
|
|
|
11
11
|
class Test_ProcessUtil_set_thread_name < Test::Unit::TestCase
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
PU = ::Pantheios::Util::ProcessUtil
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
def test_derive_process_name
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
assert_equal 'abc', PU.derive_process_name('abc')
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
assert_equal 'abc', PU.derive_process_name('abc.rb')
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
assert_equal 'abc', PU.derive_process_name('abc.rb')
|
|
22
|
+
end
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -10,45 +10,45 @@ require 'test/unit'
|
|
|
10
10
|
|
|
11
11
|
class Test_ReflectionUtil_set_thread_name < Test::Unit::TestCase
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
class Grandparent; end
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
class Parent < Grandparent; end
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
class Child < Parent; end
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
class Basic_Grandparent < BasicObject; end
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
class Basic_Parent < Basic_Grandparent; end
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
class Basic_Child < Basic_Parent; end
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
RU = ::Pantheios::Util::ReflectionUtil
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
def test_non_root_classes_end_cases
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
assert_empty RU.non_root_classes(nil)
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
assert_empty RU.non_root_classes(::Object)
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
assert_equal [ ::Regexp ], RU.non_root_classes(//)
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
assert_equal [ ::String ], RU.non_root_classes('')
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
assert_equal [ ::String ], RU.non_root_classes(::String)
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
assert_equal [ Grandparent ], RU.non_root_classes(Grandparent)
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
assert_equal [ Parent, Grandparent ], RU.non_root_classes(Parent)
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
assert_equal [ Child, Parent, Grandparent ], RU.non_root_classes(Child)
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
assert_equal [ Basic_Grandparent ], RU.non_root_classes(Basic_Grandparent)
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
assert_equal [ Basic_Parent, Basic_Grandparent ], RU.non_root_classes(Basic_Parent)
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
assert_equal [ Basic_Child, Basic_Parent, Basic_Grandparent ], RU.non_root_classes(Basic_Child)
|
|
52
|
+
end
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -10,91 +10,91 @@ require 'test/unit'
|
|
|
10
10
|
|
|
11
11
|
class Test_ThreadUtil_set_thread_name < Test::Unit::TestCase
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
TU = ::Pantheios::Util::ThreadUtil
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
def test_new_Thread_does_not_have_attribute
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
t = Thread.new {}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
assert_not t.respond_to? :thread_name
|
|
20
|
+
end
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
def test_new_Thread_can_accept_attribute
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
t = Thread.new {}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
assert_not t.respond_to? :thread_name
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
TU.set_thread_name t, ''
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
assert_true t.respond_to? :thread_name
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
assert_equal '', t.thread_name
|
|
33
|
+
end
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
def test_attribute_can_be_changed
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
t = Thread.new {}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
TU.set_thread_name t, 'name-1'
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
assert_equal 'name-1', t.thread_name
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
TU.set_thread_name t, 'name-2'
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
assert_equal 'name-2', t.thread_name
|
|
46
|
+
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
class Test_parameter_checks_as_included_module < Test::Unit::TestCase
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
class NonThread1
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
include ::Pantheios::Util::ThreadUtil::ThreadName
|
|
54
|
+
end
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
class Thread1 < Thread
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
include ::Pantheios::Util::ThreadUtil::ThreadName
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
def initialize
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
super
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
def test_NonThread1_1
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
t = NonThread1.new
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
assert_equal Thread.current.to_s, t.thread_name
|
|
72
|
+
end
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
def test_NonThread1_2
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
t = NonThread1.new
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
t.thread_name = 'the-thread'
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
assert_equal 'the-thread', t.thread_name
|
|
81
|
+
end
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
def test_Thread1_1
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
t = Thread1.new {}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
assert_equal t.to_s, t.thread_name
|
|
89
|
+
end
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
def test_Thread1_2
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
t = Thread1.new {}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
t.thread_name = 'another-thread'
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
assert_equal 'another-thread', t.thread_name
|
|
98
|
+
end
|
|
99
99
|
end
|
|
100
100
|
|
|
@@ -10,71 +10,71 @@ require 'test/unit'
|
|
|
10
10
|
|
|
11
11
|
class Test_VersionUtil_version_compare < Test::Unit::TestCase
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
VU = ::Pantheios::Util::VersionUtil
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
def test_equal_strings
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
assert_equal 0, VU.version_compare('1.0.0', '1.0.0')
|
|
18
|
+
assert_equal 0, VU.version_compare('1.2.3', '1.2.3')
|
|
19
|
+
assert_equal 0, VU.version_compare('1.2', '1.2')
|
|
20
|
+
assert_equal 0, VU.version_compare('1', '1')
|
|
21
|
+
end
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
def test_unequal_strings
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
assert_not_equal 0, VU.version_compare('1.0.0', '1.0.1')
|
|
26
|
+
assert_not_equal 0, VU.version_compare('1.2.3', '1.3.3')
|
|
27
|
+
assert_not_equal 0, VU.version_compare('1.2.3', '1.3')
|
|
28
|
+
assert_not_equal 0, VU.version_compare('1.2', '2.2')
|
|
29
|
+
assert_not_equal 0, VU.version_compare('1', '2')
|
|
30
|
+
assert_not_equal 0, VU.version_compare('1.2.3.4.5.6.7.8.9', '2')
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
assert VU.version_compare('1.0.0', '1.0.1') < 0
|
|
33
|
+
assert VU.version_compare('0.0.9', '1.0.0') < 0
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
assert VU.version_compare('1.0.1', '1.0.0') > 0
|
|
36
|
+
assert VU.version_compare('1.0.0', '0.0.9') > 0
|
|
37
|
+
end
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
def test_equal_arrays
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
assert_equal 0, VU.version_compare([ 1, 0, 0 ], [ 1, 0, 0 ])
|
|
42
|
+
assert_equal 0, VU.version_compare([ 1, 2, 3 ], [ 1, 2, 3 ])
|
|
43
|
+
assert_equal 0, VU.version_compare([ 1, 2 ], [ 1, 2 ])
|
|
44
|
+
assert_equal 0, VU.version_compare([ 1 ], [ 1 ])
|
|
45
|
+
end
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
def test_unequal_arrays
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
assert_not_equal 0, VU.version_compare([ 1, 0, 0 ], [ 1, 0, 1 ])
|
|
50
|
+
assert_not_equal 0, VU.version_compare([ 1, 2, 3 ], [ 1, 3, 3 ])
|
|
51
|
+
assert_not_equal 0, VU.version_compare([ 1, 2, 3 ], [ 1, 3 ])
|
|
52
|
+
assert_not_equal 0, VU.version_compare([ 1, 2 ], [ 2, 2 ])
|
|
53
|
+
assert_not_equal 0, VU.version_compare([ 1 ], [ 2 ])
|
|
54
|
+
assert_not_equal 0, VU.version_compare([ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], [ 2 ])
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
assert VU.version_compare([ 1, 0, 0 ], [ 1, 0, 1 ]) < 0
|
|
57
|
+
assert VU.version_compare([ 0, 0, 9 ], [ 1, 0, 0 ]) < 0
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
assert VU.version_compare([ 1, 0, 1 ], [ 1, 0, 0 ]) > 0
|
|
60
|
+
assert VU.version_compare([ 1, 0, 0 ], [ 0, 0, 9 ]) > 0
|
|
61
|
+
end
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
def test_equal_heterogenous_types
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
assert_equal 0, VU.version_compare('1.0.0', [ 1, 0, 0 ])
|
|
67
|
+
assert_equal 0, VU.version_compare([ 1, 0, 0 ], '1.0.0')
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
assert_equal 0, VU.version_compare('1.2.3', [ 1, 2, 3 ])
|
|
70
|
+
assert_equal 0, VU.version_compare([ 1, 2, 3 ], '1.2.3')
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
assert_equal 0, VU.version_compare('1.2', [ 1, 2 ])
|
|
73
|
+
assert_equal 0, VU.version_compare([ 1, 2 ], '1.2')
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
assert_equal 0, VU.version_compare('1', [ 1 ])
|
|
76
|
+
assert_equal 0, VU.version_compare([ 1 ], '1')
|
|
77
|
+
end
|
|
78
78
|
|
|
79
79
|
end
|
|
80
80
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pantheios-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.22.
|
|
4
|
+
version: 0.22.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Wilson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: xqsr3
|
|
@@ -16,20 +16,20 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.39.
|
|
19
|
+
version: 0.39.10
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '1
|
|
22
|
+
version: '1'
|
|
23
23
|
type: :development
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.39.
|
|
29
|
+
version: 0.39.10
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '1
|
|
32
|
+
version: '1'
|
|
33
33
|
description: 'A Ruby version of the popular C++ (and .NET) logging API library
|
|
34
34
|
|
|
35
35
|
'
|