Commit c7f56ab3
c7f56ab3601eMerged
Richard Ramsden <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
Expand test/time.rb with magnitude and consistency checks
Add four checks alongside the existing fractional-part assert:
- to_i > 1_000_000_000 (post-Sept 2001 epoch)
- to_i < 2_000_000_000 (pre-2033 — bounded below int32 max because spinel's parser currently zeroes literals >= 2^31; 2e9 still catches wrong-scale regressions like ms/us/ns since epoch)
- to_f > 1_000_000_000.0 (same epoch sanity for the float path)
- t.to_i == t.to_f.to_i || t.to_i + 1 == t.to_f.to_i — integer-part consistency between the two paths; the +1 branch handles the rounding edge that the Time.now.to_i special case avoids
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- c7f56ab3601e
- Parent
- 5a58eaa7dd6f
test/time.rbmodifiedView file
@@ -1,3 +1,7 @@
11
t = Time.now22
puts t.to_f - t.to_i > 0.03+
puts t.to_i > 1_000_000_0004+
puts t.to_i < 2_000_000_0005+
puts t.to_f > 1_000_000_000.06+
puts t.to_i == t.to_f.to_i || t.to_i + 1 == t.to_f.to_i37
puts "done"