[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] version: Add ParseVersion and a Version struct




On 10/11/18 7:58 PM, W. Trevor King wrote:
> Make it easier to convert version integers to the more human-readable
> major.minor.release format.
> ---
>  connect.go      |  8 ++++++++
>  version.go      | 52 ++++++++++++++++++++++++++++++++++++++++++++++
>  version_test.go | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 124 insertions(+)
>  create mode 100644 version.go
>  create mode 100644 version_test.go
> 

Well I'm far from the expert here, but since this has been "out there"
for a while, I'll given it a go.

[...]

> diff --git a/version_test.go b/version_test.go

[...]

> +func TestParseVersion(t *testing.T) {
> +	for _, testCase := range []struct{
> +		input    uint32
> +		expected *Version
> +	}{
> +		{
> +			input: 3009000,
> +			expected: &Version{Major: 3, Minor: 9},

NIT: Should the above have the "Release: 0" if nothing more than to
prove your algorithm?  I can add it or leave it as is.

Reviewed-by: John Ferlan <jferlan redhat com>

John

[let me know either way on the above and I can push this]

[...]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]