class TestUtilBasic

Public Instance Methods

test_hash() click to toggle source
# File vendor/qwik/lib/qwik/util-basic.rb, line 129
def test_hash
  # test_hash_to_query_string
  assert_equal 'k=v', {:k=>'v'}.to_query_string
  assert_equal 'k1=v1&k2=v2', {:k1=>'v1', :k2=>'v2'}.to_query_string
end
test_icase_hash() click to toggle source
# File vendor/qwik/lib/qwik/util-basic.rb, line 120
def test_icase_hash
  ih = IcaseHash.new
  ih['T'] = 1
  assert_equal true, ih.include?('t')
  assert_equal 1, ih['t']
  ih.delete('t')
  assert_equal false, ih.include?('t')
end
test_integer() click to toggle source
# File vendor/qwik/lib/qwik/util-basic.rb, line 101
def test_integer
  assert_equal '12,345', 12345.commify
  assert_equal '123,456,789', 123456789.commify

  assert_equal '1KB', (1024+1).byte_format
  assert_equal '2MB', (2*1024*1024+2).byte_format
  assert_equal '3GB', (3*1024*1024*1024+3).byte_format
  assert_equal '4TB', (4*1024*1024*1024*1024+4).byte_format
end
test_iscase_array() click to toggle source
# File vendor/qwik/lib/qwik/util-basic.rb, line 111
def test_iscase_array
  iar = IcaseArray.new
  iar << 'T'
  assert_equal true, iar.include?('T')
  assert_equal true, iar.include?('t')
  iar.delete('t')
  assert_equal false, iar.include?('t')
end
test_nil() click to toggle source
# File vendor/qwik/lib/qwik/util-basic.rb, line 97
def test_nil
  assert_equal true, nil.empty?
end