Debian Codegraph @

spdxexp/compare_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 TestCompareGTscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/TestCompareGT().(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 first *nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#
13 second *nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#
14 result bool
15 }{
16 {"expect greater than: GPL-3.0 > GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), true},
17 {"expect greater than: GPL-3.0-only > GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0-only", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), true},
18 {"expect greater than: LPPL-1.3a > LPPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3a", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.0", false), true},
19 {"expect greater than: LPPL-1.3c > LPPL-1.3a", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3c", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3a", false), true},
20 {"expect greater than: AGPL-3.0 > AGPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("AGPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("AGPL-1.0", false), true},
21 {"expect equal: GPL-2.0-or-later > GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), false},
22 {"expect equal: GPL-2.0-or-later > GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), false},
23 {"expect equal: GPL-2.0-only > GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), false},
24 {"expect equal: GPL-3.0 > GPL-3.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), false},
25 {"expect equal: MIT > MIT", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), false},
26 {"expect less than: MPL-1.0 > MPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MPL-1.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MPL-2.0", false), false},
27 {"incompatible: MIT > ISC", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("ISC", false), false},
28 {"incompatible: MIT > GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), false},
29 {"incompatible: OSL-1.0 > OPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("OSL-1.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("OPL-1.0", false), false},
30 {"not simple license: (MIT OR ISC) > GPL-3.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("(MIT OR ISC)", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), false}, // TODO: should it raise error?
31 }
32
33 for _, test := range tests {
34 test := test
35 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#) {
36 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, compareGTscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/compareGT().(test.first, test.second))
37 })
38 }
39 }
40
41 func TestCompareEQscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/TestCompareEQ().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
42 tests := []struct {
43 name string
44 first *nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#
45 second *nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#
46 result bool
47 }{
48 {"expect greater than: GPL-3.0 == GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), false},
49 {"expect greater than: GPL-3.0-only == GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0-only", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), false},
50 {"expect greater than: LPPL-1.3a == LPPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3a", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.0", false), false},
51 {"expect greater than: LPPL-1.3c == LPPL-1.3a", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3c", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3a", false), false},
52 {"expect greater than: AGPL-3.0 == AGPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("AGPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("AGPL-1.0", false), false},
53 {"expect equal: GPL-2.0-or-later > GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), true},
54 {"expect equal: GPL-2.0-or-later > GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), true},
55 {"expect equal: GPL-2.0-only == GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), true},
56 {"expect equal: GPL-3.0 == GPL-3.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), true},
57 {"expect equal: MIT == MIT", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), true},
58 {"expect less than: MPL-1.0 == MPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MPL-1.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MPL-2.0", false), false},
59 {"incompatible: MIT == ISC", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("ISC", false), false},
60 {"incompatible: MIT == GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), false},
61 {"incompatible: OSL-1.0 == OPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("OSL-1.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("OPL-1.0", false), false},
62 {"not simple license: (MIT OR ISC) == GPL-3.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("(MIT OR ISC)", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), false}, // TODO: should it raise error?
63 }
64
65 for _, test := range tests {
66 test := test
67 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#) {
68 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, compareEQscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/compareEQ().(test.first, test.second))
69 })
70 }
71 }
72
73 func TestCompareLTscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/TestCompareLT().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
74 tests := []struct {
75 name string
76 first *nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#
77 second *nodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/node#
78 result bool
79 }{
80 {"expect greater than: GPL-3.0 < GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), false},
81 {"expect greater than: GPL-3.0-only < GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0-only", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), false},
82 {"expect greater than: LPPL-1.3a < LPPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3a", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.0", false), false},
83 {"expect greater than: LPPL-1.3c < LPPL-1.3a", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3c", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("LPPL-1.3a", false), false},
84 {"expect greater than: AGPL-3.0 < AGPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("AGPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("AGPL-1.0", false), false},
85 {"expect greater than: GPL-2.0-or-later < GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), false},
86 {"expect greater than: GPL-2.0-or-later == GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-or-later", true), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), false},
87 {"expect equal: GPL-2.0-only < GPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0", false), false},
88 {"expect equal: GPL-3.0 < GPL-3.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), false},
89 {"expect equal: MIT < MIT", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), false},
90 {"expect less than: MPL-1.0 < MPL-2.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MPL-1.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MPL-2.0", false), true},
91 {"incompatible: MIT < ISC", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("ISC", false), false},
92 {"incompatible: MIT < GPL-2.0-only", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("MIT", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-2.0-only", false), false},
93 {"incompatible: OSL-1.0 < OPL-1.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("OSL-1.0", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("OPL-1.0", false), false},
94 {"not simple license: (MIT OR ISC) < GPL-3.0", getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("(MIT OR ISC)", false), getLicenseNodescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseNode().("GPL-3.0", false), false}, // TODO: should it raise error?
95 }
96
97 for _, test := range tests {
98 test := test
99 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#) {
100 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, compareLTscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/compareLT().(test.first, test.second))
101 })
102 }
103 }