rserve-client 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data.tar.gz.sig +1 -2
  2. data/.gitignore +1 -0
  3. data/History.txt +15 -2
  4. data/Manifest.txt +8 -0
  5. data/README.txt +41 -19
  6. data/lib/rserve.rb +1 -1
  7. data/lib/rserve/connection.rb +152 -69
  8. data/lib/rserve/engine.rb +9 -9
  9. data/lib/rserve/packet.rb +2 -2
  10. data/lib/rserve/protocol.rb +51 -46
  11. data/lib/rserve/protocol/rexpfactory.rb +659 -366
  12. data/lib/rserve/rexp.rb +175 -156
  13. data/lib/rserve/rexp/double.rb +45 -38
  14. data/lib/rserve/rexp/environment.rb +40 -0
  15. data/lib/rserve/rexp/expressionvector.rb +9 -0
  16. data/lib/rserve/rexp/genericvector.rb +5 -3
  17. data/lib/rserve/rexp/integer.rb +38 -38
  18. data/lib/rserve/rexp/language.rb +2 -2
  19. data/lib/rserve/rexp/list.rb +3 -0
  20. data/lib/rserve/rexp/logical.rb +17 -4
  21. data/lib/rserve/rexp/null.rb +20 -14
  22. data/lib/rserve/rexp/raw.rb +19 -0
  23. data/lib/rserve/rexp/reference.rb +42 -0
  24. data/lib/rserve/rexp/s4.rb +10 -0
  25. data/lib/rserve/rexp/string.rb +5 -3
  26. data/lib/rserve/rexp/symbol.rb +3 -0
  27. data/lib/rserve/rexp/vector.rb +30 -15
  28. data/lib/rserve/rexp/wrapper.rb +58 -0
  29. data/lib/rserve/rfactor.rb +10 -10
  30. data/lib/rserve/rlist.rb +129 -100
  31. data/lib/rserve/talk.rb +61 -61
  32. data/spec/rserve_connection_spec.rb +99 -33
  33. data/spec/rserve_double_spec.rb +28 -15
  34. data/spec/rserve_integer_spec.rb +24 -15
  35. data/spec/rserve_logical_spec.rb +21 -12
  36. data/spec/rserve_protocol_spec.rb +7 -7
  37. data/spec/rserve_rexp_spec.rb +3 -3
  38. data/spec/rserve_rexp_wrapper_spec.rb +36 -0
  39. data/spec/rserve_rexpfactory_spec.rb +86 -20
  40. data/spec/rserve_rfactor_spec.rb +2 -2
  41. data/spec/rserve_rlist_spec.rb +53 -0
  42. data/spec/rserve_spec.rb +8 -5
  43. data/spec/rserve_talk_spec.rb +7 -7
  44. data/spec/spec_helper.rb +1 -0
  45. metadata +13 -3
  46. metadata.gz.sig +0 -0
@@ -2,7 +2,7 @@ require File.dirname(__FILE__)+"/spec_helper.rb"
2
2
 
3
3
  describe Rserve do
4
4
  before do
5
- @r=Rserve::Connection.new()
5
+ @r=Rserve::Connection.new()
6
6
  end
7
7
  it "should calcule a basic LR without hazzle" do
8
8
  script=<<-EOF
@@ -18,10 +18,13 @@ severity <- as.data.frame(cbind(diseasesev,temperature))
18
18
 
19
19
  ## Fit a linear model for the data and summarize the output from function lm()
20
20
  severity.lm <- lm(diseasesev~temperature,data=severity)
21
- EOF
22
- @r.void_eval(script)
23
- @r.eval('severity.lm').should be_true
24
- @r.eval('summary(severity.lm)').should be_true
21
+ EOF
22
+ @r.void_eval(script)
23
+ @r.eval('severity.lm').should be_instance_of(Rserve::REXP::GenericVector)
24
+ @r.eval('severity.lm').to_ruby.should be_true
25
+ @r.eval('summary(severity.lm)').should be_true
26
+ @r.eval('summary(severity.lm)').to_ruby.should be_true
27
+
25
28
 
26
29
 
27
30
  end
@@ -17,7 +17,7 @@ describe Rserve::Talk do
17
17
  lambda {
18
18
  @talk.request(:cmd=>ty, :cont=>"no")
19
19
  }.should raise_exception()
20
-
20
+
21
21
  end
22
22
  it "should behave correctly with cmd as only argument" do
23
23
  ty=Rserve::Protocol::CMD_shutdown
@@ -29,7 +29,7 @@ describe Rserve::Talk do
29
29
  cl=cont.length
30
30
  server_response_1=[rep,cl,0,0].pack("IIII")
