organizing and refactoring
This commit is contained in:
parent
13b5474cd8
commit
6f159d4728
20 changed files with 832 additions and 488 deletions
31
agent/utils/utils_test.go
Normal file
31
agent/utils/utils_test.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestByteCountSI(t *testing.T) {
|
||||
var bytes uint64 = 1048576
|
||||
mb := ByteCountSI(bytes)
|
||||
if mb != "1.0 MB" {
|
||||
t.Errorf("Expected 1.0 MB, got %s", mb)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveWinNewLines(t *testing.T) {
|
||||
result := RemoveWinNewLines("test\r\n")
|
||||
if result != "test\n" {
|
||||
t.Fatalf("Expected testing\\n, got %s", result)
|
||||
}
|
||||
|
||||
t.Logf("Result: %s", result)
|
||||
}
|
||||
|
||||
func TestStripAll(t *testing.T) {
|
||||
result := StripAll(" test\r\n ")
|
||||
if result != "test" {
|
||||
t.Fatalf("Expecte test, got %s", result)
|
||||
}
|
||||
|
||||
t.Log("Test result expected")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue