-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissn2ppn_test.go
52 lines (43 loc) · 967 Bytes
/
issn2ppn_test.go
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
43
44
45
46
47
48
49
50
51
52
package gosudoc
import (
"fmt"
"reflect"
"testing"
)
type issnTest struct {
Input []string
Expected map[string][]string
}
func TestIssn2ppn(t *testing.T) {
var Issn2Tests = []issnTest{
{
Input: []string{"02672472"},
Expected: map[string][]string{"02672472": {"013630687"}},
},
{
Input: []string{"02672472", "0296-2454"},
Expected: map[string][]string{"02672472": {"013630687"}, "0296-2454": {"001020617"}},
},
}
for _, test := range Issn2Tests {
actual, _ := Issn2ppn(test.Input)
if reflect.DeepEqual(test.Expected, actual) {
t.Logf("PASS: got %v", test.Expected)
} else {
t.Fatalf("FAIL for %s: expected %v, actual result was %v", test.Input, test.Expected, actual)
}
}
}
func ExampleIssn2ppn() {
myInput := []string{"02672472"}
result, _ := Issn2ppn(myInput)
for k, v := range result {
fmt.Println(k)
for _, value := range v {
fmt.Println(value)
}
}
// Output:
// 02672472
// 013630687
}