aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth_test.go
blob: e649d20ef16ccd3db581347f4b3f51b8b613f971 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package xeth

import "testing"

func TestIsAddress(t *testing.T) {
    for _, invalid := range []string{
        "0x00",
        "0xNN",
        "0x00000000000000000000000000000000000000NN",
        "0xAAar000000000000000000000000000000000000",
    } {
        if isAddress(invalid) {
            t.Error("Expected", invalid, "to be invalid")
        }
    }

    for _, valid := range []string{
        "0x0000000000000000000000000000000000000000",
        "0xAABBbbCCccff9900000000000000000000000000",
        "AABBbbCCccff9900000000000000000000000000",
    } {
        if !isAddress(valid) {
            t.Error("Expected", valid, "to be valid")
        }
    }
}