<commit_before>require 'spec_helper'

describe YAMG::Icon do

  ICONS_PATH = Dir.pwd + '/spec/icons/'
  OUT_PATH = Dir.pwd + '/spec/out/'

  before do
    FileUtils.rm_rf OUT_PATH
    FileUtils.mkdir OUT_PATH
  end

  it 'should outputs a png file the size I want' do
    YAMG::Icon.new(ICONS_PATH, 16).write_out(OUT_PATH + 'foo.png')
  end

  it 'should have a nice find icon 16' do
    expect(YAMG).to receive(:load_images).with('foo')
                     .and_return(['16.png', '32.png', '64.png'])
    icon = YAMG::Icon.new('foo', 16)
    expect(icon.find_closest_gte_icon).to eq('16.png')
  end

  it 'should have a nice find icon 48' do
    expect(YAMG).to receive(:load_images).with('foo')
                     .and_return(['16.png', '32.png', '64.png'])
    icon = YAMG::Icon.new('foo', 48)
    expect(icon.find_closest_gte_icon).to eq('64.png')
  end

  it 'should have a nice find icon 256' do
    expect(YAMG).to receive(:load_images).with('foo')
                     .and_return(['16.png', '32.png', '64.png'])
    icon = YAMG::Icon.new('foo', 256)
    expect(icon.find_closest_gte_icon).to eq('64.png')
  end

  it 'should have a nice find icon mixed names' do
    expect(YAMG).to receive(:load_images).with('foo')
                     .and_return(['xx16.png', '32oo.png', 'x64o.png'])
    icon = YAMG::Icon.new('foo', 64)
    expect(icon.find_closest_gte_icon).to eq('x64o.png')
  end
end
<commit_msg>nice icon spec<commit_after>require 'spec_helper'

describe YAMG::Icon do

  ICONS_PATH = Dir.pwd + '/spec/icons/'
  OUT_PATH = Dir.pwd + '/spec/out/'

  before do
    FileUtils.rm_rf OUT_PATH
    FileUtils.mkdir OUT_PATH
  end

  it 'should outputs a png file the size I want' do
    YAMG::Icon.new(ICONS_PATH, 16).image(OUT_PATH + 'foo.png')
    expect(File.exist?(OUT_PATH + 'foo.png')).to be_truthy
    expect(File.size(OUT_PATH + 'foo.png')).to eq(524)
  end

  it 'should outputs a png file the size I want 2' do
    YAMG::Icon.new(ICONS_PATH, 256).image(OUT_PATH + 'foo.png')
    expect(File.exist?(OUT_PATH + 'foo.png')).to be_truthy
    expect(File.size(OUT_PATH + 'foo.png')).to eq(5230)
  end

  it 'should outputs a png file the size I want 2 with round' do
    YAMG::Icon.new(ICONS_PATH, 256, :round).image(OUT_PATH + 'foo.png')
    expect(File.exist?(OUT_PATH + 'foo.png')).to be_truthy
    expect(File.size(OUT_PATH + 'foo.png')).to eq(6596) # transparency channel
  end

  it 'should have a nice find icon 16' do
    expect(YAMG).to receive(:load_images).with('foo')
                     .and_return(['16.png', '32.png', '64.png'])
    icon = YAMG::Icon.new('foo', 16)
    expect(icon.find_closest_gte_icon).to eq('16.png')
  end

  it 'should have a nice find icon 48' do
    expect(YAMG).to receive(:load_images).with('foo')
                     .and_return(['16.png', '32.png', '64.png'])
    icon = YAMG::Icon.new('foo', 48)
    expect(icon.find_closest_gte_icon).to eq('64.png')
  end

  it 'should have a nice find icon 256' do
    expect(YAMG).to receive(:load_images).with('foo')
                     .and_return(['16.png', '32.png', '64.png'])
    icon = YAMG::Icon.new('foo', 256)
    expect(icon.find_closest_gte_icon).to eq('64.png')
  end

  it 'should have a nice find icon mixed names' do
    expect(YAMG).to receive(:load_images).with('foo')
                     .and_return(['xx16.png', '32oo.png', 'x64o.png'])
    icon = YAMG::Icon.new('foo', 64)
    expect(icon.find_closest_gte_icon).to eq('x64o.png')
  end
end

{'fraction_non_alphanumeric': 0.16103896103896104, 'fraction_numerical': 0.03434343434343434, 'mean_word_length': 3.092089728453365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5863819', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1290, 'n_words': 287}