texp 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'date'
4
+ require 'test/unit'
5
+ require 'texp'
6
+
7
+ class WindowTest < Test::Unit::TestCase
8
+
9
+ def test_window
10
+ wed = TExp.parse("3w")
11
+ te = TExp::Window.new(wed, 2, 1)
12
+ assert ! te.include?(Date.parse("Mar 2, 2008"))
13
+ assert te.include?(Date.parse("Mar 3, 2008"))
14
+ assert te.include?(Date.parse("Mar 4, 2008"))
15
+ assert te.include?(Date.parse("Mar 5, 2008"))
16
+ assert te.include?(Date.parse("Mar 6, 2008"))
17
+ assert ! te.include?(Date.parse("Mar 7, 2008"))
18
+ end
19
+
20
+ def test_narrow_window
21
+ wed = TExp.parse("3w")
22
+ te = TExp::Window.new(wed, 0, 0)
23
+ assert ! te.include?(Date.parse("Mar 2, 2008"))
24
+ assert ! te.include?(Date.parse("Mar 3, 2008"))
25
+ assert ! te.include?(Date.parse("Mar 4, 2008"))
26
+ assert te.include?(Date.parse("Mar 5, 2008"))
27
+ assert ! te.include?(Date.parse("Mar 6, 2008"))
28
+ assert ! te.include?(Date.parse("Mar 7, 2008"))
29
+ end
30
+
31
+ end
32
+
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'date'
5
+ require 'texp'
6
+
7
+ class YearTest < Test::Unit::TestCase
8
+
9
+ def setup
10
+ @date = Date.parse("Feb 14, 2008")
11
+ end
12
+
13
+ def test_single_arg
14
+ te = TExp::Year.new(2008)
15
+ assert te.include?(@date)
16
+ assert te.include?(@date + 30)
17
+ assert ! te.include?(@date + 365)
18
+ end
19
+
20
+ def test_single_arg
21
+ te = TExp::Year.new([2007,2008])
22
+ assert te.include?(@date - 365)
23
+ assert te.include?(@date)
24
+ assert te.include?(@date + 30)
25
+ assert ! te.include?(@date + 365)
26
+ end
27
+ end
28
+
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: texp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Jim Weirich
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-03-06 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: TExp is a temporal expression library for Ruby with a modular, extensible expression serialization language.
17
+ email: jim.weirich@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - MIT-LICENSE
25
+ - ChangeLog
26
+ files:
27
+ - ChangeLog
28
+ - INFO
29
+ - MIT-LICENSE
30
+ - Rakefile
31
+ - README
32
+ - lib/texp.rb
33
+ - lib/texp/base.rb
34
+ - lib/texp/core.rb
35
+ - lib/texp/day_interval.rb
36
+ - lib/texp/day_of_month.rb
37
+ - lib/texp/day_of_week.rb
38
+ - lib/texp/every_day.rb
39
+ - lib/texp/ext.rb
40
+ - lib/texp/hash_builder.rb
41
+ - lib/texp/logic.rb
42
+ - lib/texp/month.rb
43
+ - lib/texp/parse.rb
44
+ - lib/texp/week.rb
45
+ - lib/texp/window.rb
46
+ - lib/texp/year.rb
47
+ - test/texp/day_interval_test.rb
48
+ - test/texp/day_of_month_test.rb
49
+ - test/texp/day_of_week_test.rb
50
+ - test/texp/every_day_test.rb
51
+ - test/texp/ext_test.rb
52
+ - test/texp/hash_test.rb
53
+ - test/texp/inspect_test.rb
54
+ - test/texp/logic_test.rb
55
+ - test/texp/logic_text_test.rb
56
+ - test/texp/month_test.rb
57
+ - test/texp/parse_test.rb
58
+ - test/texp/week_test.rb
59
+ - test/texp/window_test.rb
60
+ - test/texp/year_test.rb
61
+ - doc/jamis.rb
62
+ has_rdoc: true
63
+ homepage: http://texp.rubyforge.org
64
+ post_install_message:
65
+ rdoc_options:
66
+ - --line-numbers
67
+ - --inline-source
68
+ - --main
69
+ - README
70
+ - --title
71
+ - TExp - Temporal Expressions
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ version:
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ version:
86
+ requirements: []
87
+
88
+ rubyforge_project: texp
89
+ rubygems_version: 1.0.1
90
+ signing_key:
91
+ specification_version: 2
92
+ summary: Temporal Expressions for Ruby.
93
+ test_files: []
94
+