File: test_Span.rb

package info (click to toggle)
ruby-chronic 0.6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 384 kB
  • sloc: ruby: 3,726; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'helper'

class TestSpan < Test::Unit::TestCase

  def setup
    # Wed Aug 16 14:00:00 UTC 2006
    @now = Time.local(2006, 8, 16, 14, 0, 0, 0)
  end

  def test_span_width
    span = Chronic::Span.new(Time.local(2006, 8, 16, 0), Time.local(2006, 8, 17, 0))
    assert_equal (60 * 60 * 24), span.width
  end

  def test_span_math
    s = Chronic::Span.new(1, 2)
    assert_equal 2, (s + 1).begin
    assert_equal 3, (s + 1).end
    assert_equal 0, (s - 1).begin
    assert_equal 1, (s - 1).end
  end

end