zold 0.31.8 → 0.31.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +20 -0
  3. data/.github/workflows/actionlint.yml +41 -0
  4. data/.github/workflows/codecov.yml +23 -4
  5. data/.github/workflows/copyrights.yml +30 -0
  6. data/.github/workflows/pdd.yml +26 -3
  7. data/.github/workflows/rake.yml +24 -2
  8. data/.github/workflows/xcop.yml +21 -2
  9. data/.github/workflows/yamllint.yml +34 -0
  10. data/.gitignore +2 -1
  11. data/.rubocop.yml +21 -0
  12. data/.ruby-version +1 -1
  13. data/.rultor.yml +35 -5
  14. data/.simplecov +1 -1
  15. data/Dockerfile +28 -2
  16. data/Gemfile +11 -11
  17. data/Gemfile.lock +340 -0
  18. data/LICENSE.txt +1 -1
  19. data/Rakefile +9 -12
  20. data/bin/zold +1 -1
  21. data/cucumber.yml +20 -0
  22. data/deploy.sh +20 -0
  23. data/features/step_definitions/steps.rb +1 -1
  24. data/features/support/env.rb +1 -1
  25. data/fixtures/merge/asserts.rb +1 -1
  26. data/fixtures/merge/into_no_wallet/assert.rb +1 -1
  27. data/fixtures/merge/legacy_negatives_stay/assert.rb +1 -1
  28. data/fixtures/merge/missed_wallets/assert.rb +1 -1
  29. data/fixtures/merge/negative_overwriting/assert.rb +1 -1
  30. data/fixtures/merge/negatives_in_between/assert.rb +1 -1
  31. data/fixtures/merge/random_expenses/assert.rb +1 -1
  32. data/fixtures/merge/simple_case/assert.rb +1 -1
  33. data/fixtures/merge/unconfirmed_income/assert.rb +1 -1
  34. data/fixtures/scripts/_head.sh +21 -1
  35. data/fixtures/scripts/calculate-scores.sh +19 -0
  36. data/fixtures/scripts/distribute-wallet.sh +19 -0
  37. data/fixtures/scripts/print-helps.sh +19 -0
  38. data/fixtures/scripts/pull-on-start.sh +19 -0
  39. data/fixtures/scripts/push-and-pull.sh +19 -0
  40. data/fixtures/scripts/redeploy-on-upgrade.sh +19 -0
  41. data/fixtures/scripts/spread-wallets.sh +19 -0
  42. data/lib/zold/age.rb +2 -2
  43. data/lib/zold/amount.rb +2 -2
  44. data/lib/zold/cached_wallets.rb +3 -3
  45. data/lib/zold/commands/alias.rb +20 -0
  46. data/lib/zold/commands/args.rb +2 -2
  47. data/lib/zold/commands/calculate.rb +2 -2
  48. data/lib/zold/commands/clean.rb +2 -2
  49. data/lib/zold/commands/create.rb +2 -2
  50. data/lib/zold/commands/diff.rb +2 -2
  51. data/lib/zold/commands/fetch.rb +2 -2
  52. data/lib/zold/commands/invoice.rb +2 -2
  53. data/lib/zold/commands/list.rb +2 -2
  54. data/lib/zold/commands/merge.rb +2 -2
  55. data/lib/zold/commands/next.rb +2 -2
  56. data/lib/zold/commands/node.rb +2 -2
  57. data/lib/zold/commands/pay.rb +2 -2
  58. data/lib/zold/commands/propagate.rb +2 -2
  59. data/lib/zold/commands/pull.rb +2 -2
  60. data/lib/zold/commands/push.rb +2 -2
  61. data/lib/zold/commands/remote.rb +2 -2
  62. data/lib/zold/commands/remove.rb +2 -2
  63. data/lib/zold/commands/routines/audit.rb +2 -2
  64. data/lib/zold/commands/routines/gc.rb +2 -2
  65. data/lib/zold/commands/routines/reconcile.rb +2 -2
  66. data/lib/zold/commands/routines/reconnect.rb +2 -2
  67. data/lib/zold/commands/routines/retire.rb +2 -2
  68. data/lib/zold/commands/routines/spread.rb +2 -2
  69. data/lib/zold/commands/routines.rb +2 -2
  70. data/lib/zold/commands/show.rb +2 -2
  71. data/lib/zold/commands/taxes.rb +2 -2
  72. data/lib/zold/commands/thread_badge.rb +3 -3
  73. data/lib/zold/copies.rb +2 -2
  74. data/lib/zold/dir_items.rb +2 -2
  75. data/lib/zold/endless.rb +2 -2
  76. data/lib/zold/gem.rb +2 -2
  77. data/lib/zold/hands.rb +2 -2
  78. data/lib/zold/head.rb +3 -3
  79. data/lib/zold/hexnum.rb +2 -2
  80. data/lib/zold/http.rb +3 -3
  81. data/lib/zold/hungry_wallets.rb +2 -2
  82. data/lib/zold/id.rb +2 -2
  83. data/lib/zold/json_page.rb +2 -2
  84. data/lib/zold/key.rb +2 -2
  85. data/lib/zold/log.rb +2 -2
  86. data/lib/zold/metronome.rb +2 -2
  87. data/lib/zold/node/async_entrance.rb +2 -2
  88. data/lib/zold/node/entrance.rb +2 -2
  89. data/lib/zold/node/farm.rb +2 -2
  90. data/lib/zold/node/farmers.rb +2 -2
  91. data/lib/zold/node/front.rb +3 -3
  92. data/lib/zold/node/journaled_pipeline.rb +2 -2
  93. data/lib/zold/node/nodup_entrance.rb +2 -2
  94. data/lib/zold/node/nospam_entrance.rb +2 -2
  95. data/lib/zold/node/pipeline.rb +2 -2
  96. data/lib/zold/node/safe_entrance.rb +2 -2
  97. data/lib/zold/node/soft_error.rb +2 -2
  98. data/lib/zold/node/spread_entrance.rb +2 -2
  99. data/lib/zold/node/sync_entrance.rb +2 -2
  100. data/lib/zold/node/trace.rb +2 -2
  101. data/lib/zold/patch.rb +2 -2
  102. data/lib/zold/prefixes.rb +2 -2
  103. data/lib/zold/remotes.rb +2 -2
  104. data/lib/zold/signature.rb +2 -2
  105. data/lib/zold/size.rb +2 -2
  106. data/lib/zold/sync_wallets.rb +2 -2
  107. data/lib/zold/tax.rb +2 -2
  108. data/lib/zold/thread_pool.rb +2 -2
  109. data/lib/zold/tree_wallets.rb +2 -2
  110. data/lib/zold/txn.rb +2 -2
  111. data/lib/zold/txns.rb +3 -3
  112. data/lib/zold/upgrades.rb +1 -1
  113. data/lib/zold/verbose_thread.rb +2 -2
  114. data/lib/zold/version.rb +3 -3
  115. data/lib/zold/version_file.rb +1 -1
  116. data/lib/zold/wallet.rb +2 -2
  117. data/lib/zold/wallets.rb +2 -2
  118. data/lib/zold.rb +2 -2
  119. data/test/commands/routines/test_audit.rb +4 -4
  120. data/test/commands/routines/test_gc.rb +8 -8
  121. data/test/commands/routines/test_reconcile.rb +4 -4
  122. data/test/commands/routines/test_reconnect.rb +3 -3
  123. data/test/commands/routines/test_retire.rb +3 -3
  124. data/test/commands/test_alias.rb +26 -6
  125. data/test/commands/test_calculate.rb +3 -3
  126. data/test/commands/test_clean.rb +10 -10
  127. data/test/commands/test_create.rb +3 -3
  128. data/test/commands/test_diff.rb +5 -5
  129. data/test/commands/test_fetch.rb +9 -9
  130. data/test/commands/test_invoice.rb +3 -3
  131. data/test/commands/test_list.rb +3 -3
  132. data/test/commands/test_merge.rb +12 -12
  133. data/test/commands/test_node.rb +6 -6
  134. data/test/commands/test_pay.rb +19 -19
  135. data/test/commands/test_propagate.rb +5 -5
  136. data/test/commands/test_pull.rb +6 -6
  137. data/test/commands/test_push.rb +9 -9
  138. data/test/commands/test_remote.rb +11 -11
  139. data/test/commands/test_remove.rb +10 -10
  140. data/test/commands/test_show.rb +3 -3
  141. data/test/commands/test_taxes.rb +4 -4
  142. data/test/fake_home.rb +2 -2
  143. data/test/node/fake_entrance.rb +2 -2
  144. data/test/node/fake_node.rb +57 -40
  145. data/test/node/test_async_entrance.rb +10 -10
  146. data/test/node/test_entrance.rb +8 -8
  147. data/test/node/test_farm.rb +11 -11
  148. data/test/node/test_farmers.rb +5 -5
  149. data/test/node/test_front.rb +29 -28
  150. data/test/node/test_nodup_entrance.rb +4 -4
  151. data/test/node/test_nospam_entrance.rb +3 -3
  152. data/test/node/test_safe_entrance.rb +4 -4
  153. data/test/node/test_spread_entrance.rb +8 -8
  154. data/test/node/test_sync_entrance.rb +4 -4
  155. data/test/node/test_trace.rb +2 -2
  156. data/test/test__helper.rb +4 -4
  157. data/test/test_age.rb +2 -2
  158. data/test/test_amount.rb +2 -2
  159. data/test/test_cached_wallets.rb +2 -2
  160. data/test/test_copies.rb +12 -12
  161. data/test/test_dir_items.rb +4 -4
  162. data/test/test_gem.rb +20 -0
  163. data/test/test_hands.rb +2 -2
  164. data/test/test_hexnum.rb +2 -2
  165. data/test/test_http.rb +8 -8
  166. data/test/test_hungry_wallets.rb +11 -11
  167. data/test/test_id.rb +2 -2
  168. data/test/test_json_page.rb +2 -2
  169. data/test/test_key.rb +2 -2
  170. data/test/test_log.rb +5 -5
  171. data/test/test_metronome.rb +6 -6
  172. data/test/test_patch.rb +14 -14
  173. data/test/test_prefixes.rb +3 -3
  174. data/test/test_remotes.rb +9 -9
  175. data/test/test_signature.rb +2 -2
  176. data/test/test_size.rb +2 -2
  177. data/test/test_sync_wallets.rb +3 -3
  178. data/test/test_tax.rb +9 -9
  179. data/test/test_thread_pool.rb +8 -8
  180. data/test/test_tree_wallets.rb +2 -2
  181. data/test/test_txn.rb +2 -2
  182. data/test/test_upgrades.rb +2 -2
  183. data/test/test_verbose_thread.rb +2 -2
  184. data/test/test_version.rb +20 -0
  185. data/test/test_wallet.rb +22 -22
  186. data/test/test_wallets.rb +5 -5
  187. data/test/test_zold.rb +5 -5
  188. data/test/upgrades/test_delete_banned_wallets.rb +4 -4
  189. data/test/upgrades/test_protocol_up.rb +4 -4
  190. data/upgrades/2.rb +1 -1
  191. data/upgrades/delete_banned_wallets.rb +1 -1
  192. data/upgrades/move_wallets_into_tree.rb +1 -1
  193. data/upgrades/protocol_up.rb +1 -1
  194. data/upgrades/rename_foreign_wallets.rb +1 -1
  195. data/zold.gemspec +23 -23
  196. metadata +7 -3
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,11 +26,11 @@ require_relative '../lib/zold/metronome'
26
26
 
