mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
formatting, cleanups
This commit is contained in:
parent
a5040ecc03
commit
5602348695
@ -1,6 +1,8 @@
|
|||||||
package hashcode
|
package hashcode
|
||||||
|
|
||||||
import "hash/crc32"
|
import (
|
||||||
|
"hash/crc32"
|
||||||
|
)
|
||||||
|
|
||||||
// String hashes a string to a unique hashcode.
|
// String hashes a string to a unique hashcode.
|
||||||
//
|
//
|
||||||
@ -12,5 +14,6 @@ func String(s string) int {
|
|||||||
if v < 0 {
|
if v < 0 {
|
||||||
return -v
|
return -v
|
||||||
}
|
}
|
||||||
|
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package hashcode
|
package hashcode
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
func TestString(t *testing.T) {
|
func TestString(t *testing.T) {
|
||||||
v := "hello, world"
|
v := "hello, world"
|
||||||
@ -16,8 +18,7 @@ func TestString(t *testing.T) {
|
|||||||
func TestString_positiveIndex(t *testing.T) {
|
func TestString_positiveIndex(t *testing.T) {
|
||||||
ips := []string{"192.168.1.3", "192.168.1.5"}
|
ips := []string{"192.168.1.3", "192.168.1.5"}
|
||||||
for _, ip := range ips {
|
for _, ip := range ips {
|
||||||
index := String(ip)
|
if index := String(ip); index < 0 {
|
||||||
if index < 0 {
|
|
||||||
t.Fatalf("Bad Index %#v for ip %s", index, ip)
|
t.Fatalf("Bad Index %#v for ip %s", index, ip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user