Complete SetLogWriter testing

This commit is contained in:
Michalis Kargakis 2014-08-03 23:30:37 +03:00
parent ef0ca7dff5
commit 55ad967b4d
2 changed files with 22 additions and 7 deletions

View file

@ -38,14 +38,29 @@ func TestSetLogWriter(t *testing.T) {
level: "off",
expected: errors.New("Min level can't be greater than max. Got min: 6, max: 5"),
},
{
name: "pass",
w: os.Stdout,
level: "debug",
expected: nil,
},
}
t.Logf("Running %d tests", len(tests))
for i, test := range tests {
if err := btcscript.SetLogWriter(test.w, test.level); err.Error() != test.expected.Error() {
t.Errorf("SetLogWriter #%d (%s) wrong result\n"+
"got: %x\nwant: %x", i, test.name, err,
test.expected)
err := btcscript.SetLogWriter(test.w, test.level)
if err != nil {
if err.Error() != test.expected.Error() {
t.Errorf("SetLogWriter #%d (%s) wrong result\n"+
"got: %x\nwant: %x", i, test.name, err,
test.expected)
}
} else {
if test.expected != nil {
t.Errorf("SetLogWriter #%d (%s) wrong result\n"+
"got: %x\nwant: %x", i, test.name, err,
test.expected)
}
}
}
}

View file

@ -23,6 +23,7 @@ github.com/conformal/btcscript/opcode.go opcodeNotIf 100.00% (11/11)
github.com/conformal/btcscript/opcode.go opcodeIf 100.00% (11/11)
github.com/conformal/btcscript/script.go typeOfScript 100.00% (11/11)
github.com/conformal/btcscript/opcode.go opcodeMin 100.00% (10/10)
github.com\conformal\btcscript/log.go SetLogWriter 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeBoolAnd 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeBoolOr 100.00% (10/10)
github.com/conformal/btcscript/opcode.go opcodeNumEqual 100.00% (10/10)
@ -132,6 +133,7 @@ github.com/conformal/btcscript/opcode.go init 100.00% (1/1)
github.com/conformal/btcscript/script.go payToPubKeyHashScript 100.00% (1/1)
github.com/conformal/btcscript/script.go payToScriptHashScript 100.00% (1/1)
github.com/conformal/btcscript/log.go newLogClosure 100.00% (1/1)
github.com\conformal\btcscript/log.go UseLogger 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeSwap 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeRot 100.00% (1/1)
github.com/conformal/btcscript/scriptbuilder.go ScriptBuilder.Script 100.00% (1/1)
@ -169,14 +171,12 @@ github.com/conformal/btcscript/script.go IsPushOnlyScript 75.00% (3/4)
github.com/conformal/btcscript/script.go p2pkSignatureScript 75.00% (3/4)
github.com/conformal/btcscript/script.go HasCanonicalPushes 71.43% (5/7)
github.com/conformal/btcscript/script.go sign 69.23% (18/26)
github.com/conformal/btcscript/log.go SetLogWriter 0.00% (8/10)
github.com/conformal/btcscript/script.go CalcMultiSigStats 0.00% (0/8)
github.com/conformal/btcscript/script.go @586:34 0.00% (0/6)
github.com/conformal/btcscript/script.go @574:34 0.00% (0/4)
github.com/conformal/btcscript/script.go @619:34 0.00% (0/3)
github.com/conformal/btcscript/log.go UseLogger 0.00% (0/1)
github.com/conformal/btcscript/opcode.go opcodeDisabled 0.00% (0/1)
github.com/conformal/btcscript/log.go logClosure.String 0.00% (0/1)
github.com/conformal/btcscript/opcode.go @1803:33 0.00% (0/1)
github.com/conformal/btcscript -------------------------- 95.79% (1205/1258)
github.com/conformal/btcscript -------------------------- 96.03% (1208/1258)