Sha256: d32dab6cd95b3015a98a60f11f4a98d6635052810c84af7806e4481c60d4de7a

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

require 'test/unit'

TESTBIG=false

class TC_Big < Test::Unit::TestCase
  def setup
    setup_db
  end

  def teardown
    Entities.save_all
  end

  def setup_db
    dputs_func
    dputs(1) { 'Setting up big data' }
    Entities.delete_all_data()

    dputs(2) { 'Resetting SQLite' }
    SQLite.dbs_close_all
    dputs(2) { 'Loading big data' }
    MigrationVersions.create({:class_name => 'Account', :version => 2})
    MigrationVersions.create({:class_name => 'Movement', :version => 1})
    MigrationVersions.save
    FileUtils.cp('db.man', 'data/compta.db')
    SQLite.dbs_open_load_migrate
    dputs(2) { 'Finished loading' }
    Entities.save_all
    @user = Users.match_by_name('local')
  end

  def reload_all
    Entities.delete_all_data(true)
    Entities.load_all
  end

  def test_matches_speed_improved
    dputs_func
    require 'benchmark'

    ret = ''
    dputs(1){ @user.account_index}
    dputs(1) { Benchmark.measure {
      ret = Accounts.data.select { |k, v|
        v._rev_index > 14000 }.
          collect { |k, v| Accounts.get_data_instance(k) }.
          sort_by { |a| a.path }.reverse.
          collect { |a| a.to_s }.
          join("\n")
    }.to_s
    }
    dputs(1){ ret.length}
  end

  def test_matches_speed_old
    dputs_func
    dputs(1) { Benchmark.measure {
      ACaccess.accounts_fetch(@user)
    }.to_s
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
africompta-1.9.1312 test/ac_big.rb
africompta-1.9.13.pre.12 test/ac_big.rb
africompta-1.9.13.pre.11 test/ac_big.rb
africompta-1.9.13.pre.10 test/ac_big.rb
africompta-1.9.11 test/ac_big.rb
africompta-1.9.10 Test/ac_big.rb
africompta-1.9.9 Test/ac_big.rb
africompta-1.9.8 Test/ac_big.rb