prot-a.exp 2.5 KB
Newer Older
David Byers's avatar
David Byers committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

#
# Functions to make protocol A a little simpler
#

set ref_no 0

proc kom_next_call {} {
    global ref_no

    set ref_no [expr $ref_no + 1]
}

proc cres { result dflt} {
    if { $result == "" } {
        return $dflt
    } else {
        return eval $result
    }
}


proc kom_connect { user {result ""} {testname ""}} {
    global ref_no

    send "A[holl $user]\n"
    set result [cres $result "LysKOM"]
    simple_expect $result $testname
}

proc kom_accept_async { str {result ""} {testname ""}} {
    global ref_no

    kom_next_call
    send "$ref_no 80 $str\n"
    set result [cres $result "=$ref_no"]

    simple_expect $result $testname
}

proc kom_create_person { name password aux {result ""} {testname ""}} {
    global ref_no
    global any_num
    global pers_no

    kom_next_call
    send "$ref_no 89 [holl "$name"] [holl "$password"] $aux\n"
    set result [cres $result "=$ref_no ($any_num)" ]
    extracting_expect $result pers_no 1

    return $pers_no
}

proc kom_logout {{result ""} {testname ""}} {
    global ref_no

    kom_next_call
    send "$ref_no 1\n"
    set result [cres $result "=$ref_no"]
    simple_expect $result $testname
}

proc kom_login {person password invisible {result ""} {testname ""}} {
    global ref_no

    kom_next_call
    send "$ref_no 62 $person [holl "$password"] $invisible\n"
    set result [cres $result "=$ref_no"]
    simple_expect $result $testname
}

proc kom_create_conference { name type aux {result ""} {testname ""}} {
    global ref_no
    global any_num
    global conf_no

    kom_next_call
    send "$ref_no 88 [holl "$name"] $type $aux\n"
    set result [cres $result "=$ref_no ($any_num)"]
    extracting_expect $result conf_no 1

    return $conf_no
}

proc kom_enable { value {result ""} {testname ""} } {
    global ref_no

    kom_next_call
    send "$ref_no 42 $value\n"
    set result [cres $result "=$ref_no"]
    simple_expect $result $testname
}

proc kom_set_supervisor { conf admin {result ""} {testname ""} } {
    global ref_no

    kom_next_call
    send "$ref_no 18 $conf $admin\n"
    set result [cres $result "=$ref_no"]
    simple_expect $result $testname
}    
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

proc kom_add_member { conf pers prio where type {result ""} {testname ""}} {
    global ref_no
    
    kom_next_call
    send "$ref_no 100 $conf $pers $prio $where $type\n"
    set result [cres $result "=$ref_no"]
    simple_expect $result $testname
}

proc kom_ping_server { } {
    global ref_no
    global any_time

    kom_next_call
    send "$ref_no 35\n"
    simple_expect "=$ref_no $any_time"
}