31
31
  server_response_2=cont
32
-
32
+
33
33
  @iomock.should_receive(:write).once.with(buf.pack("C*"))
34
34
  @iomock.should_receive(:recv).once.with(16).and_return(server_response_1)
35
35
  @iomock.should_receive(:recv).once.with(cl).and_return(server_response_2)
@@ -41,11 +41,11 @@ describe Rserve::Talk do
41
41
  ret.cont.should==cont.unpack("C*")
42
42
  end
43
43
  it "should behave correctly with cmd and cont as arguments" do
44
-
44
+
45
45
 
46
46
  ty=Rserve::Protocol::CMD_eval
47
47
  buf=[0]*16
48
-
48
+
49
49
  es="x<-1020"
50
50
  es_proc=@talk.request_string(es).pack("C*")
51
51
  es_len=es_proc.size
@@ -58,12 +58,12 @@ describe Rserve::Talk do
58
58
  server_response_2=cont
59
59
  @iomock.should_receive(:write).once.with(buf.pack("C*"))
60
60
  @iomock.should_receive(:write).once.with(es_proc)
61
-
61
+
62
62
  @iomock.should_receive(:recv).once.with(16).and_return(server_response_1)
63
63
  @iomock.should_receive(:recv).once.with(cl).and_return(server_response_2)
64
-
64
+
65
65
  ret=@talk.request(:cmd=>ty,:cont=>es)
66
-
66
+
67
67
  ret.should be_instance_of(Rserve::Packet)
68
68
  ret.cmd.should==rep
69
69
  ret.cont_len.should==cl
@@ -3,3 +3,4 @@ require 'spec'
3
3
  require 'spec/autorun'
4
4
  require 'rserve'
5
5
  require 'matrix'
6
+ require 'pp'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Claudio Bustos
@@ -35,7 +35,7 @@ cert_chain:
35
35
  rpP0jjs0
36
36
  -----END CERTIFICATE-----
37
37
 
38
- date: 2010-05-24 00:00:00 -04:00
38
+ date: 2010-05-27 00:00:00 -04:00
39
39
  default_executable:
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
@@ -95,6 +95,8 @@ files:
95
95
  - lib/rserve/protocol/rexpfactory.rb
96
96
  - lib/rserve/rexp.rb
97
97
  - lib/rserve/rexp/double.rb
98
+ - lib/rserve/rexp/environment.rb
99
+ - lib/rserve/rexp/expressionvector.rb
98
100
  - lib/rserve/rexp/factor.rb
99
101
  - lib/rserve/rexp/genericvector.rb
100
102
  - lib/rserve/rexp/integer.rb
@@ -102,10 +104,14 @@ files:
102
104
  - lib/rserve/rexp/list.rb
103
105
  - lib/rserve/rexp/logical.rb
104
106
  - lib/rserve/rexp/null.rb
107
+ - lib/rserve/rexp/raw.rb
108
+ - lib/rserve/rexp/reference.rb
109
+ - lib/rserve/rexp/s4.rb
105
110
  - lib/rserve/rexp/string.rb
106
111
  - lib/rserve/rexp/symbol.rb
107
112
  - lib/rserve/rexp/unknown.rb
108
113
  - lib/rserve/rexp/vector.rb
114
+ - lib/rserve/rexp/wrapper.rb
109
115
  - lib/rserve/rfactor.rb
110
116
  - lib/rserve/rlist.rb
111
117
  - lib/rserve/talk.rb
@@ -116,8 +122,10 @@ files:
116
122
  - spec/rserve_packet_spec.rb
117
123
  - spec/rserve_protocol_spec.rb
118
124
  - spec/rserve_rexp_spec.rb
125
+ - spec/rserve_rexp_wrapper_spec.rb
119
126
  - spec/rserve_rexpfactory_spec.rb
120
127
  - spec/rserve_rfactor_spec.rb
128
+ - spec/rserve_rlist_spec.rb
121
129
  - spec/rserve_spec.rb
122
130
  - spec/rserve_talk_spec.rb
123
131
  - spec/spec.opts
@@ -154,6 +162,8 @@ signing_key:
154
162
  specification_version: 3
155
163
  summary: Ruby client for Rserve, a Binary R server (http://www.rforge.net/Rserve/)
156
164
  test_files:
165
+ - spec/rserve_rlist_spec.rb
166
+ - spec/rserve_rexp_wrapper_spec.rb
157
167
  - spec/rserve_rfactor_spec.rb
158
168
  - spec/rserve_connection_spec.rb
159
169
  - spec/rserve_double_spec.rb
metadata.gz.sig CHANGED
Binary file