money.*calculator.add   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 2
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
package money
2
3
type calculator struct{}
4
5
func (c *calculator) add(a, b *Amount) *Amount {
6 1
	return &Amount{a.Value() + b.Value()}
7
}
8
9
func (c *calculator) subtract(a, b *Amount) *Amount {
10 1
	return &Amount{a.Value() - b.Value()}
11
}
12
13
func (c *calculator) multiply(a *Amount, m int64) *Amount {
14 1
	return &Amount{a.Value() * m}
15
}
16
17
func (c *calculator) allocate(a *Amount, ratio, total int) *Amount {
18 1
	return &Amount{a.Value() * int64(ratio) / int64(total)}
19
}
20