github.com/immesys/bw2bc@v1.1.0/xeth/xeth_test.go (about) 1 package xeth 2 3 import "testing" 4 5 func TestIsAddress(t *testing.T) { 6 for _, invalid := range []string{ 7 "0x00", 8 "0xNN", 9 "0x00000000000000000000000000000000000000NN", 10 "0xAAar000000000000000000000000000000000000", 11 } { 12 if isAddress(invalid) { 13 t.Error("Expected", invalid, "to be invalid") 14 } 15 } 16 17 for _, valid := range []string{ 18 "0x0000000000000000000000000000000000000000", 19 "0xAABBbbCCccff9900000000000000000000000000", 20 "AABBbbCCccff9900000000000000000000000000", 21 } { 22 if !isAddress(valid) { 23 t.Error("Expected", valid, "to be valid") 24 } 25 } 26 }