-
Notifications
You must be signed in to change notification settings - Fork 5
/
fromRDF_test.go
119 lines (95 loc) · 3.43 KB
/
fromRDF_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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package gojsonld
import (
"encoding/json"
"reflect"
"testing"
)
func testFromRDF(input, output string, useNativeTypes, useRdfType bool, t *testing.T) {
inputRDF, inputErr := ReadDatasetFromFile(test_dir + input)
if !isNil(inputErr) {
t.Error("Could not open input: " + inputErr.Error())
return
}
outputJSON, outputErr := ReadJSONFromFile(test_dir + output)
if !isNil(outputErr) {
t.Error("Could not open output: " + outputErr.Error())
return
}
options := &Options{}
options.UseNativeTypes = useNativeTypes
options.UseRdfType = useRdfType
serializedJSON := FromRDF(inputRDF, options)
serializedString, _ := json.MarshalIndent(serializedJSON, "", " ")
outputString, _ := json.MarshalIndent(outputJSON, "", " ")
if !reflect.DeepEqual(serializedJSON, outputJSON) {
t.Error("Expected:\n", string(outputString), "\nGot:\n",
string(serializedString))
return
}
}
func TestFromRDF0001(t *testing.T) {
testFromRDF("fromRdf-0001-in.nq", "fromRdf-0001-out.jsonld", false, false, t)
}
func TestFromRDF0002(t *testing.T) {
testFromRDF("fromRdf-0002-in.nq", "fromRdf-0002-out.jsonld", false, false, t)
}
func TestFromRDF0003(t *testing.T) {
testFromRDF("fromRdf-0003-in.nq", "fromRdf-0003-out.jsonld", false, false, t)
}
func TestFromRDF0004(t *testing.T) {
testFromRDF("fromRdf-0004-in.nq", "fromRdf-0004-out.jsonld", false, false, t)
}
func TestFromRDF0005(t *testing.T) {
testFromRDF("fromRdf-0005-in.nq", "fromRdf-0005-out.jsonld", false, false, t)
}
func TestFromRDF0006(t *testing.T) {
testFromRDF("fromRdf-0006-in.nq", "fromRdf-0006-out.jsonld", false, false, t)
}
func TestFromRDF0007(t *testing.T) {
testFromRDF("fromRdf-0007-in.nq", "fromRdf-0007-out.jsonld", false, false, t)
}
func TestFromRDF0008(t *testing.T) {
testFromRDF("fromRdf-0008-in.nq", "fromRdf-0008-out.jsonld", false, false, t)
}
func TestFromRDF0009(t *testing.T) {
testFromRDF("fromRdf-0009-in.nq", "fromRdf-0009-out.jsonld", false, false, t)
}
func TestFromRDF0010(t *testing.T) {
testFromRDF("fromRdf-0010-in.nq", "fromRdf-0010-out.jsonld", false, false, t)
}
func TestFromRDF0011(t *testing.T) {
testFromRDF("fromRdf-0011-in.nq", "fromRdf-0011-out.jsonld", false, false, t)
}
func TestFromRDF0012(t *testing.T) {
testFromRDF("fromRdf-0012-in.nq", "fromRdf-0012-out.jsonld", false, false, t)
}
func TestFromRDF0013(t *testing.T) {
testFromRDF("fromRdf-0013-in.nq", "fromRdf-0013-out.jsonld", false, false, t)
}
func TestFromRDF0014(t *testing.T) {
testFromRDF("fromRdf-0014-in.nq", "fromRdf-0014-out.jsonld", false, false, t)
}
func TestFromRDF0015(t *testing.T) {
testFromRDF("fromRdf-0015-in.nq", "fromRdf-0015-out.jsonld", false, false, t)
}
func TestFromRDF0016(t *testing.T) {
testFromRDF("fromRdf-0016-in.nq", "fromRdf-0016-out.jsonld", false, false, t)
}
func TestFromRDF0017(t *testing.T) {
testFromRDF("fromRdf-0017-in.nq", "fromRdf-0017-out.jsonld", false, false, t)
}
func TestFromRDF0018(t *testing.T) {
testFromRDF("fromRdf-0018-in.nq", "fromRdf-0018-out.jsonld", true, false, t)
}
func TestFromRDF0019(t *testing.T) {
testFromRDF("fromRdf-0019-in.nq", "fromRdf-0019-out.jsonld", false, true, t)
}
func TestFromRDF0020(t *testing.T) {
testFromRDF("fromRdf-0020-in.nq", "fromRdf-0020-out.jsonld", false, false, t)
}
func TestFromRDF0021(t *testing.T) {
testFromRDF("fromRdf-0021-in.nq", "fromRdf-0021-out.jsonld", false, false, t)
}
func TestFromRDF0022(t *testing.T) {
testFromRDF("fromRdf-0022-in.nq", "fromRdf-0022-out.jsonld", false, false, t)
}