<commit_before># encoding: UTF-8

require 'spec_helper'

include Polygonize

describe "Polygonize" do
  context "空テキスト" do
    it "空テキストは何も返さない" do
      "".coordinates.should eql ""
    end
  end
  
  context "テキスト" do
    txt = "こんにちは"
    it "はxy座標の文字列を返す" do
      txt.coordinates.should eql "48,83 48,147 48,107 48,97 48,111"
    end

    it "要素は偶数個である" do
      ar = txt.coordinates.split(" ").inject([]) { |mem, x| mem << x.split(",") }
      (ar.flatten.size%2).should eql 0
    end
    
    it "各要素は255(FF)以下である" do
      txt.coordinates.split(" ").flatten.reject! { |x| x.to_i < 255}
    end
  end

  context "1バイトテキスト" do
    txt_e = "x"
    it "ゼロで補完する" do
      txt_e.coordinates.split(",")[1].should eql "0"
    end
    
    it "x = 0x78" do
      txt_e.coordinates.split(",")[0].should eql "78".hex.to_s<commit_msg>fix a test<commit_after># encoding: UTF-8

require 'spec_helper'

include Polygonize

describe "Polygonize" do
  context "空テキスト" do
    it "空テキストは何も返さない" do
      "".coordinates.should eql ""
    end
  end
  
  context "テキスト" do
    txt = "こんにちは"
    it "はxy座標の文字列を返す" do
      txt.coordinates.should eql "48,83 48,147 48,107 48,97 48,111"
    end

    it "要素は偶数個である" do
      ar = txt.coordinates.split(" ").inject([]) { |mem, x| mem << x.split(",") }
      (ar.flatten.size%2).should eql 0
    end
    
    it "各要素は255(FF)以下である" do
      ret = txt.coordinates.split(" ").flatten.reject! { |x| x.to_i < 255}
      ret.should eql []
    end
  end

  context "1バイトテキスト" do
    txt_e = "x"
    it "ゼロで補完する" do
      txt_e.coordinates.split(",")[1].should eql "0"
    end
    
    it "x = 0x78" do
      txt_e.coordinates.split(",")[0].should eql "78".hex.to_s
{'fraction_non_alphanumeric': 0.14937759336099585, 'fraction_numerical': 0.04860699466508595, 'mean_word_length': 2.4804123711340207, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6779604', 'n_tokens_mistral': 823, 'n_tokens_neox': 752, 'n_words': 162}