Sha256: 4ad1cf97278fdd09fa8c20671d33ae9ee325ff561f61ef2daa6216f9ebde1ec4

Contents?: true

Size: 1.68 KB

Versions: 8

Compression:

Stored size: 1.68 KB

Contents

# To change this template, choose Tools | Templates
# and open the template in the editor.


require 'test/unit'
$:.push(File.dirname(__FILE__) +'/../../test/models')
$:.push(File.dirname(__FILE__) +'/../../lib/not_relational')

require File.dirname(__FILE__) +'/../../lib/not_relational/memory_repository.rb'
require File.dirname(__FILE__) +'/../../test/models/node.rb'
ENV['NOT_RELATIONAL_ENV']='testing'

class MemoryRepositoryTest < Test::Unit::TestCase

# 500=2.64 seconds
# 500=2.9 sav index seconds
# 1.7
  def test_foo
    return
    #repo=NotRelational::MemoryRepository.new
    (0..500).each do |i|
      node= Node.fill_new_node('david', "test node #{i}", 'hello world {i}')
      node.publicRead= ((i%30)==0)
      node.isChannel=((i%20)==0)

      node.save

    end
    (0..500).each do |i|
      found= Node.find_by_public_channel(true,true)
  assert_equal(9,found.length)

    end

       NotRelational::RepositoryFactory.instance.clear
  end

#  def test_foo2
#    #repo=NotRelational::MemoryRepository.new
#    nodes=[]
#    (0..100).each do |i|
#      node= Node.fill_new_node('david', "test node #{i}", 'hello world {i}')
#      node.publicRead= ((i%3)==0)
#      node.isChannel=((i%2)==0)
#
#      node.save
#      nodes<<node
#    end
#
#    nodes.each do |n|
#
#      found= Node.find(n.id)
#      index_found=Node.find_by_public_channel(n.publicRead,n.isChannel)
#
#      assert_not_nil(found)
#      found.destroy
#      found= Node.find(n.id)
#      assert_nil(found)
#      index_found_after=Node.find_by_public_channel(n.publicRead,n.isChannel)
#      assert_equal(index_found.length-1,index_found_after.length)
#    end
#
#
#
#
#       NotRelational::RepositoryFactory.instance.clear
#  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cloudwow-not_relational-0.1.11 test/unit_tests/memory_repository_test.rb
cloudwow-not_relational-0.1.2 test/unit_tests/memory_repository_test.rb
cloudwow-not_relational-0.1.3 test/unit_tests/memory_repository_test.rb
cloudwow-not_relational-0.1.5 test/unit_tests/memory_repository_test.rb
cloudwow-not_relational-0.1.6 test/unit_tests/memory_repository_test.rb
cloudwow-not_relational-0.1.7 test/unit_tests/memory_repository_test.rb
cloudwow-not_relational-0.1.8 test/unit_tests/memory_repository_test.rb
cloudwow-not_relational-0.1.9 test/unit_tests/memory_repository_test.rb