27
27
  # Metronome test.
28
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
29
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
30
30
  # License:: MIT
31
31
  class TestMetronome < Zold::Test
32
32
  def test_start_and_stop
33
- metronome = Zold::Metronome.new(test_log)
33
+ metronome = Zold::Metronome.new(fake_log)
34
34
  list = []
35
35
  metronome.add(FakeRoutine.new(list))
36
36
  metronome.start do
@@ -39,7 +39,7 @@ class TestMetronome < Zold::Test
39
39
  end
40
40
 
41
41
  def test_prints_to_text
42
- metronome = Zold::Metronome.new(test_log)
42
+ metronome = Zold::Metronome.new(fake_log)
43
43
  metronome.add(FakeRoutine.new([]))
44
44
  metronome.start do |m|
45
45
  assert(!m.to_text.nil?)
@@ -47,14 +47,14 @@ class TestMetronome < Zold::Test
47
47
  end
48
48
 
49
49
  def test_prints_empty_to_text
50
- metronome = Zold::Metronome.new(test_log)
50
+ metronome = Zold::Metronome.new(fake_log)
51
51
  metronome.start do |m|
52
52
  assert(!m.to_text.nil?)
53
53
  end
54
54
  end
55
55
 
56
56
  def test_continues_even_after_error
57
- metronome = Zold::Metronome.new(test_log)
57
+ metronome = Zold::Metronome.new(fake_log)
58
58
  routine = BrokenRoutine.new
