Use an interface for making tests and reporting test results

This commit is contained in:
nemunaire 2015-07-29 20:37:22 +02:00
commit 5bbb306006
6 changed files with 174 additions and 82 deletions

View file

@ -4,10 +4,15 @@ import (
"flag"
"fmt"
"log"
"github.com/nemunaire/eyespot/eyespot/cipherts"
"github.com/nemunaire/eyespot/eyespot/protocolts"
"github.com/nemunaire/eyespot"
"github.com/nemunaire/eyespot/testsuite"
)
var tests = []eyespot.Test{
testsuite.Protocols{},
testsuite.Ciphers{},
}
func main() {
var protocol = flag.String("protocol", "tcp", "Protocol to test")
var hostname = flag.String("hostname", "localhost", "Hostname to test")
@ -16,6 +21,13 @@ func main() {
host := fmt.Sprintf("%s:%d", *hostname, *port)
log.Println(protocolts.Run(*protocol, host))
log.Println(cipherts.Run(*protocol, host))
for _, t := range tests {
log.Println(t.GetTestDescription())
if res, err := t.Run(*protocol, host); err != nil {
log.Println(err)
} else {
log.Println(res)
}
}
}