<commit_before>require File.join(File.dirname(__FILE__), 'test_helper')

class FloatTest < Test::Unit::TestCase
  
  ERROR = 0.1e-5
  
  def test_Float
    flt = Genera.Float(1.0)
    assert_kind_of Float, flt
    assert_kind_of FloatLiteral, flt.node
  end
  
  def test_generate
    flt = Genera.Float(1.0)
    context = test_context
    val = flt.generate(context)
    assert_kind_of LLVM::Float, val
  end
  
  def test_addition
    lhs = Genera.Float(1.0)
    rhs = Genera.Float(2.0)
    sum = lhs + rhs
    assert_kind_of Float, sum
    
    assert_floating_op "addition" do |a, b|
      a + b<commit_msg>More slack for Float rounding error. Comparing powf() with Ruby's Float#% is a bad idea. Ruby uses double.<commit_after>require File.join(File.dirname(__FILE__), 'test_helper')

class FloatTest < Test::Unit::TestCase
  
  ERROR = 0.1e-4
  
  def test_Float
    flt = Genera.Float(1.0)
    assert_kind_of Float, flt
    assert_kind_of FloatLiteral, flt.node
  end
  
  def test_generate
    flt = Genera.Float(1.0)
    context = test_context
    val = flt.generate(context)
    assert_kind_of LLVM::Float, val
  end
  
  def test_addition
    lhs = Genera.Float(1.0)
    rhs = Genera.Float(2.0)
    sum = lhs + rhs
    assert_kind_of Float, sum
    
    assert_floating_op "addition" do |a, b|
      a + b
{'fraction_non_alphanumeric': 0.09733840304182509, 'fraction_numerical': 0.016730038022813688, 'mean_word_length': 2.9050445103857565, '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': '2085531', 'n_tokens_mistral': 499, 'n_tokens_neox': 488, 'n_words': 116}