Permalink
Browse files

removed duplicate specs

  • Loading branch information...
1 parent d106519 commit 64f84b49fde6ab5b607aa2df09757d772e813745 Macario committed Oct 19, 2008
Showing with 0 additions and 825 deletions.
  1. +0 −98 spec/extensions_spec.rb
  2. +0 −9 spec/helper.rb
  3. +0 −177 spec/operation_ugens_spec.rb
  4. +0 −47 spec/synth_def_ugen.rb
  5. +0 −122 spec/synthdef_spec.rb
  6. +0 −146 spec/ugen_operations_spec.rb
  7. +0 −226 spec/ugen_spec.rb
View
@@ -1,98 +0,0 @@
-require File.join(File.expand_path(File.dirname(__FILE__)),"helper")
-
-require "#{LIB_DIR}/audio/ugen_operations"
-require "#{LIB_DIR}/extensions"
-require "ruby2ruby"
-
-describe Numeric do
-
- before :all do
- @bin_op = mock('binop')
- BinaryOpUgen = mock( 'BinaryOpUgen', :new => @bin_on )
- @ugen = mock( 'ugen' )
- Ugen = mock( 'Ugen', :new => @ugen)
-
-
- end
-
- it "shoud have an scalar rate" do
- 1.rate.should eql(:scalar)
- end
-
- it "should have an scalar rate" do
- 100.0.rate.should == :scalar
- end
-
- it "sum as usual" do
- (100 + 100).should == 200
- end
-
-end
-
-describe Array, "monkey patches" do
- describe "#collect_with_index" do
- it do
- [].should respond_to( :collect_with_index )
- end
-
- it "should return an array the same size as the original" do
- [1,2,3,4].collect_with_index{ nil }.should have( 4 ).items
- end
-
- it "should collect_with_index" do
- array = %w(a, b, c, d)
- array.collect_with_index{ |element, index| [index, element] }.should eql( [0,1,2,3].zip( array ) )
- end
-
- it "should sum with Ugen"
-
- end
-end
-
-describe Proc do
- describe "#argument_names" do
-
- it do
- Proc.new{}.should respond_to( :argument_names )
- end
-
- it "should get empty array if proc has no args" do
- Proc.new{}.argument_names.should eql( [] )
- end
-
- it "should get one argument name" do
- Proc.new{ |arg| }.argument_names.should eql( [ :arg ] )
- end
-
- it "should get arg names with several args" do
- Proc.new{ |arg, arg2, arg3| }.argument_names.should eql( [ :arg, :arg2, :arg3 ] )
- end
- end
-end
-
-describe Array do
- describe "#wrap_to" do
-
- it do
- Array.new.should respond_to( :wrap_to )
- end
-
- it "should wrap_to!" do
- [1,2].wrap_to!(4).should == [1,2,1,2]
- end
-
- it do
- Array.new.should respond_to( :wrap_to )
- end
-
- it "should return self if the passed size is the same as self.size" do
- a = [1,2,3,4]
- a.wrap_to( 4 ).should == a
- end
-
- it "should etc..."
-
- end
-end
-
-
View
@@ -1,9 +0,0 @@
-require "rubygems"
-require "spec"
-require 'yaml'
-
-LIB_DIR = File.join( File.expand_path(File.dirname(__FILE__) ), '..', 'lib', 'scruby')
-
-
-
-
@@ -1,177 +0,0 @@
-require File.join(File.expand_path(File.dirname(__FILE__)),"helper")
-require 'yaml'
-
-require "#{LIB_DIR}/audio/ugens/ugen_operations"
-require "#{LIB_DIR}/audio/ugens/ugen"
-require "#{LIB_DIR}/extensions"
-require "#{LIB_DIR}/audio/ugens/operation_ugens"
-
-include Scruby
-include Audio
-include Ugens
-include OperationUgens
-
-describe UnaryOpUgen do
- RATES = [ :scalar, :demand, :control, :audio ]
-
- before do
- @scalar = mock( 'ugen', :rate => :scalar )
- @demand = mock( 'ugen', :rate => :demand )
- @control = mock( 'ugen', :rate => :control )
- @audio = mock( 'ugen', :rate => :audio )
- end
-
- describe UnaryOpUgen do
-
- before do
- @op = UnaryOpUgen.new( :neg, @audio )
- end
-
- it "should return special index" do
- UnaryOpUgen.new( :neg, @audio ).special_index.should == 0
- UnaryOpUgen.new( :bitNot, @audio ).special_index.should == 4
- UnaryOpUgen.new( :abs, @audio ).special_index.should == 5
- UnaryOpUgen.new( :asFloat, @audio ).special_index.should == 6
- end
-
- it "should accept just one input" do
- lambda{ UnaryOpUgen.new(:neg, @audio, @demand) }.should raise_error( ArgumentError )
- end
-
- it "should just accept defined operators" # do
- # lambda{ UnaryOpUgen.new(:not_operator, @audio) }.should raise_error( ArgumentError )
- # end
-
- it "should get max rate" do
- UnaryOpUgen.send(:get_rate, @scalar, @demand ).should == :demand
- UnaryOpUgen.send(:get_rate, @scalar, @demand, @audio ).should == :audio
- UnaryOpUgen.send(:get_rate, @scalar, [@demand, [@control, @audio]] ).should == :audio
- end
-
- it do
- UnaryOpUgen.new(:neg, @audio).should be_instance_of(UnaryOpUgen)
- end
-
- it "should set rate" do
- UnaryOpUgen.new(:neg, @audio).rate.should == :audio
- UnaryOpUgen.new(:neg, @scalar).rate.should == :scalar
- end
-
- it "should set operator" do
- UnaryOpUgen.new(:neg, @audio).operator.should == :neg
- end
- end
-
- describe BinaryOpUgen do
-
- before do
- @arg_array = [@audio, [@scalar, @audio, [@demand, [@control, @demand]]] ]
- @op_arr = BinaryOpUgen.new(:+, @audio, @arg_array )
- end
-
- it "should return special index" do
- BinaryOpUgen.new( :+, @audio, @audio ).special_index.should eql(0)
- BinaryOpUgen.new( :-, @audio, @audio ).special_index.should eql(1)
- BinaryOpUgen.new( :*, @audio, @audio ).special_index.should eql(2)
- BinaryOpUgen.new( :/, @audio, @audio ).special_index.should eql(4)
- end
-
- it "should accept exactly two inputs" do
- lambda{ BinaryOpUgen.new(:+, @audio) }.should raise_error( ArgumentError )
- lambda{ BinaryOpUgen.new(:+, @audio, @demand, @demand) }.should raise_error( ArgumentError )
- end
-
- it "should have correct inputs and operator when two inputs" do
- arr = BinaryOpUgen.new( :+, @audio, @demand )
- arr.inputs.should == [@audio, @demand]
- arr.operator.should == :+
- arr.rate.should == :audio
- end
-
- it "should accept array as input" do
- BinaryOpUgen.new(:+, @audio, [@audio, @scalar] ).should be_instance_of(Array)
- end
-
- it "should return an array of UnaryOpUgens" do
- @op_arr.flatten.map { |op| op.should be_instance_of(BinaryOpUgen) }
- end
-
- it "should set rate for all operations" do
- @op_arr.flatten.map { |op| op.rate.should eql(:audio) }
- end
-
- it "should set operator for all operations" do
- @op_arr.flatten.map { |op| op.operator.should eql(:+) }
- end
-
- it "should set correct inputs when provided an array" do
- arr = BinaryOpUgen.new(:+, @control, [@audio, @scalar] )
- arr.first.inputs.should == [@control, @audio]
- arr.last.inputs.should == [@control, @scalar]
- end
-
- it "should create the correct number of operations" do
- @op_arr.flatten.size.should eql( @arg_array.flatten.size )
- end
-
- it "should replicate the array passed" do
- last = lambda do |i|
- if i.instance_of?( BinaryOpUgen)
- i.inputs.first.should == @audio
- i.inputs.last
- else
- i.map{ |e| last.call(e) }
- end
- end
- last.call(@op_arr).should == @arg_array
- end
-
- it "should accept numbers as inputs" do
- arr = BinaryOpUgen.new(:+, @control, [100, 200.0] )
- arr.first.inputs.should == [@control, 100]
- arr.last.inputs.should == [@control, 200.0]
- BinaryOpUgen.new(:+, 100, @control ).inputs.should == [100, @control]
- end
-
- it "should accept array as input" do
- arr = BinaryOpUgen.new(:+, [@audio, @scalar], @control )
- arr.first.inputs.should == [@audio, @control]
- arr.last.inputs.should == [@scalar, @control]
- end
- end
-
- describe MulAdd do
- it do
- MulAdd.new( @audio, 0.5, 0.5 ).should be_instance_of(MulAdd)
- end
-
- it do
- MulAdd.new( @audio, 0.5, 0.5 ).rate.should == :audio
- end
-
- it do
- MulAdd.new( @audio, 0.5, 0.5 ).inputs.should == [@audio, 0.5, 0.5]
- end
-
- it "should not be instance of MulAdd" do
- unary_op = mock('neg')
- mult = mock('mult')
- minus = mock('minus')
- plus = mock('plus')
-
- @audio.should_receive( :neg ).and_return( unary_op )
- @audio.should_receive( :* ).and_return( mult )
- add = mock( '0.5', :- => minus, :zero? => false )
- @audio.should_receive( :+ ).and_return( plus )
-
- MulAdd.new( @audio, 0, 0.5 ).should be_instance_of( Float )
- MulAdd.new( @audio, 1, 0 ).should == @audio
- MulAdd.new( @audio, -1, 0 ).should == unary_op
- MulAdd.new( @audio, 0.5, 0 ).should == mult
- MulAdd.new( @audio, -1, add ).should == minus
- MulAdd.new( @audio, 1, 0.5 ).should == plus
- end
- end
-
-end
-
View
@@ -1,47 +0,0 @@
-require File.join( File.expand_path(File.dirname(__FILE__)),"helper")
-
-
-require "#{LIB_DIR}/audio/ugens/ugen_operations"
-require "#{LIB_DIR}/audio/ugens/ugen"
-require "#{LIB_DIR}/extensions"
-require "#{LIB_DIR}/audio/synthdef"
-# require "#{LIB_DIR}/control_name"
-require "#{LIB_DIR}/audio/ugens/ugen"
-
-Dir.glob( File.join(LIB_DIR, "*.rb") ).each{ |f| require f } #require all files in lib/audio
-
-include Scruby
-include Audio
-include Ugens
-
-
-describe "building ugen graph" do
- before do
- @sdef = SynthDef.new( :name ) do end
- @ugen = Ugen.new( :audio, 100, 200 )
- end
-
- it do
- @sdef.should respond_to(:build_ugen_graph)
- end
-
- it "should return nil #sytnth_def" do
- @ugen.synthdef.should eql(nil)
- end
-
- it "should set @sdef #synthdef=" do
- function = lambda{}
- Ugen.should_receive( :synthdef= ).with( @sdef )
- Ugen.should_receive( :synthdef= ).with( nil )
- @sdef.build_ugen_graph( function )
- end
-
- it "should set synthdef to the synth def for ugens instantiated inside ugen graph" do
- function = lambda { Ugen.new( :audio, 100, 200 ).synthdef.should eql( @sdef ) }
- @sdef.build_ugen_graph function
- Ugen.new( :audio, 100, 200 ).synthdef.should eql( nil )
- end
-
-
-
-end
Oops, something went wrong.

0 comments on commit 64f84b4

Please sign in to comment.