summaryrefslogtreecommitdiffstats
path: root/tests/tdef/tdef_test.ok
blob: 1acf0e607d38016f46368476ee36c075c61114f3 (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

test_tdef_get()
T1=100s
osmo_tdef_get(1, s)	= 100
osmo_tdef_get(1, ms)	= 100000
osmo_tdef_get(1, m)	= 2
osmo_tdef_get(1, custom-unit)	= 100
T2=100ms
osmo_tdef_get(2, s)	= 1
osmo_tdef_get(2, ms)	= 100
osmo_tdef_get(2, m)	= 1
osmo_tdef_get(2, custom-unit)	= 100
T3=100m
osmo_tdef_get(3, s)	= 6000
osmo_tdef_get(3, ms)	= 6000000
osmo_tdef_get(3, m)	= 100
osmo_tdef_get(3, custom-unit)	= 100
T4=100custom-unit
osmo_tdef_get(4, s)	= 100
osmo_tdef_get(4, ms)	= 100
osmo_tdef_get(4, m)	= 100
osmo_tdef_get(4, custom-unit)	= 100
T7=50s
osmo_tdef_get(7, s)	= 50
osmo_tdef_get(7, ms)	= 50000
osmo_tdef_get(7, m)	= 1
osmo_tdef_get(7, custom-unit)	= 50
T8=300s
osmo_tdef_get(8, s)	= 300
osmo_tdef_get(8, ms)	= 300000
osmo_tdef_get(8, m)	= 5
osmo_tdef_get(8, custom-unit)	= 300
T9=5m
osmo_tdef_get(9, s)	= 300
osmo_tdef_get(9, ms)	= 300000
osmo_tdef_get(9, m)	= 5
osmo_tdef_get(9, custom-unit)	= 5
T10=20m
osmo_tdef_get(10, s)	= 1200
osmo_tdef_get(10, ms)	= 1200000
osmo_tdef_get(10, m)	= 20
osmo_tdef_get(10, custom-unit)	= 20
T1000=2000ms
osmo_tdef_get(1000, s)	= 2
osmo_tdef_get(1000, ms)	= 2000
osmo_tdef_get(1000, m)	= 1
osmo_tdef_get(1000, custom-unit)	= 2000
T1001=60000ms
osmo_tdef_get(1001, s)	= 60
osmo_tdef_get(1001, ms)	= 60000
osmo_tdef_get(1001, m)	= 1
osmo_tdef_get(1001, custom-unit)	= 60000
T1004=1ms
osmo_tdef_get(1004, s)	= 1
osmo_tdef_get(1004, ms)	= 1
osmo_tdef_get(1004, m)	= 1
osmo_tdef_get(1004, custom-unit)	= 1
T1005=0ms
osmo_tdef_get(1005, s)	= 0
osmo_tdef_get(1005, ms)	= 0
osmo_tdef_get(1005, m)	= 0
osmo_tdef_get(1005, custom-unit)	= 0
T1006=0s
osmo_tdef_get(1006, s)	= 0
osmo_tdef_get(1006, ms)	= 0
osmo_tdef_get(1006, m)	= 0
osmo_tdef_get(1006, custom-unit)	= 0
T1007=0m
osmo_tdef_get(1007, s)	= 0
osmo_tdef_get(1007, ms)	= 0
osmo_tdef_get(1007, m)	= 0
osmo_tdef_get(1007, custom-unit)	= 0
T1008=0custom-unit
osmo_tdef_get(1008, s)	= 0
osmo_tdef_get(1008, ms)	= 0
osmo_tdef_get(1008, m)	= 0
osmo_tdef_get(1008, custom-unit)	= 0
T0=1custom-unit
osmo_tdef_get(0, s)	= 1
osmo_tdef_get(0, ms)	= 1
osmo_tdef_get(0, m)	= 1
osmo_tdef_get(0, custom-unit)	= 1
T123=1s
osmo_tdef_get(123, s)	= 1
osmo_tdef_get(123, ms)	= 1000
osmo_tdef_get(123, m)	= 1
osmo_tdef_get(123, custom-unit)	= 1

test_tdef_get_nonexisting()
osmo_tdef_get(tdefs, 5, s, 999)	= 999
osmo_tdef_get(tdefs, 5, ms, 999)	= 999
osmo_tdef_get(tdefs, 5, m, 999)	= 999
osmo_tdef_get(tdefs, 5, custom-unit, 999)	= 999

test_tdef_set_and_get()
setting 7 = 42
T7=42s(def=50)
osmo_tdef_get(7, ms)	= 42000
osmo_tdef_get(7, s)	= 42
osmo_tdef_get(7, m)	= 1
osmo_tdef_get(7, custom-unit)	= 42
setting 7 = 420
T7=420s(def=50)
osmo_tdef_get(7, ms)	= 420000
osmo_tdef_get(7, s)	= 420
osmo_tdef_get(7, m)	= 7
osmo_tdef_get(7, custom-unit)	= 420
resetting
T7=50s
osmo_tdef_get(7, s)	= 50

test_tdef_state_timeout()
state=A T=0, no timeout
 --> A (configured as T1 100 s) rc=0;	state=A T=1, 100.000000 s remaining
 --> B (configured as T2 100 ms) rc=0;	state=B T=2, 1.000000 s remaining
 --> C (configured as T3 100 m) rc=0;	state=C T=3, 6000.000000 s remaining
 --> D (configured as T4 100 custom-unit) rc=0;	state=D T=4, 100.000000 s remaining
 --> G (configured as T7 50 s) rc=0;	state=G T=7, 50.000000 s remaining
 --> H (configured as T8 300 s) rc=0;	state=H T=8, 300.000000 s remaining
 --> I (configured as T9 5 m) rc=0;	state=I T=9, 300.000000 s remaining
 --> J (configured as T10 20 m) rc=0;	state=J T=10, 1200.000000 s remaining
- test keep_timer:
Time passes: 123.045678 s
state=J T=10, 1076.954322 s remaining
 --> K (configured as T0(keep_timer) 1 custom-unit) rc=0;	state=K T=10, 1076.954322 s remaining
 --> A (configured as T1 100 s) rc=0;	state=A T=1, 100.000000 s remaining
Time passes: 23.045678 s
state=A T=1, 76.954322 s remaining
 --> K (configured as T0(keep_timer) 1 custom-unit) rc=0;	state=K T=1, 76.954322 s remaining
 --> A (configured as T1 100 s) rc=0;	state=A T=1, 100.000000 s remaining
Time passes: 23.045678 s
state=A T=1, 76.954322 s remaining
 --> L (configured as T123(keep_timer) 1 s) rc=0;	state=L T=123, 76.954322 s remaining
 --> O (no timer configured for this state)	state=L T=123, 76.954322 s remaining
 --> L (configured as T123(keep_timer) 1 s) rc=0;	state=L T=123, 76.954322 s remaining
- test T=0:
 --> O (no timer configured for this state)	state=L T=123, 76.954322 s remaining
- test no timer:
 --> X (no timer configured for this state)	state=L T=123, 76.954322 s remaining
- test undefined timer, using default_val arg of osmo_tdef_fsm_inst_state_chg(), here passed as 999:
 --> Y (configured as T666 0 -) rc=0;	state=Y T=666, 999.000000 s remaining
- test disallowed transition:
 --> Z (no timer configured for this state)	state=Y T=666, 999.000000 s remaining
 --> B (configured as T2 100 ms) rc=0;	state=B T=2, 1.000000 s remaining
 --> C (configured as T3 100 m) rc=0;	state=C T=3, 6000.000000 s remaining
 --> D (configured as T4 100 custom-unit) rc=0;	state=D T=4, 100.000000 s remaining