2023-05-02 11:33:06 -04:00
|
|
|
// Copyright IBM Corp. 2014, 2026
|
2023-08-10 18:43:27 -04:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-05-02 11:33:06 -04:00
|
|
|
|
2016-09-03 18:45:24 -04:00
|
|
|
package shared
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestIpFormatting_Ipv4(t *testing.T) {
|
|
|
|
|
formatted := IpFormat("127.0.0.1")
|
|
|
|
|
if formatted != "127.0.0.1" {
|
|
|
|
|
t.Fatal("expected", "127.0.0.1", "got", formatted)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIpFormatting_Hostname(t *testing.T) {
|
|
|
|
|
formatted := IpFormat("example.com")
|
|
|
|
|
if formatted != "example.com" {
|
|
|
|
|
t.Fatal("expected", "example.com", "got", formatted)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestIpFormatting_Ipv6(t *testing.T) {
|
|
|
|
|
formatted := IpFormat("::1")
|
|
|
|
|
if formatted != "[::1]" {
|
|
|
|
|
t.Fatal("expected", "[::1]", "got", formatted)
|
|
|
|
|
}
|
|
|
|
|
}
|