<commit_before>#!/usr/bin/env ruby

require 'test/unit'
require 'jubatus/common/message_string_generator'

module Jubatus
module Common

class MessageStringGeneratorTest < Test::Unit::TestCase

  def test_empty
    gen = MessageStringGenerator.new
    gen.open("test")
    gen.close

    assert_equal("test{}", gen.to_s)
  end

  def test_one
    gen = MessageStringGenerator.new
    gen.open("test")
    gen.add("k1", "v1")
    gen.close

    assert_equal("test{k1: v1}", gen.to_s)
  end

  def test_two
    gen = MessageStringGenerator.new
    gen.open("test")
    gen.add("k1", "v1")
    gen.add("k2", "v2")
    gen.close
<commit_msg>Update test<commit_after>#!/usr/bin/env ruby

require 'test/unit'
require 'jubatus/common'

module Jubatus
module Common

class MessageStringGeneratorTest < Test::Unit::TestCase

  def test_empty
    gen = MessageStringGenerator.new
    gen.open("test")
    gen.close

    assert_equal("test{}", gen.to_s)
  end

  def test_one
    gen = MessageStringGenerator.new
    gen.open("test")
    gen.add("k1", "v1")
    gen.close

    assert_equal("test{k1: v1}", gen.to_s)
  end

  def test_two
    gen = MessageStringGenerator.new
    gen.open("test")
    gen.add("k1", "v1")
    gen.add("k2", "v2")
    gen.close

{'fraction_non_alphanumeric': 0.13552526062550121, 'fraction_numerical': 0.012830793905372895, 'mean_word_length': 3.3789473684210525, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5041746', 'n_tokens_mistral': 462, 'n_tokens_neox': 447, 'n_words': 89}