aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tdef/tdef_test.ok
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tdef/tdef_test.ok')
-rw-r--r--tests/tdef/tdef_test.ok184
1 files changed, 184 insertions, 0 deletions
diff --git a/tests/tdef/tdef_test.ok b/tests/tdef/tdef_test.ok
new file mode 100644
index 00000000..cf4b77f5
--- /dev/null
+++ b/tests/tdef/tdef_test.ok
@@ -0,0 +1,184 @@
+
+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
+T1002=307445734561825860m
+osmo_tdef_get(1002, s) = 18446744073709551600
+osmo_tdef_get(1002, ms) = 18446744073709551615
+osmo_tdef_get(1002, m) = 307445734561825860
+osmo_tdef_get(1002, custom-unit) = 307445734561825860
+T1003=18446744073709551615m
+osmo_tdef_get(1003, s) = 18446744073709551615
+osmo_tdef_get(1003, ms) = 18446744073709551615
+osmo_tdef_get(1003, m) = 18446744073709551615
+osmo_tdef_get(1003, custom-unit) = 18446744073709551615
+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
+T2147483647=18446744073709551615s
+osmo_tdef_get(2147483647, s) = 18446744073709551615
+osmo_tdef_get(2147483647, ms) = 18446744073709551615
+osmo_tdef_get(2147483647, m) = 307445734561825861
+osmo_tdef_get(2147483647, custom-unit) = 18446744073709551615
+T2147483646=18446744073709551614s
+osmo_tdef_get(2147483646, s) = 18446744073709551614
+osmo_tdef_get(2147483646, ms) = 18446744073709551615
+osmo_tdef_get(2147483646, m) = 307445734561825861
+osmo_tdef_get(2147483646, custom-unit) = 18446744073709551614
+T2147483645=9223372036854775807s
+osmo_tdef_get(2147483645, s) = 9223372036854775807
+osmo_tdef_get(2147483645, ms) = 18446744073709551615
+osmo_tdef_get(2147483645, m) = 153722867280912931
+osmo_tdef_get(2147483645, custom-unit) = 9223372036854775807
+T2147483644=18446744073709551615m
+osmo_tdef_get(2147483644, s) = 18446744073709551615
+osmo_tdef_get(2147483644, ms) = 18446744073709551615
+osmo_tdef_get(2147483644, m) = 18446744073709551615
+osmo_tdef_get(2147483644, custom-unit) = 18446744073709551615
+T-2147483648=18446744073709551615s
+osmo_tdef_get(-2147483648, s) = 18446744073709551615
+osmo_tdef_get(-2147483648, ms) = 18446744073709551615
+osmo_tdef_get(-2147483648, m) = 307445734561825861
+osmo_tdef_get(-2147483648, custom-unit) = 18446744073709551615
+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()
+Total time passed: 0.000000 s
+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:
+Total time passed: 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
+Total time passed: 146.091356 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
+Total time passed: 169.137034 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
+- test large T:
+ --> M (configured as T2147483647 18446744073709551615 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining
+- test T<0:
+ --> N (configured as T-2147483648 18446744073709551615 s) rc=0; state=N T=-2147483648, 2147483647.000000 s remaining
+- test T=0:
+ --> O (no timer configured for this state)
+- test no timer:
+ --> X (no timer configured for this state)
+- test undefined timer, using default_val arg of osmo_tdef_fsm_inst_state_chg(), here passed as 999:
+ --> Y (configured as T666 18446744073709551615 -) rc=0; state=Y T=666, 999.000000 s remaining
+- test disallowed transition:
+ --> Z (no timer configured for this state)
+ --> 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