citrus 2.3.2 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,77 +0,0 @@
1
- $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
2
-
3
- require 'citrus'
4
-
5
- # This file contains a small suite of tests for the grammars found in ip.citrus.
6
- # If this file is run directly (i.e. using `ruby ip.rb') the tests will run.
7
- # Otherwise, this file may be required by another that needs access to the IP
8
- # address grammars just as any other file would be.
9
-
10
- # Load and evaluate the grammars contained in ip.citrus into the global
11
- # namespace.
12
- Citrus.load(File.expand_path('../ip', __FILE__))
13
-
14
- if $0 == __FILE__
15
- require 'test/unit'
16
-
17
- class IPAddressTest < Test::Unit::TestCase
18
- def test_dec_octet
19
- match = IPv4Address.parse('0', :root => :'dec-octet')
20
- assert(match)
21
-
22
- match = IPv4Address.parse('255', :root => :'dec-octet')
23
- assert(match)
24
- end
25
-
26
- def test_hexdig
27
- match = IPv6Address.parse('0', :root => :HEXDIG)
28
- assert(match)
29
-
30
- match = IPv6Address.parse('A', :root => :HEXDIG)
31
- assert(match)
32
- end
33
-
34
- def test_v4
35
- match = IPv4Address.parse('0.0.0.0')
36
- assert(match)
37
-
38
- match = IPv4Address.parse('255.255.255.255')
39
- assert(match)
40
-
41
- assert_raise Citrus::ParseError do
42
- IPv4Address.parse('255.255.255')
43
- end
44
- end
45
-
46
- def test_v6
47
- match = IPv6Address.parse('1:2:3:4:5:6:7:8')
48
- assert(match)
49
-
50
- match = IPv6Address.parse('12AD:34FC:A453:1922::')
51
- assert(match)
52
-
53
- match = IPv6Address.parse('12AD::34FC')
54
- assert(match)
55
-
56
- match = IPv6Address.parse('12AD::')
57
- assert(match)
58
-
59
- match = IPv6Address.parse('::')
60
- assert(match)
61
-
62
- assert_raise Citrus::ParseError do
63
- IPv6Address.parse('1:2')
64
- end
65
- end
66
-
67
- def test_all
68
- match = IPAddress.parse('1.2.3.4')
69
- assert(match)
70
- assert_equal(4, match.version)
71
-
72
- match = IPAddress.parse('1:2:3:4::')
73
- assert(match)
74
- assert_equal(6, match.version)
75
- end
76
- end
77
- end
@@ -1,16 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- Citrus.load File.expand_path('../../examples/calc', __FILE__)
4
-
5
- class CalcFileTest < Test::Unit::TestCase
6
- include CalcTestMethods
7
-
8
- # It's a bit hacky, but since this test runs before calc_test.rb we can
9
- # avoid getting the "already defined constant" error by renaming the Calc
10
- # constant here.
11
- CalcFile = Object.__send__(:remove_const, :Calc)
12
-
13
- def do_test(expr)
14
- super(expr, CalcFile)
15
- end
16
- end
@@ -1,11 +0,0 @@
1
- require File.expand_path('../helper', __FILE__)
2
-
3
- require File.expand_path('../../examples/calc', __FILE__)
4
-
5
- class CalcTest < Test::Unit::TestCase
6
- include CalcTestMethods
7
-
8
- def do_test(expr)
9
- super(expr, Calc)
10
- end
11
- end