59
59
  metronome.add(routine)
60
60
  metronome.start do
data/test/test_patch.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -32,11 +32,11 @@ require_relative '../lib/zold/patch'
32
32
 
33
33
  # Patch test.
34
34
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
35
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
35
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
36
36
  # License:: MIT
37
37
  class TestPatch < Zold::Test
38
38
  def test_builds_patch
39
- FakeHome.new(log: test_log).run do |home|
39
+ FakeHome.new(log: fake_log).run do |home|
40
40
  first = home.create_wallet
41
41
  second = home.create_wallet
42
42
  third = home.create_wallet
@@ -49,7 +49,7 @@ class TestPatch < Zold::Test
49
49
  File.write(third.path, File.read(first.path))
50
50
  t = third.sub(Zold::Amount.new(zld: 10.0), "NOPREFIX@#{Zold::Id.new}", key)
51
51
  third.add(t.inverse(Zold::Id.new))
52
- patch = Zold::Patch.new(home.wallets, log: test_log)
52
+ patch = Zold::Patch.new(home.wallets, log: fake_log)
53
53
  patch.join(first) { false }
54
54
  patch.join(second) { false }
55
55
  patch.join(third) { false }
@@ -59,12 +59,12 @@ class TestPatch < Zold::Test
59
59
  end
