OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [net/] [port_test.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2009 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
 
5
package net
6
 
7
import (
8
        "testing"
9
)
10
 
11
type portTest struct {
12
        netw string
13
        name string
14
        port int
15
        ok   bool
16
}
17
 
18
var porttests = []portTest{
19
        {"tcp", "echo", 7, true},
20
        {"tcp", "discard", 9, true},
21
        {"tcp", "systat", 11, true},
22
        {"tcp", "daytime", 13, true},
23
        {"tcp", "chargen", 19, true},
24
        {"tcp", "ftp-data", 20, true},
25
        {"tcp", "ftp", 21, true},
26
        {"tcp", "telnet", 23, true},
27
        {"tcp", "smtp", 25, true},
28
        {"tcp", "time", 37, true},
29
        {"tcp", "domain", 53, true},
30
        {"tcp", "finger", 79, true},
31
 
32
        {"udp", "echo", 7, true},
33
        {"udp", "tftp", 69, true},
34
        {"udp", "bootpc", 68, true},
35
        {"udp", "bootps", 67, true},
36
        {"udp", "domain", 53, true},
37
        {"udp", "ntp", 123, true},
38
        {"udp", "snmp", 161, true},
39
        {"udp", "syslog", 514, true},
40
 
41
        {"--badnet--", "zzz", 0, false},
42
        {"tcp", "--badport--", 0, false},
43
}
44
 
45
func TestLookupPort(t *testing.T) {
46
        for i := 0; i < len(porttests); i++ {
47
                tt := porttests[i]
48
                if port, err := LookupPort(tt.netw, tt.name); port != tt.port || (err == nil) != tt.ok {
49
                        t.Errorf("LookupPort(%q, %q) = %v, %s; want %v",
50
                                tt.netw, tt.name, port, err, tt.port)
51
                }
52
        }
53
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.