rural 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +11 -0
- data/README.txt +63 -0
- data/Rakefile +39 -0
- data/ext/extconf.rb +4 -0
- data/ext/vlerq.c +4531 -0
- data/ext/vlerq.h +350 -0
- data/ext/vlerq_ext.c +394 -0
- data/ext/vlerq_ext.h +197 -0
- data/lib/rural.rb +65 -0
- data/test/test_rural.rb +127 -0
- metadata +65 -0
data/test/test_rural.rb
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
unless $ZENTEST
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rural'
|
4
|
+
end
|
5
|
+
|
6
|
+
class TestRural < Test::Unit::TestCase
|
7
|
+
unless $ZENTEST
|
8
|
+
def test_version
|
9
|
+
assert_equal Rural::VERSION.class, String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class TestVlerq < Test::Unit::TestCase
|
15
|
+
def test_class_cmdlist
|
16
|
+
assert Vlerq.cmdlist.size > 70
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_class_dispatch
|
20
|
+
assert_respond_to Vlerq, :dispatch
|
21
|
+
end
|
22
|
+
|
23
|
+
class TestRow < Test::Unit::TestCase
|
24
|
+
def setup
|
25
|
+
@meta = View.mdesc 'A,B:I'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test__i
|
29
|
+
assert_equal @meta[1]._i, 1
|
30
|
+
end
|
31
|
+
|
32
|
+
def test__v
|
33
|
+
assert_equal @meta[1]._v, @meta
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_index
|
37
|
+
assert_equal @meta[1][0], 'B'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class TestView < Test::Unit::TestCase
|
43
|
+
def setup
|
44
|
+
@meta = View.mdesc 'A,B:I'
|
45
|
+
@view = View.data @meta, ['a', 'bb', 'ccc'], [1, 22, 333]
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_class_method_missing_1
|
49
|
+
assert_equal @view.length, 3
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_class_method_missing_2
|
53
|
+
assert_equal @view.size, 3
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_each_1
|
57
|
+
out = []
|
58
|
+
@view.each { |r| out << r.B }
|
59
|
+
assert_equal out, [1, 22, 333]
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_each_2
|
63
|
+
assert_equal @view.collect { |r| r.B }, [1, 22, 333]
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_dump_1
|
67
|
+
assert_equal <<-EOF.chomp, @meta.dump
|
68
|
+
name type subv
|
69
|
+
---- ---- ----
|
70
|
+
A S #0
|
71
|
+
B I #0
|
72
|
+
---- ---- ----
|
73
|
+
EOF
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_dump_2
|
77
|
+
assert_equal <<-EOF.chomp, @view.dump
|
78
|
+
A B
|
79
|
+
--- ---
|
80
|
+
a 1
|
81
|
+
bb 22
|
82
|
+
ccc 333
|
83
|
+
--- ---
|
84
|
+
EOF
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_project_1
|
88
|
+
assert_equal <<-EOF.chomp, @view.project('B').meta.dump
|
89
|
+
name type subv
|
90
|
+
---- ---- ----
|
91
|
+
B I #0
|
92
|
+
---- ---- ----
|
93
|
+
EOF
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_project_2
|
97
|
+
assert_equal <<-EOF.chomp, @view.project('B', 'A').meta.dump
|
98
|
+
name type subv
|
99
|
+
---- ---- ----
|
100
|
+
B I #0
|
101
|
+
A S #0
|
102
|
+
---- ---- ----
|
103
|
+
EOF
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_project_3
|
107
|
+
assert_equal <<-EOF.chomp, @view.project('B').dump
|
108
|
+
B
|
109
|
+
---
|
110
|
+
1
|
111
|
+
22
|
112
|
+
333
|
113
|
+
---
|
114
|
+
EOF
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_project_4
|
118
|
+
assert_equal <<-EOF.chomp, @view.project('B', 'A').dump
|
119
|
+
B A
|
120
|
+
--- ---
|
121
|
+
1 a
|
122
|
+
22 bb
|
123
|
+
333 ccc
|
124
|
+
--- ---
|
125
|
+
EOF
|
126
|
+
end
|
127
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: rural
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2006-12-20 00:00:00 +01:00
|
8
|
+
summary: Rural adds relational algebra operators and persistence to Ruby applications.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
- ext
|
12
|
+
email: jcw@equi4.com
|
13
|
+
homepage: http://rural.rubyforge.org/
|
14
|
+
rubyforge_project: rural
|
15
|
+
description: Rural adds relational algebra operators and persistence to Ruby applications. This is a Ruby binding to Vlerq, a vector-oriented query engine using relational algebra and set-wise operations. The data can be either in memory or on file.
|
16
|
+
autorequire:
|
17
|
+
default_executable:
|
18
|
+
bindir: bin
|
19
|
+
has_rdoc: true
|
20
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
25
|
+
version:
|
26
|
+
platform: ruby
|
27
|
+
signing_key:
|
28
|
+
cert_chain:
|
29
|
+
post_install_message:
|
30
|
+
authors:
|
31
|
+
- Jean-Claude Wippler
|
32
|
+
files:
|
33
|
+
- History.txt
|
34
|
+
- Manifest.txt
|
35
|
+
- README.txt
|
36
|
+
- Rakefile
|
37
|
+
- ext/extconf.rb
|
38
|
+
- ext/vlerq.c
|
39
|
+
- ext/vlerq.h
|
40
|
+
- ext/vlerq_ext.c
|
41
|
+
- ext/vlerq_ext.h
|
42
|
+
- lib/rural.rb
|
43
|
+
- test/test_rural.rb
|
44
|
+
test_files:
|
45
|
+
- test/test_rural.rb
|
46
|
+
rdoc_options: []
|
47
|
+
|
48
|
+
extra_rdoc_files: []
|
49
|
+
|
50
|
+
executables: []
|
51
|
+
|
52
|
+
extensions:
|
53
|
+
- ext/extconf.rb
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
dependencies:
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: hoe
|
59
|
+
version_requirement:
|
60
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.1.6
|
65
|
+
version:
|