github.com/acm1/terraform@v0.6.2-0.20150729164239-1f314444f45c/helper/hashcode/hashcode_test.go (about)

     1  package hashcode
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestString(t *testing.T) {
     8  	v := "hello, world"
     9  	expected := String(v)
    10  	for i := 0; i < 100; i++ {
    11  		actual := String(v)
    12  		if actual != expected {
    13  			t.Fatalf("bad: %#v\n\t%#v", actual, expected)
    14  		}
    15  	}
    16  }
    17  
    18  func TestString_positiveIndex(t *testing.T) {
    19  	ips := []string{"192.168.1.3", "192.168.1.5"}
    20  	for _, ip := range ips {
    21  		if index := String(ip); index < 0 {
    22  			t.Fatalf("Bad Index %#v for ip %s", index, ip)
    23  		}
    24  	}
    25  }