-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from free5gc/fix/allow-empty-sd
fix: Allow empty sd in Slice snssai
- Loading branch information
Showing
5 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package util | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-playground/assert/v2" | ||
|
||
"github.com/free5gc/openapi/models" | ||
) | ||
|
||
func TestSnssaiModelsToHex(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
snssai models.Snssai | ||
expectString string | ||
}{ | ||
{ | ||
name: "01010202", | ||
snssai: models.Snssai{ | ||
Sst: 1, | ||
Sd: "010203", | ||
}, | ||
expectString: "01010203", | ||
}, | ||
{ | ||
name: "Empty SD", | ||
snssai: models.Snssai{ | ||
Sst: 1, | ||
}, | ||
expectString: "01", | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
output := SnssaiModelsToHex(tt.snssai) | ||
assert.Equal(t, tt.expectString, output) | ||
}) | ||
} | ||
} |