60
60
 
61
61
  def test_rejects_fake_positives
62
- FakeHome.new(log: test_log).run do |home|
62
+ FakeHome.new(log: fake_log).run do |home|
63
63
  first = home.create_wallet
64
64
  second = home.create_wallet
65
65
  File.write(second.path, File.read(first.path))
66
66
  second.add(Zold::Txn.new(1, Time.now, Zold::Amount.new(zld: 11.0), 'NOPREFIX', Zold::Id.new, 'fake'))
67
- patch = Zold::Patch.new(home.wallets, log: test_log)
67
+ patch = Zold::Patch.new(home.wallets, log: fake_log)
68
68
  patch.join(first) { false }
69
69
  patch.join(second) { false }
70
70
  assert_equal(false, patch.save(first.path, overwrite: true))
@@ -74,14 +74,14 @@ class TestPatch < Zold::Test
74
74
  end
75
75
 
76
76
  def test_accepts_negative_balance_in_root_wallet
77
- FakeHome.new(log: test_log).run do |home|
77
+ FakeHome.new(log: fake_log).run do |home|
78
78
  first = home.create_wallet(Zold::Id::ROOT)
79
79
  second = home.create_wallet
80
80
  File.write(second.path, File.read(first.path))
81
81
  amount = Zold::Amount.new(zld: 333.0)
82
82
  key = Zold::Key.new(file: 'fixtures/id_rsa')
83
83
  second.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
84
- patch = Zold::Patch.new(home.wallets, log: test_log)
84
+ patch = Zold::Patch.new(home.wallets, log: fake_log)
85
85
  patch.join(first) { false }
86
86
  patch.join(second) { false }
87
87
  assert_equal(true, patch.save(first.path, overwrite: true))
@@ -91,7 +91,7 @@ class TestPatch < Zold::Test
91
91
  end
92
92
 
93
93
  def test_merges_similar_ids_but_different_signs
94
- FakeHome.new(log: test_log).run do |home|
94
+ FakeHome.new(log: fake_log).run do |home|
95
95
  first = home.create_wallet(Zold::Id::ROOT)
96
96
  second = home.create_wallet
97
97
  File.write(second.path, File.read(first.path))
@@ -103,7 +103,7 @@ class TestPatch < Zold::Test
103
103
  Zold::Prefixes.new(first).create, Zold::Id.new, 'fake'
104
104
  )
105
105
  )
106
- patch = Zold::Patch.new(home.wallets, log: test_log)
106
+ patch = Zold::Patch.new(home.wallets, log: fake_log)
107
107
  patch.join(first) { false }
108
108
  patch.join(second) { false }
109
109
  assert_equal(true, patch.save(first.path, overwrite: true))
@@ -113,7 +113,7 @@ class TestPatch < Zold::Test
113
113
  end
114
114
 
115
115
  def test_merges_fragmented_parts
