mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-28 13:52:55 +02:00
Merge pull request #6149 from bhandras/graph_import_rpc
lnd: add `devrpc` sub server and `devrpc.ImportGraph` to import graph dumps
This commit is contained in:
@@ -22,44 +22,6 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
)
|
||||
|
||||
func TestParseHexColor(t *testing.T) {
|
||||
var colorTestCases = []struct {
|
||||
test string
|
||||
valid bool // If valid format
|
||||
R byte
|
||||
G byte
|
||||
B byte
|
||||
}{
|
||||
{"#123", false, 0, 0, 0},
|
||||
{"#1234567", false, 0, 0, 0},
|
||||
{"$123456", false, 0, 0, 0},
|
||||
{"#12345+", false, 0, 0, 0},
|
||||
{"#fFGG00", false, 0, 0, 0},
|
||||
{"", false, 0, 0, 0},
|
||||
{"#123456", true, 0x12, 0x34, 0x56},
|
||||
{"#C0FfeE", true, 0xc0, 0xff, 0xee},
|
||||
}
|
||||
|
||||
// Perform the table driven tests.
|
||||
for _, ct := range colorTestCases {
|
||||
|
||||
color, err := parseHexColor(ct.test)
|
||||
if !ct.valid && err == nil {
|
||||
t.Fatalf("Invalid color string: %s, should return "+
|
||||
"error, but did not", ct.test)
|
||||
}
|
||||
|
||||
if ct.valid && err != nil {
|
||||
t.Fatalf("Color %s valid to parse: %s", ct.test, err)
|
||||
}
|
||||
|
||||
// Ensure that the string to hex decoding is working properly.
|
||||
if color.R != ct.R || color.G != ct.G || color.B != ct.B {
|
||||
t.Fatalf("Color %s incorrectly parsed as %v", ct.test, color)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestTLSAutoRegeneration creates an expired TLS certificate, to test that a
|
||||
// new TLS certificate pair is regenerated when the old pair expires. This is
|
||||
// necessary because the pair expires after a little over a year.
|
||||
|
Reference in New Issue
Block a user