<commit_before># ****************************************************************************
#
# Copyright (c) Microsoft Corporation. 
#
# This source code is subject to terms and conditions of the Microsoft Public License. A 
# copy of the license can be found in the License.html file at the root of this distribution. If 
# you cannot locate the  Microsoft Public License, please send an email to 
# <EMAIL>. By using this source code in any fashion, you are agreeing to be bound 
# by the terms of the Microsoft Public License.
#
# You must not remove this notice, or any other, from this software.
#
#
# ****************************************************************************

require "../util/assert.rb"

require "mscorlib"

def test_stringbuilder
    x = System::Text::StringBuilder.new
    x.Append("abc")
    x.Append("def")
    x.Append(100)
    x.Insert(3, "012")
    
    assert_equal(x.ToString, System::String::Concat("abc012def100"))
    
    x.Capacity = 20
    assert_equal(x.Capacity, 20)
    assert_equal(x.Length, 12)
end

def test_string
    a = System::Char::Parse("a")
    b = System::Char::Parse("b")
    x = System::String.new(a, 2)
    y = System::String.new(b, 3)
    
    str = System::String
    assert_equal(str.Concat(x, y), System::String::Concat("aabbb"))
    
    assert_equal(str.Compare(x, y), -1)
    assert_equal(str.Compare(y, x), 1)
    assert_equal(str.Compare(x, x), 0)
end 

def test_field
    # const field
    assert_equal(System::Int32.MaxValue, 2147483647)
    # enum
    assert_equal(System::DayOfWeek.Sunday.ToString().to_str, 'Sunday')
    # readonly field
    assert_equal(System::DateTime.MaxValue.ToString().to_str, '12/31/9999 11:59:59 PM')
    
    assert_raise(NoMethodError) { print System::Int32.MaxValue2 }
    
    # setting to a read only field raises NoMethodError
    assert_raise(NoMethodError) { System::Int32.MaxValue = 5 }
    assert_raise(NoMethodError) { System::DayOfWeek.Sunday = 5 }
    assert_raise(NoMethodError) { System::DateTime.MaxValue = 5 }
    
    # TODO: set field test (need a type with a writable static field)<commit_msg>basic string specs to remove test_basic.rb<commit_after># ****************************************************************************
#
# Copyright (c) Microsoft Corporation. 
#
# This source code is subject to terms and conditions of the Microsoft Public License. A 
# copy of the license can be found in the License.html file at the root of this distribution. If 
# you cannot locate the  Microsoft Public License, please send an email to 
# <EMAIL>. By using this source code in any fashion, you are agreeing to be bound 
# by the terms of the Microsoft Public License.
#
# You must not remove this notice, or any other, from this software.
#
#
# ****************************************************************************

require "../util/assert.rb"

require "mscorlib"

def test_field
    # const field
    assert_equal(System::Int32.MaxValue, 2147483647)
    # enum
    assert_equal(System::DayOfWeek.Sunday.ToString().to_str, 'Sunday')
    # readonly field
    assert_equal(System::DateTime.MaxValue.ToString().to_str, '12/31/9999 11:59:59 PM')
    
    assert_raise(NoMethodError) { print System::Int32.MaxValue2 }
    
    # setting to a read only field raises NoMethodError
    assert_raise(NoMethodError) { System::Int32.MaxValue = 5 }
    assert_raise(NoMethodError) { System::DayOfWeek.Sunday = 5 }
    assert_raise(NoMethodError) { System::DateTime.MaxValue = 5 }
    
    # TODO: set field test (need a type with a writable static field)
{'fraction_non_alphanumeric': 0.1827354260089686, 'fraction_numerical': 0.0257847533632287, 'mean_word_length': 4.127873563218391, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '132140', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1025, 'n_words': 323}