116
- FakeHome.new(log: test_log).run do |home|
116
+ FakeHome.new(log: fake_log).run do |home|
117
117
  first = home.create_wallet(Zold::Id::ROOT)
118
118
  second = home.create_wallet
119
119
  File.write(second.path, File.read(first.path))
@@ -137,7 +137,7 @@ class TestPatch < Zold::Test
137
137
  'NOPREFIX', Zold::Id.new, 'third payment'
138
138
  ).signed(key, first.id)
139
139
  )
140
- patch = Zold::Patch.new(home.wallets, log: test_log)
140
+ patch = Zold::Patch.new(home.wallets, log: fake_log)
141
141
  patch.join(first) { false }
142
142
  patch.join(second) { false }
143
143
  assert_equal(true, patch.save(first.path, overwrite: true))
@@ -148,7 +148,7 @@ class TestPatch < Zold::Test
148
148
  end
149
149
 
150
150
  def test_protocols_new_txns
151
- FakeHome.new(log: test_log).run do |home|
151
+ FakeHome.new(log: fake_log).run do |home|
152
152
  first = home.create_wallet(Zold::Id::ROOT)
153
153
  second = home.create_wallet
154
154
  File.write(second.path, File.read(first.path))
@@ -157,7 +157,7 @@ class TestPatch < Zold::Test
157
157
  target = Zold::Id.new
158
158
  second.sub(amount, "NOPREFIX@#{target}", key, 'some details')
159
159
  second.sub(amount * 2, "NOPREFIX@#{target}", key)
160
- patch = Zold::Patch.new(home.wallets, log: test_log)
160
+ patch = Zold::Patch.new(home.wallets, log: fake_log)
161
161
  patch.legacy(first)
162
162
  Tempfile.open do |f|
163
163
  patch.join(second, ledger: f.path) { false }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -30,11 +30,11 @@ require_relative '../lib/zold/prefixes'
30
30
 
31
31
  # Prefixes test.
32
32
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
33
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
34
34
  # License:: MIT
35
35
  class TestPrefixes < Zold::Test
36
36
  def test_creates_and_validates
37
- FakeHome.new(log: test_log).run do |home|
37
+ FakeHome.new(log: fake_log).run do |home|
38
38
  wallet = home.create_wallet
39
39
  prefixes = Zold::Prefixes.new(wallet)
40
40
  (8..32).each do |len|
data/test/test_remotes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -32,7 +32,7 @@ require_relative '../lib/zold/verbose_thread'
32
32
 
33
33
  # Remotes test.
34
34
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
35
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
35
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
36
36
  # License:: MIT
37
37
  class TestRemotes < Zold::Test
38
38
  def test_adds_remotes
@@ -118,7 +118,7 @@ class TestRemotes < Zold::Test
118
118
  remotes.clean
119
119
  5.times { |i| remotes.add("0.0.0.#{i + 1}", 8080) }
120
120
  total = 0
121
- remotes.iterate(test_log) do
121
+ remotes.iterate(fake_log) do
122
122
  sleep 0.25
123
123
  total += 1
124
124
  end
@@ -126,7 +126,7 @@ class TestRemotes < Zold::Test
126
126
  end
127
127
  end
128
128
 
129
- def test_log_msg_of_iterates_when_fail
129
+ def fake_log_msg_of_iterates_when_fail
130
130
  Dir.mktmpdir do |dir|
131
131
  file = File.join(dir, 'remotes')
132
132
  FileUtils.touch(file)
@@ -138,7 +138,7 @@ class TestRemotes < Zold::Test
138
138
  end
139
139
  end
140
140
 
141
- def test_log_msg_of_iterates_when_take_too_long
141
+ def fake_log_msg_of_iterates_when_take_too_long
142
142
  Dir.mktmpdir do |dir|
143
143
  file = File.join(dir, 'remotes')
144
144
  FileUtils.touch(file)
@@ -254,10 +254,10 @@ class TestRemotes < Zold::Test
254
254
  remotes.add('127.0.0.1', 8080 + t)
255
255
  remotes.error('127.0.0.1', 8080 + t)
256
256
  remotes.all
257
- remotes.iterate(test_log) { remotes.all }
257
+ remotes.iterate(fake_log) { remotes.all }
258
258
  remotes.remove('127.0.0.1', 8080 + t)
259
259
  end
