-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcurrency_test.go
More file actions
42 lines (36 loc) · 816 Bytes
/
currency_test.go
File metadata and controls
42 lines (36 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package faker_test
import (
"fmt"
"testing"
"github.com/pioz/faker"
"github.com/stretchr/testify/assert"
)
func ExampleCurrencyName() {
faker.SetSeed(1200)
fmt.Println(faker.CurrencyName())
// Output: Sierra Leonean Leone
}
func ExampleCurrencyCode() {
faker.SetSeed(1201)
fmt.Println(faker.CurrencyCode())
// Output: XOF
}
func ExampleCurrencySymbol() {
faker.SetSeed(1202)
fmt.Println(faker.CurrencySymbol())
// Output: ₮
}
func TestCurrencyBuild(t *testing.T) {
faker.SetSeed(1210)
s := &struct {
Field1 string `faker:"CurrencyName"`
Field2 string `faker:"CurrencyCode"`
Field3 string `faker:"CurrencySymbol"`
}{}
err := faker.Build(&s)
assert.Nil(t, err)
t.Log(s)
assert.Equal(t, "Bermudian Dollar", s.Field1)
assert.Equal(t, "XCD", s.Field2)
assert.Equal(t, "K", s.Field3)
}