Sha256: bc38ba458e9b7c133467c7b1ab09b4451c6a9b5d3eb922b886edbd7c895aa33f

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Pippa::Map do

  let(:map) { Pippa::Map.zipcode_map }

  it 'should be correct width' do
    map.width.should == 1046
  end

  it 'should be correct width' do
    map.height.should == 710
  end

  it 'should have correct number of info records' do
    i = Pippa::Map.info
    i.size.should == 2
    i[:map].size.should == 30
    i[:projection].size.should == 4
  end

  it 'should have right number of zipcodes' do
    Pippa::Map.zips.size.should == 41874
  end

  # Here I'm assuming timestamp metadata chunk always has same size.
  # PNG docs are encouraging on this:
  # http://www.libpng.org/pub/png/book/chapter11.html#png.ch11.div.2
  it 'should have matching PNG format' do
    test_map = get_test_map('png')
    new_map = map.to_png
    test_map.size.should == new_map.size
    # A minor difference will occur in header due to timestamp, etc.
    diff_count(test_map, new_map).should be < 100
  end

  it 'should have matching JPG format' do
    test_map = get_test_map('jpg')
    new_map = map.to_jpg
    test_map.size.should == new_map.size
    diff_count(test_map, new_map).should be == 0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pippa-0.1.0 spec/lib/map_spec.rb