Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pr-created.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ jobs:
uses: kubescape/workflows/.github/workflows/incluster-comp-pr-created.yaml@main
with:
GO_VERSION: "1.19"
CGO_ENABLED: 0
secrets: inherit
34 changes: 34 additions & 0 deletions internal/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,37 @@ func TestValidator(t *testing.T) {
t.Fatalf("checkKernelVersion failed withh error %v", err)
}
}

func TestInt8ToStr(t *testing.T) {
// Test with valid input
input1 := []int8{72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0}
expected1 := "Hello World"
output1 := int8ToStr(input1)
if output1 != expected1 {
t.Errorf("int8ToStr(%v) = %v; want %v", input1, output1, expected1)
}

// Test with empty input
input2 := []int8{}
expected2 := ""
output2 := int8ToStr(input2)
if output2 != expected2 {
t.Errorf("int8ToStr(%v) = %v; want %v", input2, output2, expected2)
}

// Test with input containing only null byte
input3 := []int8{0}
expected3 := ""
output3 := int8ToStr(input3)
if output3 != expected3 {
t.Errorf("int8ToStr(%v) = %v; want %v", input3, output3, expected3)
}

// Test with input containing multiple null bytes
input4 := []int8{72, 101, 108, 108, 111, 0, 87, 111, 114, 108, 100, 0}
expected4 := "Hello"
output4 := int8ToStr(input4)
if output4 != expected4 {
t.Errorf("int8ToStr(%v) = %v; want %v", input4, output4, expected4)
}
}