package modhex import "testing" type test struct { hex string modhex string } func TestEncodeHexDecodeHex(t *testing.T) { var tests = []test{ { modhex: "dteffuje", hex: "2d344e83", }, { modhex: "hknhfjbrjnlnldnhcujvddbikngjrtgh", hex: "69b6481c8baba2b60e8f22179b58cd56", }, { modhex: "urtubjtnuihvntcreeeecvbregfjibtn", hex: "ecde18dbe76fbd0c33330f1c354871db", }, } for _, tc := range tests { modhex, err := EncodeHex(tc.hex) if err != nil { t.Errorf("EncodeHex Error: %s\n", err) } if modhex != tc.modhex { t.Errorf("EncodeHex Incorrect: Actual: %s; Expected: %s\n", modhex, tc.modhex) } hex, err := DecodeHex(tc.modhex) if err != nil { t.Errorf("DecodeHex Error: %s\n", err) } if hex != tc.hex { t.Errorf("DecodeHex Incorrect: Actual: %s; Expected: %s\n", hex, tc.hex) } } }