Sha256: 0e6fcb63ffa30425c309ed1ebe2d28a11e995c33cb1e644e8b4f0ab4583e3f94

Contents?: true

Size: 1.42 KB

Versions: 8

Compression:

Stored size: 1.42 KB

Contents

require 'test/unit'
class DialTest < Test::Unit::TestCase

  def initialize name
    class << self
      include Asterisk
    end
    super name
  end

	def test_protocol_sugar
    num = 1337
    name = "lordxenu"
    namesym = name.to_sym
    
    sipnum, sipname = "SIP/#{num}", "SIP/#{name}"
    iaxnum, iaxname = "IAX2/#{num}", "IAX2/#{name}"
    zapnum, zapname = "Zap/#{num}", "Zap/#{name}"
    
    sipnumtests = [SIP/num, SIP(num), SIP[num]]
    iaxnumtests = [IAX/num, IAX(num), IAX[num], IAX2/num, IAX2(num), IAX2[num]]
    zapnumtests = [ZAP/num, ZAP(num), ZAP[num], Zap/num, Zap(num), Zap[num]]
    
    sipnametests = [SIP/name, SIP(name), SIP[name], SIP/namesym, SIP(namesym), SIP[namesym]]
    iaxnametests = [IAX/name, IAX(name), IAX[name], IAX/namesym, IAX(namesym), IAX[namesym],
                    IAX2/name, IAX2(name), IAX2[name], IAX2/namesym, IAX2(namesym), IAX2[namesym]]
    zapnametests = [ZAP/name, ZAP(name), ZAP[name], ZAP/namesym, ZAP(namesym), ZAP[namesym]]
    
    sipnumtests.each do |test| assert_equal test, sipnum end
    iaxnumtests.each do |test| assert_equal test, iaxnum end
    zapnumtests.each do |test| assert_equal test, zapnum end
 
    sipnametests.each do |test| assert_equal test, sipname end
    iaxnametests.each do |test| assert_equal test, iaxname end
    zapnametests.each do |test| assert_equal test, zapname end
	end

	#def test_dialing_complex_arrays
	#end

	#def test_dialing_hashes
	#end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adhearsion-0.7.0 test/dial_test.rb
adhearsion-0.7.2 test/dial_test.rb
adhearsion-0.7.4 test/dial_test.rb
adhearsion-0.7.5 test/dial_test.rb
adhearsion-0.7.6 test/dial_test.rb
adhearsion-0.7.1 test/dial_test.rb
adhearsion-0.7.3 test/dial_test.rb
adhearsion-0.7.7 test/dial_test.rb