Debian Codegraph @

spdxexp/node_test.go

raw symbols SCIP
1 package spdxexpscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/
2
3 import (
4 "testingscip-go gomod github.com/golang/go/src go1.24 testing/"
5
6 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/"
7 )
8
9 func TestReconstructedLicenseStringscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/TestReconstructedLicenseString().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
10 tests := []struct {
11 name string
12 node *nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#
13 result string
14 }{
15 {"License node - simple", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), "MIT"},
16 {"License node - plus", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-1.0", true), "Apache-1.0+"},
17 {"License node - exception",
18 &nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#{
19 rolescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#role.: licenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNode.,
20 expscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#exp.: nil,
21 licscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#lic.: &licenseNodePartialscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#{
22 licensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#license.: "GPL-2.0", hasPlusscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#hasPlus.: false,
23 hasExceptionscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#hasException.: true, exceptionscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#exception.: "Bison-exception-2.2"},
24 refscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#ref.: nil,
25 }, "GPL-2.0 WITH Bison-exception-2.2"},
26 {"LicenseRef node - simple",
27 &nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#{
28 rolescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#role.: licenseRefNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRefNode.,
29 expscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#exp.: nil,
30 licscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#lic.: nil,
31 refscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#ref.: &referenceNodePartialscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/referenceNodePartial#{
32 hasDocumentRefscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/referenceNodePartial#hasDocumentRef.: false,
33 documentRefscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/referenceNodePartial#documentRef.: "",
34 licenseRefscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/referenceNodePartial#licenseRef.: "MIT-Style-2",
35 },
36 }, "LicenseRef-MIT-Style-2"},
37 {"LicenseRef node - with DocumentRef",
38 &nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#{
39 rolescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#role.: licenseRefNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRefNode.,
40 expscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#exp.: nil,
41 licscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#lic.: nil,
42 refscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#ref.: &referenceNodePartialscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/referenceNodePartial#{
43 hasDocumentRefscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/referenceNodePartial#hasDocumentRef.: true,
44 documentRefscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/referenceNodePartial#documentRef.: "spdx-tool-1.2",
45 licenseRefscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/referenceNodePartial#licenseRef.: "MIT-Style-2",
46 },
47 }, "DocumentRef-spdx-tool-1.2:LicenseRef-MIT-Style-2"},
48 {"Expression node - AND", getParsedNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getParsedNode().("MIT AND Apache-2.0"), "MIT AND Apache-2.0"},
49 {"Expression node - parentheses required (OR under AND)", getParsedNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getParsedNode().("(MIT OR Apache-2.0) AND BSD-3-Clause"), "(MIT OR Apache-2.0) AND BSD-3-Clause"},
50 {"Expression node - parentheses required (OR on right)", getParsedNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getParsedNode().("MIT AND (Apache-2.0 OR BSD-3-Clause)"), "MIT AND (Apache-2.0 OR BSD-3-Clause)"},
51 {"Expression node - precedence (AND under OR)", getParsedNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getParsedNode().("MIT OR Apache-2.0 AND BSD-3-Clause"), "MIT OR Apache-2.0 AND BSD-3-Clause"},
52 }
53
54 for _, test := range tests {
55 test := test
56 t.Runscip-go gomod github.com/golang/go/src go1.24 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
57 license := *test.node.reconstructedLicenseStringscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#reconstructedLicenseString().()
58 assertscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/Equal().(t, test.result, license)
59 })
60 }
61 }
62
63 func TestLicensesAreCompatiblescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/TestLicensesAreCompatible().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
64 tests := []struct {
65 name string
66 nodes *nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#
67 result bool
68 }{
69 {"compatible (exact equal): GPL-3.0, GPL-3.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
70 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false),
71 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false)}, true},
72 {"compatible (diff case equal): Apache-2.0, APACHE-2.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
73 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-2.0", false),
74 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("APACHE-2.0", false)}, true},
75 {"compatible (same version with +): Apache-1.0+, Apache-1.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
76 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-1.0", true),
77 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-1.0", false)}, true},
78 {"compatible (later version with +): Apache-1.0+, Apache-2.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
79 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-1.0", true),
80 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-2.0", false)}, true},
81 {"compatible (second version with +): Apache-2.0, Apache-1.0+", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
82 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-2.0", false),
83 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-1.0", true)}, true},
84 {"compatible (later version with both +): Apache-1.0+, Apache-2.0+", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
85 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-1.0", true),
86 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-2.0", true)}, true},
87 {"compatible (same version with -or-later): GPL-2.0-or-later, GPL-2.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
88 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true),
89 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false)}, true},
90 {"compatible (same version with -or-later and -only): GPL-2.0-or-later, GPL-2.0-only", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
91 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true),
92 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false)}, true}, // TODO: Double check that -or-later and -only should be true for GT
93 {"compatible (later version with -or-later): GPL-2.0-or-later, GPL-3.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
94 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true),
95 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false)}, true},
96 {"incompatible (same version with -or-later exception): GPL-2.0, GPL-2.0-or-later WITH Bison-exception-2.2", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
97 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", true),
98 &nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#{
99 rolescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#role.: licenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNode.,
100 expscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#exp.: nil,
101 licscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#lic.: &licenseNodePartialscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#{
102 licensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#license.: "GPL-2.0", hasPlusscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#hasPlus.: true,
103 hasExceptionscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#hasException.: true, exceptionscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseNodePartial#exception.: "Bison-exception-2.2"},
104 refscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#ref.: nil,
105 }}, false},
106 {"incompatible (different versions using -only): GPL-3.0-only, GPL-2.0-only", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
107 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0-only", false),
108 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false)}, false},
109 {"incompatible (different versions with letter): LPPL-1.3c, LPPL-1.3a", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
110 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3c", false),
111 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3a", false)}, false},
112 {"incompatible (first > second): AGPL-3.0, AGPL-1.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
113 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("AGPL-3.0", false),
114 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("AGPL-1.0", false)}, false},
115 {"incompatible (second > first): MPL-1.0, MPL-2.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
116 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MPL-1.0", false),
117 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MPL-2.0", false)}, false},
118 {"incompatible (diff licenses): MIT, ISC", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
119 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false),
120 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("ISC", false)}, false},
121 {"not simple license: (MIT OR ISC), GPL-3.0", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
122 getParsedNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getParsedNode().("(MIT OR ISC)"),
123 getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false)}, false},
124 }
125
126 for _, test := range tests {
127 test := test
128 t.Runscip-go gomod github.com/golang/go/src go1.24 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
129 assertscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/Equal().(t, test.result, test.nodes.licensesAreCompatiblescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#licensesAreCompatible().())
130 })
131 }
132 }
133
134 func TestRangesAreCompatiblescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/TestRangesAreCompatible().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
135 tests := []struct {
136 name string
137 nodes *nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#
138 result bool
139 }{
140 {"compatible - both use -or-later", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
141 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-1.0-or-later", true),
142 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true)}, true},
143 {"compatible - both use +", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
144 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-1.0", true),
145 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-2.0", true)}, true},
146 {"not compatible", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
147 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-1.0-or-later", true),
148 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LGPL-3.0-or-later", true)}, false},
149 }
150
151 for _, test := range tests {
152 test := test
153 t.Runscip-go gomod github.com/golang/go/src go1.24 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
154 assertscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/Equal().(t, test.result, test.nodes.rangesAreCompatiblescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#rangesAreCompatible().())
155 })
156 }
157 }
158
159 func TestIdentifierInRangescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/TestIdentifierInRange().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
160 tests := []struct {
161 name string
162 nodes *nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#
163 result bool
164 }{
165 {"in or-later range (later)", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
166 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false),
167 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true)}, true},
168 {"in or-later range (same)", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
169 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false),
170 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true)}, true},
171 {"in + range (1.0+)", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
172 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-2.0", false),
173 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("Apache-1.0", true)}, true},
174 {"not in range", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
175 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-1.0", false),
176 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true)}, false},
177 {"different base license", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
178 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-1.0", false),
179 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LGPL-2.0-or-later", true)}, false},
180 }
181
182 for _, test := range tests {
183 test := test
184 t.Runscip-go gomod github.com/golang/go/src go1.24 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
185 assertscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/Equal().(t, test.result, test.nodes.identifierInRangescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#identifierInRange().())
186 })
187 }
188 }
189
190 func TestLicensesExactlyEqualscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/TestLicensesExactlyEqual().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
191 tests := []struct {
192 name string
193 nodes *nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#
194 result bool
195 }{
196 {"equal", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
197 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false),
198 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false)}, true},
199 {"not equal", &nodePairscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#{
200 firstNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#firstNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-1.0", false),
201 secondNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#secondNode.: getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false)}, false},
202 }
203
204 for _, test := range tests {
205 test := test
206 t.Runscip-go gomod github.com/golang/go/src go1.24 testing/T#Run().(test.name, func(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
207 assertscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.1 `github.com/stretchr/testify/assert`/Equal().(t, test.result, test.nodes.licensesExactlyEqualscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/nodePair#licensesExactlyEqual().())
208 })
209 }
210 }