Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 44 lines (37 sloc) 1.124 kB
27db1ef Initial commit
Larry Diehl authored
1 require File.dirname(__FILE__) + "/neurosis"
79e6c85 @larrytheliquid Basic MLP-NN webservice
authored
2 require "rack/test"
3 require "json"
27db1ef Initial commit
Larry Diehl authored
4
5b8e777 @larrytheliquid First simple function
authored
5 Spec::Runner.configure do |config|
79e6c85 @larrytheliquid Basic MLP-NN webservice
authored
6 system "rm /var/hubris/cache/Perceptron.so" rescue nil
7 include Rack::Test::Methods
5b8e777 @larrytheliquid First simple function
authored
8
79e6c85 @larrytheliquid Basic MLP-NN webservice
authored
9 def app
10 Neurosis::Server
5b8e777 @larrytheliquid First simple function
authored
11 end
12 end
13
79e6c85 @larrytheliquid Basic MLP-NN webservice
authored
14 describe Neurosis::Server, "GET /" do
15 it "responds with output nodes when given all options" do
16 get "/", :input => {
17 "input_patterns" =>
18 [[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]],
19 "output_patterns" =>
20 [[0.0], [1.0], [1.0], [0.0]],
21 "hidden_weights_group" =>
22 [[0.0923, 0.1958, -0.4049], [0.2904, 0.1946, -0.1057]],
23 "output_weights_group" =>
327a043 @larrytheliquid Add option for learning rate
authored
24 [[0.0276, 0.1621, 0.2559]],
25 "learning_rate" => [[0.5]]
79e6c85 @larrytheliquid Basic MLP-NN webservice
authored
26 }.to_json
27
28 last_response.should be_successful
29 JSON.parse(last_response.body).should ==
327a043 @larrytheliquid Add option for learning rate
authored
30 [[0], [1], [1], [0]]
79e6c85 @larrytheliquid Basic MLP-NN webservice
authored
31 end
32
33 it "responds with error message when missing options" do
34 get "/", :input => {
35 "output_patterns" =>
36 [[0.0], [1.0], [1.0], [0.0]],
37 "output_weights_group" =>
38 [[0.0276, 0.1621, 0.2559]]
39 }.to_json
40
41 last_response.should be_client_error
27db1ef Initial commit
Larry Diehl authored
42 end
43 end
Something went wrong with that request. Please try again.