https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Add the inputs table.
* web/ranch/test/unit/input_test.rb: New.
* web/ranch/test/fixtures/inputs.yml: New.
* web/ranch/app/models/input.rb: New.
* web/ranch/db/schema.rb: Update.
app/models/input.rb | 5 +++++
db/schema.rb | 16 ++++++++++++----
test/fixtures/inputs.yml | 23 +++++++++++++++++++++++
test/unit/input_test.rb | 10 ++++++++++
4 files changed, 50 insertions(+), 4 deletions(-)
Index: web/ranch/test/unit/input_test.rb
--- web/ranch/test/unit/input_test.rb (revision 0)
+++ web/ranch/test/unit/input_test.rb (revision 0)
@@ -0,0 +1,10 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class InputTest < Test::Unit::TestCase
+ fixtures :inputs
+
+ # Replace this with your real tests.
+ def test_truth
+ assert_kind_of Input, inputs(:first)
+ end
+end
Index: web/ranch/test/fixtures/inputs.yml
--- web/ranch/test/fixtures/inputs.yml (revision 0)
+++ web/ranch/test/fixtures/inputs.yml (revision 0)
@@ -0,0 +1,23 @@
+<% id = 0 %>
+
+<% arg_num = 0
+ {
+ 'nb_states' => '',
+ 'nb_transition' => '',
+ 'foo' => 'unit_foo'
+ }.each do |name, unit| %>
+
+<% val = 2
+ arg_num += 1
+ (1..10).each do |rev| %>
+
+<%= "determinize_r#{rev}_#{name}:" %>
+ id: <%= id += 1 %>
+ name: <%= name %>
+ value: <%= val *= 2 %>
+ unit: <%= unit.inspect %>
+ bench_id: <%= rev %>
+ arg_num: <%= arg_num %>
+<% end %>
+<% end %>
+
Index: web/ranch/app/models/input.rb
--- web/ranch/app/models/input.rb (revision 0)
+++ web/ranch/app/models/input.rb (revision 0)
@@ -0,0 +1,5 @@
+class Input < ActiveRecord::Base
+
+ belongs_to :bench
+
+end
Index: web/ranch/db/schema.rb
--- web/ranch/db/schema.rb (revision 21)
+++ web/ranch/db/schema.rb (working copy)
@@ -6,17 +6,25 @@
create_table "benches", :force => true do |t|
t.column "name", :string, :limit => 128, :default =>
"noname", :null => false
- t.column "project_id", :integer, :limit => 10, :default => 0, :null
=> false
- t.column "revision", :integer, :limit => 10, :default => 0, :null
=> false
+ t.column "project_id", :integer, :default => 0, :null => false
+ t.column "revision", :integer, :default => 0, :null => false
end
add_index "benches", ["project_id"], :name =>
"project_id"
+ create_table "inputs", :force => true do |t|
+ t.column "name", :string, :limit => 128, :default =>
"noname", :null => false
+ t.column "unit", :string, :limit => 128, :default =>
"nounit", :null => false
+ t.column "value", :float, :default => 0.0, :null => false
+ t.column "bench_id", :integer, :default => 0, :null => false
+ t.column "arg_num", :integer, :limit => 8, :default => 0, :null =>
false
+ end
+
create_table "outputs", :force => true do |t|
t.column "name", :string, :limit => 128, :default =>
"noname", :null => false
t.column "value", :float, :default => 0.0, :null => false
t.column "unit", :string, :limit => 128, :default =>
"nounit", :null => false
- t.column "bench_id", :integer, :limit => 10, :default => 0, :null
=> false
+ t.column "bench_id", :integer, :default => 0, :null => false
t.column "arg_num", :integer, :limit => 8, :default => 1, :null =>
false
end
@@ -24,7 +32,7 @@
create_table "projects", :force => true do |t|
t.column "name", :string, :default => "noname", :null =>
false
- t.column "head_revision", :integer, :limit => 10, :default => 0,
:null => false
+ t.column "head_revision", :integer, :default => 0, :null => false
end
end