Sha256: d64c9fb9823b5be07b73f22e0363dde3d69b4c0ca8fa953c5a86f55f1e910cbb

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8

require 'helper'
require "test/unit"
require "string/mismatch.rb"

#describe String, "for mismatch check" do
class TC_String_mismatch < Test::Unit::TestCase
  def setup
    @s00 = 'abcdefghij'
    @s01 = 'あいうえお'
  end

  #it "should be indicated first mismatch char index" do
  def test_mismatch
    assert_equal(nil, @s00.mismatch( "abcdefghij" )   )
    assert_equal( 0 , @s00.mismatch( "_bcdefghij" )   )
    assert_equal( 4 , @s00.mismatch( "abcd_fghij" )   )
    assert_equal(10 , @s00.mismatch( "abcdefghijk" )  )
    assert_equal( 3 , @s00.mismatch( "abc" )          )

    assert_equal(nil, @s01.mismatch( "あいうえお" )   )
    assert_equal( 0 , @s01.mismatch( "_いうえお" )    )
    assert_equal( 4 , @s01.mismatch( "あいうえ_" )    )
    assert_equal( 5 , @s01.mismatch( "あいうえおか" ) )
    assert_equal( 3 , @s01.mismatch( "あいう" )       )
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
builtinextension-0.1.4 test/string/test_mismatch.rb
builtinextension-0.1.3 test/test_string_mismatch.rb