260
- test_log.info("Total time: #{Zold::Age.new(start)}")
260
+ fake_log.info("Total time: #{Zold::Age.new(start)}")
261
261
  end
262
262
  end
263
263
 
@@ -298,7 +298,7 @@ class TestRemotes < Zold::Test
298
298
  'X-Zold-Error': 'hey you'
299
299
  }
300
300
  )
301
- remotes.iterate(test_log) do |r|
301
+ remotes.iterate(fake_log) do |r|
302
302
  r.assert_code(200, r.http.get)
303
303
  end
304
304
  end
@@ -310,7 +310,7 @@ class TestRemotes < Zold::Test
310
310
  remotes.clean
311
311
  remotes.add('r5-example.org', 8080)
312
312
  stub_request(:get, 'http://r5-example.org:8080/').to_return(status: 200)
313
- remotes.iterate(test_log) do |r|
313
+ remotes.iterate(fake_log) do |r|
314
314
  r.http.get
315
315
  end
316
316
  assert_requested(:get, 'http://r5-example.org:8080/', headers: { 'X-Zold-Network' => 'x13' })
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -31,7 +31,7 @@ require_relative '../lib/zold/signature'
31
31
 
32
32
  # Signature test.
33
33
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
34
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
34
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
35
35
  # License:: MIT
36
36
  class TestSignature < Zold::Test
37
37
  def test_signs_and_validates
data/test/test_size.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,7 +26,7 @@ require_relative '../lib/zold/size'
26
26
 
27
27
  # Size test.
28
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
29
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
30
30
  # License:: MIT
31
31
  class TestSize < Zold::Test
32
32
  def test_prints_size
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -33,11 +33,11 @@ require_relative '../lib/zold/amount'
33
33
 
34
34
  # SyncWallets test.
35
35
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
36
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
36
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
37
37
  # License:: MIT
38
38
  class TestSyncWallets < Zold::Test
39
39
  def test_adds_wallet
40
- FakeHome.new(log: test_log).run do |home|
40
+ FakeHome.new(log: fake_log).run do |home|
41
41
  wallets = home.wallets
42
42
  id = Zold::Id.new
43
43
  home.create_wallet(id)
data/test/test_tax.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -35,15 +35,15 @@ require_relative '../lib/zold/prefixes'
35
35
 
36
36
  # Tax test.
37
37
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
38
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
38
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
39
39
  # License:: MIT
40
40
  class TestTax < Zold::Test
41
41
  def test_print_fee
42
- test_log.info("Fee in zents: #{Zold::Tax::FEE.to_i}")
42
+ fake_log.info("Fee in zents: #{Zold::Tax::FEE.to_i}")
43
43
  end
44
44
 
45
45
  def test_calculates_tax_for_one_year
46
- FakeHome.new(log: test_log).run do |home|
46
+ FakeHome.new(log: fake_log).run do |home|
47
47
  wallet = home.create_wallet
48
48
  a = 10_000
