aboutsummaryrefslogtreecommitdiff
path: root/unit_tests
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2026-02-27 10:59:11 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2026-02-27 10:59:11 +0100
commit7e4b6e1526c5b2f85079df6a6ecfe08244a7dbcc (patch)
tree3efb69b5a2d40fd1c226b72f3d0f99dcc30afc83 /unit_tests
parent68355c7dd6bef53d264eca53567df9fb9c8684b6 (diff)
downloadlanes-7e4b6e1526c5b2f85079df6a6ecfe08244a7dbcc.tar.gz
lanes-7e4b6e1526c5b2f85079df6a6ecfe08244a7dbcc.tar.bz2
lanes-7e4b6e1526c5b2f85079df6a6ecfe08244a7dbcc.zip
Unify sleep() timeout with send() and receive (nil means forever)v4.0.0
Diffstat (limited to 'unit_tests')
-rw-r--r--unit_tests/lane_tests.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/unit_tests/lane_tests.cpp b/unit_tests/lane_tests.cpp
index b6fb188..7c215fa 100644
--- a/unit_tests/lane_tests.cpp
+++ b/unit_tests/lane_tests.cpp
@@ -128,9 +128,11 @@ TEST_CASE("lanes.sleep.argument_validation/numbers")
128 // negative durations are not supported 128 // negative durations are not supported
129 S.requireFailure("lanes.sleep(-1)"); 129 S.requireFailure("lanes.sleep(-1)");
130 130
131 // no duration is supported (same as 0) 131 // no duration is supported
132 S.requireSuccess("lanes.sleep()");
133 S.requireSuccess("lanes.sleep(0)"); 132 S.requireSuccess("lanes.sleep(0)");
133
134 // positive durations are supported
135 S.requireSuccess("lanes.sleep(0.1)");
134} 136}
135 137
136// ################################################################################################# 138// #################################################################################################
@@ -161,7 +163,7 @@ TEST_CASE("lanes.sleep.interactions with timers")
161 " lanes.timer(l, 'gluh', 0.1, 0.1)" 163 " lanes.timer(l, 'gluh', 0.1, 0.1)"
162 // launch a lane that is supposed to sleep forever 164 // launch a lane that is supposed to sleep forever
163 " local g = lanes.gen('*', { name = 'auto' }, lanes.sleep)" 165 " local g = lanes.gen('*', { name = 'auto' }, lanes.sleep)"
164 " local h = g('indefinitely')" 166 " local h = g(nil)"
165 // sleep 1 second (this uses the timer linda) 167 // sleep 1 second (this uses the timer linda)
166 " lanes.sleep(1)" 168 " lanes.sleep(1)"
167 // shutdown should be able to cancel the lane and stop it instantly 169 // shutdown should be able to cancel the lane and stop it instantly