From 421a16553e37b0c79bbd50f63f3ef8d50d263987 Mon Sep 17 00:00:00 2001 From: Raja Sami Date: Thu, 18 May 2017 20:32:48 +0500 Subject: [PATCH] Increase the Coverage of pkg/platform Signed-off-by: Raja Sami Upstream-commit: bdc87676bfee0f9a26fe12323dbe6875af783645 Component: engine --- .../engine/pkg/platform/utsname_int8_test.go | 16 ++++++++++++++++ .../engine/pkg/platform/utsname_uint8_test.go | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 components/engine/pkg/platform/utsname_int8_test.go create mode 100644 components/engine/pkg/platform/utsname_uint8_test.go diff --git a/components/engine/pkg/platform/utsname_int8_test.go b/components/engine/pkg/platform/utsname_int8_test.go new file mode 100644 index 0000000000..9dada23591 --- /dev/null +++ b/components/engine/pkg/platform/utsname_int8_test.go @@ -0,0 +1,16 @@ +// +build linux,386 linux,amd64 linux,arm64 + +package platform + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestCharToString(t *testing.T) { + machineInBytes := [65]int8{120, 56, 54, 95, 54, 52} + machineInString := charsToString(machineInBytes) + assert.NotNil(t, machineInString, "Unable to convert char into string.") + assert.Equal(t, string("x86_64"), machineInString, "Parsed machine code not equal.") +} diff --git a/components/engine/pkg/platform/utsname_uint8_test.go b/components/engine/pkg/platform/utsname_uint8_test.go new file mode 100644 index 0000000000..444b83bdbe --- /dev/null +++ b/components/engine/pkg/platform/utsname_uint8_test.go @@ -0,0 +1,16 @@ +// +build linux,arm linux,ppc64 linux,ppc64le s390x + +package platform + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestTestCharToString(t *testing.T) { + machineInBytes := [65]uint8{120, 56, 54, 95, 54, 52} + machineInString := charsToString(machineInBytes) + assert.NotNil(t, machineInString, "Unable to convert char into string.") + assert.Equal(t, string("x86_64"), machineInString, "Parsed machine code not equal.") +}