github.com/bigkraig/terraform@v0.6.4-0.20151219155159-c90d1b074e31/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  }