[svn:parrot] r42514 - trunk/t/op
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Sat Nov 14 19:40:30 UTC 2009
Author: whiteknight
Date: Sat Nov 14 19:40:30 2009
New Revision: 42514
URL: https://trac.parrot.org/parrot/changeset/42514
Log:
add test coverage for sleep_n opcode
Modified:
trunk/t/op/time.t
Modified: trunk/t/op/time.t
==============================================================================
--- trunk/t/op/time.t Sat Nov 14 19:35:37 2009 (r42513)
+++ trunk/t/op/time.t Sat Nov 14 19:40:30 2009 (r42514)
@@ -3,11 +3,13 @@
.sub main :main
.include 'test_more.pir'
- plan(9)
+ plan(11)
test_time_i()
test_time_n()
test_sleep_i()
test_sleep_i_negative()
+ test_sleep_n()
+ test_sleep_n_negative()
test_gmtime_string_length()
test_time_n_vs_time_i()
.end
@@ -40,18 +42,40 @@
sleep $I1
$I1 = time
$I2 = isgt $I1, $I2
- ok($I2, "Sleeping increases time")
+ ok($I2, "sleep_i increases time")
.end
.sub test_sleep_i_negative
push_eh cannot_sleep_negative
- sleep -1
+ sleep -1
pop_eh
ok(0, "Guess what? Just time traveled")
.return()
cannot_sleep_negative:
pop_eh
- ok(1, "Cannot sleep backwards")
+ ok(1, "Cannot sleep_i backwards")
+.end
+
+.sub test_sleep_n
+ $N0 = time
+ sleep 1.1
+
+ $N1 = 1.1
+ sleep $N1
+ $N1 = time
+ $I2 = isgt $N1, $N22
+ ok($I2, "sleep_n increases time")
+.end
+
+.sub test_sleep_n_negative
+ push_eh cannot_sleep_negative
+ sleep -1.2
+ pop_eh
+ ok(0, "Guess what? Just time traveled")
+ .return()
+ cannot_sleep_negative:
+ pop_eh
+ ok(1, "Cannot sleep_n backwards")
.end
.sub test_gmtime_string_length
More information about the parrot-commits
mailing list