github.com/verrazzano/verrazzano@v1.7.0/pkg/semver/semver_test.go (about) 1 // Copyright (c) 2020, 2023, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 package semver 5 6 import ( 7 "fmt" 8 "strconv" 9 "testing" 10 11 "github.com/stretchr/testify/assert" 12 ) 13 14 // TestValidSemver Tests the SemVersion parser for valid version strings 15 // GIVEN a set of valid version strings 16 // WHEN we try to create a SemVersion 17 // THEN no error is returned and a valid SemVersion object ref is returned 18 func TestValidSemver(t *testing.T) { 19 testVersions := [][]string{ 20 {"0", "0", "4"}, 21 {"1", "2", "3"}, 22 {"10", "20", "30"}, 23 {"1", "1", "2", "prerelease", "meta"}, 24 {"1", "1", "2", "", "meta"}, 25 {"1", "1", "2", "", "meta-valid"}, 26 {"1", "0", "0", "alpha", ""}, 27 {"1", "0", "0", "beta", ""}, 28 {"1", "0", "0", "alpha.beta", ""}, 29 {"1", "0", "0", "alpha-a.b-c-somethinglong", "build.1-aef.1-its-okay"}, 30 } 31 for _, verComponents := range testVersions { 32 verString := fmt.Sprintf("v%s.%s.%s", verComponents[0], verComponents[1], verComponents[2]) 33 hasPreRelease := len(verComponents) > 3 && len(verComponents[3]) > 0 34 if hasPreRelease { 35 verString = fmt.Sprintf("%s-%s", verString, verComponents[3]) 36 } 37 hasBuild := len(verComponents) > 4 && len(verComponents[4]) > 0 38 if hasBuild { 39 verString = fmt.Sprintf("%s+%s", verString, verComponents[4]) 40 } 41 42 version, err := NewSemVersion(verString) 43 assert.NoError(t, err) 44 assert.NotNil(t, version) 45 if !hasPreRelease && !hasBuild { 46 assert.Equal(t, fmt.Sprintf("%s.%s.%s", verComponents[0], verComponents[1], verComponents[2]), version.ToString()) 47 } 48 expectedMajor, _ := strconv.ParseInt(verComponents[0], 10, 64) 49 assert.Equal(t, expectedMajor, version.Major) 50 expectedMinor, _ := strconv.ParseInt(verComponents[1], 10, 64) 51 assert.Equal(t, expectedMinor, version.Minor) 52 expectedPatch, _ := strconv.ParseInt(verComponents[2], 10, 64) 53 assert.Equal(t, expectedPatch, version.Patch) 54 if hasPreRelease { 55 assert.Equal(t, verComponents[3], version.Prerelease) 56 } else { 57 assert.Equal(t, "", version.Prerelease) 58 } 59 if hasBuild { 60 assert.Equal(t, verComponents[4], version.Build) 61 } else { 62 assert.Equal(t, "", version.Build) 63 } 64 } 65 } 66 67 // TestInValidSemver Tests the SemVersion parser for valid version strings 68 // GIVEN a set of valid inversion strings 69 // WHEN we try to create a SemVersion 70 // THEN an error is returned and nil is returned for the SemVersion object ref 71 func TestInValidSemver(t *testing.T) { 72 invalidVersions := []string{ 73 "", 74 "foo", 75 "foo.1.0", 76 "1.foo.0", 77 "1.1.bar", 78 } 79 for _, verString := range invalidVersions { 80 v, err := NewSemVersion(verString) 81 assert.Error(t, err) 82 assert.Nil(t, v) 83 } 84 } 85 86 // TestCompareVersion Tests comparisons of version field values 87 // GIVEN a call to compareVersion 88 // WHEN v1 > v2, v1 < v2, and v1 == v2 89 // THEN -1 is returned when v1 > v2, 1 when > v1 < v2, and 0 when v1 == v2 90 func TestCompareVersion(t *testing.T) { 91 assert.Equal(t, -1, compareVersion(2, 1)) 92 assert.Equal(t, 1, compareVersion(1, 2)) 93 assert.Equal(t, 0, compareVersion(2, 2)) 94 } 95 96 // TestCompareTo Tests comparisons between SemVersion instances 97 // GIVEN a call to CompareTo with different SemVersion objects 98 // WHEN v1 > v2, v1 < v2, and v1 == v2 99 // THEN -1 is returned when v1 > v2, 1 when > v1 < v2, and 0 when v1 == v2 100 func TestCompareTo(t *testing.T) { 101 102 v010, _ := NewSemVersion("v0.1.0") 103 vn010, _ := NewSemVersion("0.1.0") 104 v010_2, _ := NewSemVersion("v0.1.0") 105 v011, _ := NewSemVersion("v0.1.1") 106 107 v020, _ := NewSemVersion("v0.2.0") 108 v100, _ := NewSemVersion("v1.0.0") 109 110 assert.Equal(t, 0, v010.CompareTo(vn010)) 111 assert.Equal(t, 0, v010.CompareTo(v010_2)) 112 assert.Equal(t, -1, v010.CompareTo(v011)) 113 assert.Equal(t, -1, v010.CompareTo(v020)) 114 assert.Equal(t, 1, v020.CompareTo(v010)) 115 assert.Equal(t, 1, v020.CompareTo(v011)) 116 assert.Equal(t, -1, v020.CompareTo(v100)) 117 assert.Equal(t, 1, v100.CompareTo(v020)) 118 119 v0_0_9, _ := NewSemVersion("v0.0.9") 120 v0_0_10, _ := NewSemVersion("v0.0.10") 121 assert.Equal(t, 1, v0_0_10.CompareTo(v0_0_9)) 122 123 v010deva, _ := NewSemVersion("v0.1.0-dev+aaaaaaaa") 124 v010deva2, _ := NewSemVersion("v0.1.0-dev+aaaaaaaa") 125 v010devb, _ := NewSemVersion("v0.1.0-dev+bbbbbbbb") 126 v010proda, _ := NewSemVersion("v0.1.0-prod+aaaaaaaa") 127 v020deva, _ := NewSemVersion("v0.2.0-dev+aaaaaaaa") 128 v020devb, _ := NewSemVersion("v0.2.0-dev+bbbbbbbb") 129 130 assert.Equal(t, 0, v010deva.CompareTo(v010deva2)) 131 assert.Equal(t, 1, v010deva.CompareTo(v010devb)) 132 assert.Equal(t, 1, v010deva.CompareTo(v010proda)) 133 assert.Equal(t, 1, v010deva.CompareTo(v010)) 134 assert.Equal(t, -1, v010deva.CompareTo(v020deva)) 135 assert.Equal(t, -1, v010deva.CompareTo(v020devb)) 136 137 V100, err := NewSemVersion("V1.0.0") 138 assert.NoError(t, err) 139 assert.Equal(t, 0, V100.CompareTo(v100)) 140 } 141 142 // TestCompareToPrereleaseInts Tests comparisons between SemVersion instances 143 // GIVEN a call to CompareTo with different SemVersion objects 144 // WHEN v1 > v2, v1 < v2, and v1 == v2 145 // THEN -1 is returned when v1 > v2, 1 when > v1 < v2, and 0 when v1 == v2 146 func TestCompareToPrereleaseInts(t *testing.T) { 147 148 v010, _ := NewSemVersion("v0.1.0") 149 v010_1, _ := NewSemVersion("0.1.0-1") 150 v010_2, _ := NewSemVersion("v0.1.0-2") 151 v010_0, _ := NewSemVersion("v0.1.0-0") 152 v011, _ := NewSemVersion("v0.1.1") 153 154 v010Aaa, _ := NewSemVersion("v0.1.0-aaa") 155 156 result, err := v010.CompareToPrereleaseInts(v010_1) 157 assert.Equal(t, -1, result) 158 assert.NoError(t, err) 159 160 result, err = v010.CompareToPrereleaseInts(v010_0) 161 assert.Equal(t, 0, result) 162 assert.NoError(t, err) 163 164 result, err = v010_2.CompareToPrereleaseInts(v010_1) 165 assert.Equal(t, 1, result) 166 assert.NoError(t, err) 167 168 result, err = v010_1.CompareToPrereleaseInts(v011) 169 assert.Equal(t, -1, result) 170 assert.NoError(t, err) 171 172 _, err = v010.CompareToPrereleaseInts(v010Aaa) 173 assert.Error(t, err) 174 } 175 176 // TestIsEqualTo Tests IsEqualTo for various combinations of SemVersion objects 177 // GIVEN a call to IsEqualTo with different SemVersion objects 178 // WHEN v > arg, v < arg, and v == arg 179 // THEN True v == arg, false otherwise 180 func TestIsEqualTo(t *testing.T) { 181 v010, _ := NewSemVersion("v0.1.0") 182 v010_2, _ := NewSemVersion("v0.1.0") 183 v020, _ := NewSemVersion("v0.2.0") 184 v011, _ := NewSemVersion("v0.1.1") 185 v100, _ := NewSemVersion("v1.0.0") 186 187 assert.True(t, v010.IsEqualTo(v010)) 188 assert.True(t, v010.IsEqualTo(v010_2)) 189 assert.False(t, v010.IsEqualTo(v020)) 190 assert.False(t, v010.IsEqualTo(v011)) 191 assert.False(t, v010.IsEqualTo(v100)) 192 193 assert.False(t, v020.IsEqualTo(v010)) 194 assert.False(t, v020.IsEqualTo(v010_2)) 195 assert.True(t, v020.IsEqualTo(v020)) 196 assert.False(t, v020.IsEqualTo(v011)) 197 assert.False(t, v020.IsEqualTo(v100)) 198 199 assert.False(t, v011.IsEqualTo(v010)) 200 assert.False(t, v011.IsEqualTo(v010_2)) 201 assert.False(t, v011.IsEqualTo(v020)) 202 assert.True(t, v011.IsEqualTo(v011)) 203 assert.False(t, v011.IsEqualTo(v100)) 204 205 assert.False(t, v100.IsEqualTo(v010)) 206 assert.False(t, v100.IsEqualTo(v010_2)) 207 assert.False(t, v100.IsEqualTo(v020)) 208 assert.False(t, v100.IsEqualTo(v011)) 209 assert.True(t, v100.IsEqualTo(v100)) 210 211 v009, _ := NewSemVersion("v0.0.9") 212 v009_2, _ := NewSemVersion("v0.0.9") 213 v0010, _ := NewSemVersion("v0.0.10") 214 assert.True(t, v009.IsEqualTo(v009_2)) 215 assert.False(t, v009.IsEqualTo(v0010)) 216 } 217 218 // TestIsLessThan Tests IsLessThan for various combinations of SemVersion objects 219 // GIVEN a call to IsLessThan with different SemVersion objects 220 // WHEN v > arg, v < arg, and v == arg 221 // THEN True v < arg, false otherwise 222 func TestIsLessThan(t *testing.T) { 223 v010, _ := NewSemVersion("v0.1.0") 224 v010_2, _ := NewSemVersion("v0.1.0") 225 v020, _ := NewSemVersion("v0.2.0") 226 v011, _ := NewSemVersion("v0.1.1") 227 v100, _ := NewSemVersion("v1.0.0") 228 v200, _ := NewSemVersion("v2.0.0") 229 230 assert.False(t, v010.IsLessThan(v010)) 231 assert.False(t, v010.IsLessThan(v010_2)) 232 assert.True(t, v010.IsLessThan(v020)) 233 assert.True(t, v010.IsLessThan(v011)) 234 assert.True(t, v010.IsLessThan(v100)) 235 236 assert.False(t, v020.IsLessThan(v010)) 237 assert.False(t, v020.IsLessThan(v010_2)) 238 assert.False(t, v020.IsLessThan(v020)) 239 assert.False(t, v020.IsLessThan(v011)) 240 assert.True(t, v020.IsLessThan(v100)) 241 242 assert.False(t, v011.IsLessThan(v010)) 243 assert.False(t, v011.IsLessThan(v010_2)) 244 assert.True(t, v011.IsLessThan(v020)) 245 assert.False(t, v011.IsLessThan(v011)) 246 assert.True(t, v011.IsLessThan(v100)) 247 248 assert.False(t, v100.IsLessThan(v010)) 249 assert.False(t, v100.IsLessThan(v010_2)) 250 assert.False(t, v100.IsLessThan(v020)) 251 assert.False(t, v100.IsLessThan(v011)) 252 assert.False(t, v100.IsLessThan(v100)) 253 assert.True(t, v100.IsLessThan(v200)) 254 255 v009, _ := NewSemVersion("v0.0.9") 256 v009_2, _ := NewSemVersion("v0.0.9") 257 v0010, _ := NewSemVersion("v0.0.10") 258 assert.False(t, v009.IsLessThan(v009_2)) 259 assert.True(t, v009.IsLessThan(v0010)) 260 assert.False(t, v0010.IsLessThan(v009)) 261 } 262 263 // TestIsGreatherThan Tests IsGreatherThan for various combinations of SemVersion objects 264 // GIVEN a call to IsGreatherThan with different SemVersion objects 265 // WHEN v > arg, v < arg, and v == arg 266 // THEN True v > arg, false otherwise 267 func TestIsGreatherThan(t *testing.T) { 268 v010, _ := NewSemVersion("v0.1.0") 269 v010_2, _ := NewSemVersion("v0.1.0") 270 v020, _ := NewSemVersion("v0.2.0") 271 v011, _ := NewSemVersion("v0.1.1") 272 v100, _ := NewSemVersion("v1.0.0") 273 v200, _ := NewSemVersion("v2.0.0") 274 275 assert.False(t, v010.IsGreatherThan(v010)) 276 assert.False(t, v010.IsGreatherThan(v010_2)) 277 assert.False(t, v010.IsGreatherThan(v020)) 278 assert.False(t, v010.IsGreatherThan(v011)) 279 assert.False(t, v010.IsGreatherThan(v100)) 280 281 assert.True(t, v020.IsGreatherThan(v010)) 282 assert.True(t, v020.IsGreatherThan(v010_2)) 283 assert.False(t, v020.IsGreatherThan(v020)) 284 assert.True(t, v020.IsGreatherThan(v011)) 285 assert.False(t, v020.IsGreatherThan(v100)) 286 287 assert.True(t, v011.IsGreatherThan(v010)) 288 assert.True(t, v011.IsGreatherThan(v010_2)) 289 assert.False(t, v011.IsGreatherThan(v020)) 290 assert.False(t, v011.IsGreatherThan(v011)) 291 assert.False(t, v011.IsGreatherThan(v100)) 292 293 assert.True(t, v100.IsGreatherThan(v010)) 294 assert.True(t, v100.IsGreatherThan(v010_2)) 295 assert.True(t, v100.IsGreatherThan(v020)) 296 assert.True(t, v100.IsGreatherThan(v011)) 297 assert.False(t, v100.IsGreatherThan(v100)) 298 assert.False(t, v100.IsGreatherThan(v200)) 299 300 v009, _ := NewSemVersion("v0.0.9") 301 v009_2, _ := NewSemVersion("v0.0.9") 302 v0010, _ := NewSemVersion("v0.0.10") 303 assert.False(t, v009.IsGreatherThan(v009_2)) 304 assert.False(t, v009.IsGreatherThan(v0010)) 305 assert.True(t, v0010.IsGreatherThan(v009)) 306 307 v010_0, _ := NewSemVersion("v0.1.0-0") 308 v010_1, _ := NewSemVersion("v0.1.0-1") 309 v011_1, _ := NewSemVersion("v0.1.1-1") 310 assert.True(t, v010_1.IsGreatherThan(v010)) 311 assert.True(t, v010_1.IsGreatherThan(v010_0)) 312 assert.True(t, v010_0.IsGreatherThan(v010)) 313 assert.True(t, v011.IsGreatherThan(v010_1)) 314 assert.True(t, v011_1.IsGreatherThan(v010_1)) 315 316 } 317 318 // TestToString Tests ToString function which converts a Semver object to its string representation 319 // GIVEN a call to ToString with different valid SemVersion objects 320 // WHEN the ToString returns the correct string 321 // THEN return Equal 322 func TestToString(t *testing.T) { 323 v010, _ := NewSemVersion("v0.1.0") 324 v010dev, _ := NewSemVersion("v0.1.0-dev") 325 v010a, _ := NewSemVersion("v0.1.0+aaaaaaaa") 326 v010deva, _ := NewSemVersion("v0.1.0-dev+aaaaaaaa") 327 v010devaa, _ := NewSemVersion("v0.1.0-dev+aaaaaaaa-aaaaaaaa") 328 v010aa, _ := NewSemVersion("v0.1.0+aaaaaaaa-aaaaaaaa") 329 330 assert.Equal(t, "0.1.0", v010.ToString()) 331 assert.Equal(t, "0.1.0-dev", v010dev.ToString()) 332 assert.Equal(t, "0.1.0+aaaaaaaa", v010a.ToString()) 333 assert.Equal(t, "0.1.0-dev+aaaaaaaa", v010deva.ToString()) 334 assert.Equal(t, "0.1.0-dev+aaaaaaaa-aaaaaaaa", v010devaa.ToString()) 335 assert.Equal(t, "0.1.0+aaaaaaaa-aaaaaaaa", v010aa.ToString()) 336 } 337 338 // TestCompareVersionSubstring Tests CompareVersionSubstring function which converts a Semver object to its string representation 339 // GIVEN a call to CompareVersionSubstring with two strings 340 // WHEN the Semver field is equivalent to the passed in string 341 // THEN return Equal 342 func TestCompareVersionSubstring(t *testing.T) { 343 v010, _ := NewSemVersion("v0.1.0") 344 v010dev, _ := NewSemVersion("v0.1.0-dev") 345 v010a, _ := NewSemVersion("v0.1.0+aaaaaaaa") 346 v010deva, _ := NewSemVersion("v0.1.0-dev+aaaaaaaa") 347 v010devaa, _ := NewSemVersion("v0.1.0-dev+aaaaaaaa-aaaaaaaa") 348 349 assert.Equal(t, 0, compareVersionSubstring(v010.Prerelease, "")) 350 assert.Equal(t, 0, compareVersionSubstring(v010.Build, "")) 351 assert.Equal(t, 1, compareVersionSubstring(v010dev.Prerelease, "")) 352 assert.Equal(t, 0, compareVersionSubstring(v010dev.Prerelease, "dev")) 353 assert.Equal(t, 0, compareVersionSubstring(v010dev.Build, "")) 354 assert.Equal(t, 0, compareVersionSubstring(v010a.Prerelease, "")) 355 assert.Equal(t, 1, compareVersionSubstring(v010a.Prerelease, "aaaaaaaa")) 356 assert.Equal(t, 0, compareVersionSubstring(v010a.Build, "aaaaaaaa")) 357 assert.Equal(t, 0, compareVersionSubstring(v010deva.Prerelease, "dev")) 358 assert.Equal(t, 1, compareVersionSubstring(v010deva.Build, "")) 359 assert.Equal(t, 0, compareVersionSubstring(v010deva.Build, "aaaaaaaa")) 360 assert.Equal(t, 1, compareVersionSubstring(v010devaa.Build, "aaaaaaaa")) 361 assert.Equal(t, 1, compareVersionSubstring(v010devaa.Prerelease, "aaaaaaaa")) 362 assert.Equal(t, 0, compareVersionSubstring(v010devaa.Build, "aaaaaaaa-aaaaaaaa")) 363 } 364 365 // TestMissingPrefix Tests if a SemVersion is the same if the prefix v is missing 366 // GIVEN a call to IsEqualTo with SemVersion objects where the only difference is the prefix 367 // WHEN the comparison functions are called 368 // THEN the correct result is returned 369 func TestMissingPrefix(t *testing.T) { 370 v010v, _ := NewSemVersion("v0.1.0") 371 v010, _ := NewSemVersion("0.1.0") 372 v011, _ := NewSemVersion("v0.1.1") 373 v011v, _ := NewSemVersion("0.1.1") 374 375 assert.True(t, v010.IsEqualTo(v010v)) 376 assert.True(t, v010.IsLessThan(v011v)) 377 assert.True(t, v010.IsLessThan(v011)) 378 assert.True(t, v010v.IsLessThan(v011v)) 379 assert.True(t, v010v.IsLessThan(v011)) 380 assert.True(t, v011.IsGreatherThan(v010v)) 381 assert.True(t, v011.IsGreatherThan(v010)) 382 assert.True(t, v011v.IsGreatherThan(v010)) 383 assert.True(t, v011v.IsGreatherThan(v010)) 384 } 385 386 // TestIsGreatherThanOrEqualTo Tests IsGreatherThanOrEqualTo for various combinations of SemVersion objects 387 // GIVEN a call to IsGreatherThanOrEqualTo with different SemVersion objects 388 // WHEN v > arg, v < arg, and v == arg 389 // THEN True v >= arg, false otherwise 390 func TestIsGreatherThanOrEqualTo(t *testing.T) { 391 v010, _ := NewSemVersion("v0.1.0") 392 v010_2, _ := NewSemVersion("v0.1.0") 393 v020, _ := NewSemVersion("v0.2.0") 394 v011, _ := NewSemVersion("v0.1.1") 395 v100, _ := NewSemVersion("v1.0.0") 396 v200, _ := NewSemVersion("v2.0.0") 397 398 assert.True(t, v010.IsGreaterThanOrEqualTo(v010)) 399 assert.True(t, v010.IsGreaterThanOrEqualTo(v010_2)) 400 assert.False(t, v010.IsGreaterThanOrEqualTo(v020)) 401 assert.False(t, v010.IsGreaterThanOrEqualTo(v011)) 402 assert.False(t, v010.IsGreaterThanOrEqualTo(v100)) 403 404 assert.True(t, v020.IsGreaterThanOrEqualTo(v010)) 405 assert.True(t, v020.IsGreaterThanOrEqualTo(v010_2)) 406 assert.True(t, v020.IsGreaterThanOrEqualTo(v020)) 407 assert.True(t, v020.IsGreaterThanOrEqualTo(v011)) 408 assert.False(t, v020.IsGreaterThanOrEqualTo(v100)) 409 410 assert.True(t, v011.IsGreaterThanOrEqualTo(v010)) 411 assert.True(t, v011.IsGreaterThanOrEqualTo(v010_2)) 412 assert.False(t, v011.IsGreaterThanOrEqualTo(v020)) 413 assert.True(t, v011.IsGreaterThanOrEqualTo(v011)) 414 assert.False(t, v011.IsGreaterThanOrEqualTo(v100)) 415 416 assert.True(t, v100.IsGreaterThanOrEqualTo(v010)) 417 assert.True(t, v100.IsGreaterThanOrEqualTo(v010_2)) 418 assert.True(t, v100.IsGreaterThanOrEqualTo(v020)) 419 assert.True(t, v100.IsGreaterThanOrEqualTo(v011)) 420 assert.True(t, v100.IsGreaterThanOrEqualTo(v100)) 421 assert.False(t, v100.IsGreaterThanOrEqualTo(v200)) 422 423 v009, _ := NewSemVersion("v0.0.9") 424 v009_2, _ := NewSemVersion("v0.0.9") 425 v0010, _ := NewSemVersion("v0.0.10") 426 assert.True(t, v009.IsGreaterThanOrEqualTo(v009_2)) 427 assert.False(t, v009.IsGreaterThanOrEqualTo(v0010)) 428 assert.True(t, v0010.IsGreaterThanOrEqualTo(v009)) 429 assert.True(t, v009.IsGreaterThanOrEqualTo(v009)) 430 } 431 432 // TestIsEqualToOrPatchVersionOf Tests IsEqualToOrPatchVersionOf for various combinations of SemVersion objects 433 // GIVEN a call to IsEqualToOrPatchVersionOf with different SemVersion objects 434 // WHEN v == arg, v != arg, v as patch version of arg and v as not a patch version of arg 435 // THEN True v == arg or v is a patch version of arg, false otherwise 436 func TestIsEqualToOrPatchVersionOf(t *testing.T) { 437 v01, err := NewSemVersion("v0.1.0") 438 assert.NoError(t, err) 439 v011, err := NewSemVersion("v0.1.1") 440 assert.NoError(t, err) 441 v02, err := NewSemVersion("v0.2.0") 442 assert.NoError(t, err) 443 v020, err := NewSemVersion("v0.2.0") 444 assert.NoError(t, err) 445 v021, err := NewSemVersion("v0.2.1") 446 assert.NoError(t, err) 447 448 assert.True(t, v01.IsEqualToOrPatchVersionOf(v01)) 449 assert.True(t, v011.IsEqualToOrPatchVersionOf(v01)) 450 assert.True(t, v011.IsEqualToOrPatchVersionOf(v011)) 451 assert.False(t, v01.IsEqualToOrPatchVersionOf(v02)) 452 assert.False(t, v02.IsEqualToOrPatchVersionOf(v011)) 453 454 assert.True(t, v02.IsEqualToOrPatchVersionOf(v02)) 455 assert.True(t, v020.IsEqualToOrPatchVersionOf(v02)) 456 assert.True(t, v020.IsEqualToOrPatchVersionOf(v020)) 457 assert.True(t, v021.IsEqualToOrPatchVersionOf(v02)) 458 assert.True(t, v021.IsEqualToOrPatchVersionOf(v021)) 459 assert.False(t, v021.IsEqualToOrPatchVersionOf(v011)) 460 }