1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00
sap-jenkins-library/pkg/piperutils/maps_test.go

32 lines
853 B
Go
Raw Normal View History

package piperutils
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestKeys(t *testing.T) {
intStringMap := map[int]string{1: "eins", 2: "zwei", 3: "drei", 4: "vier"}
intList := Keys(intStringMap)
assert.Equal(t, 4, len(intList))
assert.Equal(t, true, ContainsInt(intList, 1))
assert.Equal(t, true, ContainsInt(intList, 2))
assert.Equal(t, true, ContainsInt(intList, 3))
assert.Equal(t, true, ContainsInt(intList, 4))
}
func TestValues(t *testing.T) {
intStringMap := map[int]string{1: "eins", 2: "zwei", 3: "drei", 4: "vier"}
intList := Values(intStringMap)
assert.Equal(t, 4, len(intList))
assert.Equal(t, true, ContainsString(intList, "eins"))
assert.Equal(t, true, ContainsString(intList, "zwei"))
assert.Equal(t, true, ContainsString(intList, "drei"))
assert.Equal(t, true, ContainsString(intList, "vier"))
}