zold 0.14.48 → 0.14.49
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/lib/zold/amount.rb +6 -0
- data/lib/zold/commands/invoice.rb +1 -2
- data/lib/zold/commands/routines/spread.rb +1 -1
- data/lib/zold/tree_wallets.rb +1 -1
- data/lib/zold/version.rb +1 -1
- data/lib/zold/wallets.rb +1 -1
- data/test/test_amount.rb +10 -0
- data/test/test_tree_wallets.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3a66103ede11237d2ccfcdd1ce46a4e59eedd713a601443440459677c7f665e
|
|
4
|
+
data.tar.gz: 177d88b0030850e1d6848a7ef92b10873e23342b77f50ff2b2344c29dac4d99a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7d8ede15f27a062b31ffa705fc3ccf4f387a7884dd5d3b18527cb24b9d3baa1e31715420412a385f41d1f98735b3de7ff017218d5c21fec301fcc0f7e3a31a50
|
|
7
|
+
data.tar.gz: c9d21059a4093c33677c81b1402b217ff8cbe1aff453f6682fc815681a938b584ae5b52d7b5ca5e7ec21f763aa96ec611fe66bee3c5d69cc360f93ee590ae1af
|
data/lib/zold/amount.rb
CHANGED
|
@@ -112,9 +112,15 @@ module Zold
|
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
def *(other)
|
|
115
|
+
raise '* may only work with a number' unless other.is_a?(Integer) || other.is_a?(Float)
|
|
115
116
|
c = (@coins * other).to_i
|
|
116
117
|
raise "Overflow, can't multiply #{@coins} by #{m}" if c > Amount::MAX
|
|
117
118
|
Amount.new(coins: c)
|
|
118
119
|
end
|
|
120
|
+
|
|
121
|
+
def /(other)
|
|
122
|
+
raise '/ may only work with a number' unless other.is_a?(Integer) || other.is_a?(Float)
|
|
123
|
+
Amount.new(coins: (@coins / other).to_i)
|
|
124
|
+
end
|
|
119
125
|
end
|
|
120
126
|
end
|
|
@@ -49,7 +49,7 @@ module Zold
|
|
|
49
49
|
end
|
|
50
50
|
ids = @wallets.all.sample(10)
|
|
51
51
|
Push.new(wallets: @wallets, remotes: @remotes, log: @log).run(
|
|
52
|
-
['push', "--network=#{@opts['network']}"] + ids
|
|
52
|
+
['push', "--network=#{@opts['network']}"] + ids.map(&:to_s)
|
|
53
53
|
)
|
|
54
54
|
if ids.empty?
|
|
55
55
|
@log.info("Spread didn't push any wallets, we are empty")
|
data/lib/zold/tree_wallets.rb
CHANGED
data/lib/zold/version.rb
CHANGED
data/lib/zold/wallets.rb
CHANGED
data/test/test_amount.rb
CHANGED
|
@@ -65,4 +65,14 @@ class TestAmount < Minitest::Test
|
|
|
65
65
|
"#{amount} is not greater than zero"
|
|
66
66
|
)
|
|
67
67
|
end
|
|
68
|
+
|
|
69
|
+
def test_multiplies
|
|
70
|
+
amount = Zold::Amount.new(zld: 1.2)
|
|
71
|
+
assert(Zold::Amount.new(zld: 2.4), amount * 2)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_divides
|
|
75
|
+
amount = Zold::Amount.new(zld: 8.2)
|
|
76
|
+
assert(Zold::Amount.new(zld: 4.1), amount / 2)
|
|
77
|
+
end
|
|
68
78
|
end
|
data/test/test_tree_wallets.rb
CHANGED
|
@@ -38,7 +38,7 @@ class TestTreeWallets < Minitest::Test
|
|
|
38
38
|
wallets.find(id) do |wallet|
|
|
39
39
|
wallet.init(id, Zold::Key.new(file: 'fixtures/id_rsa.pub'))
|
|
40
40
|
assert_equal(1, wallets.all.count)
|
|
41
|
-
assert_equal(id
|
|
41
|
+
assert_equal(id, wallets.all[0])
|
|
42
42
|
assert(wallet.path.end_with?('/a/b/c/d/abcd0123abcd0123.z'), wallet.path)
|
|
43
43
|
end
|
|
44
44
|
end
|