gitlab.com/evatix-go/core@v1.3.55/cmd/main/versionCompareTest.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"gitlab.com/evatix-go/core/corecmp"
     7  	"gitlab.com/evatix-go/core/corecomparator"
     8  	"gitlab.com/evatix-go/core/coreversion"
     9  	"gitlab.com/evatix-go/core/enums/versionindexes"
    10  )
    11  
    12  func versionCompareTest(leftVersion, rightVersion string) corecomparator.Compare {
    13  	fmt.Println("left, right = ", leftVersion, rightVersion)
    14  	leftV := coreversion.New.Create(leftVersion)
    15  	rightV := coreversion.New.Create(rightVersion)
    16  
    17  	fmt.Println("   left, right = ", leftV, rightV)
    18  	r1 := leftV.Compare(rightV)
    19  	r2 := leftV.ComparisonValueIndexes(
    20  		rightV,
    21  		versionindexes.AllVersionIndexes...)
    22  	leftVersionValues := leftV.AllVersionValues()
    23  	rightVersionValues := rightV.AllVersionValues()
    24  
    25  	fmt.Println("   (r1) left, right = ", r1)
    26  	fmt.Println("   (r2) left, right = ", r2)
    27  	fmt.Println("   (Values) left, right = ", leftVersionValues, rightVersionValues)
    28  
    29  	r3 := corecmp.VersionSliceInteger(
    30  		leftVersionValues,
    31  		rightVersionValues)
    32  
    33  	fmt.Println("   (r3) left, right = ", r3)
    34  
    35  	return r1
    36  }