Sha256: 22b62889e8ba3be4a3ca378106a110e5f62ecb82ff9ea8ab85b466ac28bcfb88

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

#!/usr/bin/env ruby

require 'TestSetup'
require 'test/unit'
require 'rubygems'
require_gem 'fireruby'

include FireRuby

class GeneratorTest < Test::Unit::TestCase
   CURDIR  = "#{Dir.getwd}"
   DB_FILE = "#{CURDIR}#{File::SEPARATOR}generator_unit_test.fdb"
   
   def setup
      if File::exist?(DB_FILE)
         Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
      end
      @database     = Database::create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
      @connections  = []
      
      @connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
   end
   
   def teardown
      @connections.each do |cxn|
         cxn.close if cxn.open?
      end
      @connections.clear
      if File::exist?(DB_FILE)
         Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
      end
   end
   
   def test01
      assert(Generator::exists?('TEST_GEN', @connections[0]) == false)
      g = Generator::create('TEST_GEN', @connections[0])
      assert(Generator::exists?('TEST_GEN', @connections[0]))
      assert(g.last == 0)
      assert(g.next(1) == 1)
      assert(g.last == 1)
      assert(g.next(10) == 11)
      assert(g.connection == @connections[0])
      assert(g.name == 'TEST_GEN')
      
      g.drop
      assert(Generator::exists?('TEST_GEN', @connections[0]) == false)
   end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fireruby-0.3.2-powerpc-darwin test/GeneratorTest.rb
fireruby-0.3.2-mswin32 test/GeneratorTest.rb
fireruby-0.3.2-i586-linux test/GeneratorTest.rb
fireruby-0.3.1-powerpc-darwin test/GeneratorTest.rb
fireruby-0.3.1-mswin32 test/GeneratorTest.rb
fireruby-0.3.1-i586-linux test/GeneratorTest.rb
fireruby-0.3.0-powerpc-darwin test/GeneratorTest.rb
fireruby-0.3.0-mswin32 test/GeneratorTest.rb
fireruby-0.3.0-i586-linux test/GeneratorTest.rb