1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/pkg/piperutils/maps_test.go
Sven Merk b3f37650a2
SBOM creation for Mend (#3934)
* Fix docs and format

* Assessment format added

* Added sample file

* Added parsing

* Added packageurl implementation

* Slight refinement

* Refactored assessment options

* Adapted sample file

* First attempt of ws sbom gen

* Reworked SBOM generation

* Fix test code

* Add assessment handling

* Update dependencies

* Added golden test

* Small fix

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-08-09 13:56:01 +02:00

32 lines
853 B
Go

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"))
}