49
49
  wallet.add(
@@ -60,7 +60,7 @@ class TestTax < Zold::Test
60
60
  end
61
61
 
62
62
  def test_calculates_debt
63
- FakeHome.new(log: test_log).run do |home|
63
+ FakeHome.new(log: fake_log).run do |home|
64
64
  wallet = home.create_wallet
65
65
  (1..30).each do |i|
66
66
  wallet.add(
@@ -84,7 +84,7 @@ class TestTax < Zold::Test
84
84
  end
85
85
 
86
86
  def test_prints_tax_formula
87
- FakeHome.new(log: test_log).run do |home|
87
+ FakeHome.new(log: fake_log).run do |home|
88
88
  wallet = home.create_wallet
89
89
  tax = Zold::Tax.new(wallet)
90
90
  assert(!tax.to_text.nil?)
@@ -92,7 +92,7 @@ class TestTax < Zold::Test
92
92
  end
93
93
 
94
94
  def test_takes_tax_payment_into_account
95
- FakeHome.new(log: test_log).run do |home|
95
+ FakeHome.new(log: fake_log).run do |home|
96
96
  wallet = home.create_wallet
97
97
  amount = Zold::Amount.new(zents: 95_596_800)
98
98
  wallet.add(
@@ -112,7 +112,7 @@ class TestTax < Zold::Test
112
112
  end
113
113
 
114
114
  def test_filters_out_incoming_payments
115
- FakeHome.new(log: test_log).run do |home|
115
+ FakeHome.new(log: fake_log).run do |home|
116
116
  wallet = home.create_wallet
117
117
  amount = Zold::Amount.new(zents: 95_596_800)
118
118
  prefix = Zold::Prefixes.new(wallet).create(8)
@@ -146,7 +146,7 @@ class TestTax < Zold::Test
146
146
  end
147
147
 
148
148
  def test_checks_existence_of_duplicates
149
- FakeHome.new(log: test_log).run do |home|
149
+ FakeHome.new(log: fake_log).run do |home|
150
150
  wallet = home.create_wallet
151
151
  wallet.add(
152
152
  Zold::Txn.new(
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,11 +27,11 @@ require_relative '../lib/zold/thread_pool'
27
27
 
28
28
  # ThreadPool test.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
31
31
  # License:: MIT
32
32
  class TestThreadPool < Zold::Test
33
33
  def test_closes_all_threads_right
34
- pool = Zold::ThreadPool.new('test', log: test_log)
34
+ pool = Zold::ThreadPool.new('test', log: fake_log)
35
35
  idx = Concurrent::AtomicFixnum.new
36
36
  threads = 50
37
37
  threads.times do
@@ -44,7 +44,7 @@ class TestThreadPool < Zold::Test
44
44
  end
45
45
 
46
46
  def test_adds_and_stops
47
- pool = Zold::ThreadPool.new('test', log: test_log)
47
+ pool = Zold::ThreadPool.new('test', log: fake_log)
48
48
  pool.add do
49
49
  sleep 60 * 60
50
50
  end
@@ -52,7 +52,7 @@ class TestThreadPool < Zold::Test
52
52
  end
53
53
 
54
54
  def test_stops_stuck_threads
55
- pool = Zold::ThreadPool.new('test', log: test_log)
55
+ pool = Zold::ThreadPool.new('test', log: fake_log)
56
56
  pool.add do
57
57
  loop do
58
58
  # forever
@@ -62,12 +62,12 @@ class TestThreadPool < Zold::Test
62
62
  end
63
63
 
64
64
  def test_stops_empty_pool
65
- pool = Zold::ThreadPool.new('test', log: test_log)
65
+ pool = Zold::ThreadPool.new('test', log: fake_log)
66
66
  pool.kill
67
67
  end
68
68
 
69
69
  def test_prints_to_json
70
- pool = Zold::ThreadPool.new('test', log: test_log)
70
+ pool = Zold::ThreadPool.new('test', log: fake_log)
71
71
  pool.add do
72
72
  Thread.current.thread_variable_set(:foo, 1)
73
73
  loop do
@@ -83,7 +83,7 @@ class TestThreadPool < Zold::Test
83
83
  end
84
84
 
85
85
  def test_prints_to_text
86
- pool = Zold::ThreadPool.new('test', log: test_log)
86
+ pool = Zold::ThreadPool.new('test', log: fake_log)
87
87
  assert(!pool.to_s.nil?)
88
88
  end
89
89
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -30,7 +30,7 @@ require_relative '../lib/zold/tree_wallets'
30
30
 
31
31
  # TreeWallets test.
32
32
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
33
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
34
34
  # License:: MIT
35
35
  class TestTreeWallets < Zold::Test
36
36
  def test_adds_wallet
data/test/test_txn.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -30,7 +30,7 @@ require_relative '../lib/zold/amount'
30
30
 
31
31
  # Txn test.
32
32
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
33
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
34
34
  # License:: MIT
35
35
  class TestTxn < Zold::Test
36
36
  def test_prints_and_parses
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +27,7 @@ require_relative '../lib/zold/version_file'
27
27
 
28
28
  # Upgrade test.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
31
31
  # License:: MIT
32
32
  class TestUpgrades < Zold::Test
33
33
  # @todo #327:30min Uncomment, when you're ready to work on upgrade manager's
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,7 +26,7 @@ require_relative '../lib/zold/verbose_thread'
26
26
 
27
27
  # VerboseThread test.
28
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
29
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
30
30
  # License:: MIT
31
31
  class TestVerboseThread < Zold::Test
32
32
  def test_exceptions_are_logged
data/test/test_version.rb CHANGED
@@ -1,5 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Copyright (c) 2018-2024 Zerocracy
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
3
23
  require 'semantic'
4
24
  require 'zold/version'
5
25
  require 'minitest/autorun'