currency_test.go   A
last analyzed

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 15
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A money.TestCurrency_Create 0 12 4
A money.TestCurrency_Add 0 5 2
1
package money
2
3
import "testing"
4
5
func TestCurrency_Create(t *testing.T) {
6
	tcs := []struct {
7
		currency *Currency
8
		code     string
9
	}{
10
		{USD(), "USD"},
11
		{EUR(), "EUR"},
12
	}
13
14
	for _, tc := range tcs {
15
		if tc.currency.code != tc.code {
16
			t.Errorf("Expected %s got %s", tc.code, tc.currency.code)
17
		}
18
	}
19
}
20
21
func TestCurrency_Add(t *testing.T) {
22
	c := Add("BTC", ".", "", 8, "BTC", "1BTC")
23
24
	if c.code != "BTC" {
25
		t.Errorf("Expected %s got %s", "BTC", c.code)
26
	}
27
}
28