Passed
Push — main ( 7310eb...4f3fcd )
by Clive
03:28
created

utils.TestCenterString_WithEmptyString   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
package utils
2
3
import (
4
	"testing"
5
6
	"github.com/stretchr/testify/assert"
7
)
8
9
func TestCenterString_WithNormalString(t *testing.T) {
10
	result := CenterString("test", 10)
11
	assert.Equal(t, "   test   ", result)
12
}
13
14
func TestCenterString_WithEmptyString(t *testing.T) {
15
	result := CenterString("", 10)
16
	assert.Equal(t, "          ", result)
17
}
18
19
func TestCenterString_WithCenteredString(t *testing.T) {
20
	result := CenterString("   test   ", 10)
21
	assert.Equal(t, "   test   ", result)
22
}
23
24
func TestCenterString_WithLongString(t *testing.T) {
25
	result := CenterString("this is a long string", 10)
26
	assert.Equal(t, "this is a long string", result)
27
}
28
29
func TestCenterString_WithOddWidth(t *testing.T) {
30
	result := CenterString("test", 11)
31
	assert.Equal(t, "   test    ", result)
32
}
33