<commit_before>#this file uses macros! won't parse in normal ruby
macro assert(cond)
    if $Debug
      if RedParse::OpNode===cond and /\A(?:[=!][=~]|[<>]=?|===)\Z/===cond.op
        left=cond.left; op=cond.op; right=cond.right
        :(fail 'expected '+^left.unparse+"(==#{^left}) to be "+
               ^op+" "+^right.unparse+"(==#{^right})" unless ^cond)    
      else
        :(fail "I expected that #{:(^^cond)}" unless ^cond)
      end
    end
end


#assert_equal... bah, who needs it?

def test_assert
  a=1 
  b=2

  assert a     #ok
  assert a!=b  #ok

  begin
    assert(a==b) #oops, fails. msg="expected a(==1) to be == b(==2)"
  rescue Exception=>e
    assert("expected a(==1) to be == b(==2)"== e.message) #better be ok
  else puts "exception expected but was not seen"
  end

  begin
    assert(!a) #oops, fails. msg="expected nil, but was not true"
  rescue Exception=>e
    assert("I expected that !a"== e.message) #better be ok
    #ok, that message didn't make a lot of sense...
  else puts "exception expected but was not seen"
  end
  
  puts "all assertions passed"
end<commit_msg>old condition dissector added back in a comment (it ought to have worked....)<commit_after>#this file uses macros! won't parse in normal ruby
macro assert(cond)
    if $Debug
      if RedParse::OpNode===cond and /\A(?:[=!][=~]|[<>]=?|===)\Z/===cond.op
        #left,op,right=*cond
        left=cond.left; op=cond.op; right=cond.right
        :(fail 'expected '+^left.unparse+"(==#{^left}) to be "+
               ^op+" "+^right.unparse+"(==#{^right})" unless ^cond)    
      else
        :(fail "I expected that #{:(^^cond)}" unless ^cond)
      end
    end
end


#assert_equal... bah, who needs it?

def test_assert
  a=1 
  b=2

  assert a     #ok
  assert a!=b  #ok

  begin
    assert(a==b) #oops, fails. msg="expected a(==1) to be == b(==2)"
  rescue Exception=>e
    assert("expected a(==1) to be == b(==2)"== e.message) #better be ok
  else puts "exception expected but was not seen"
  end

  begin
    assert(!a) #oops, fails. msg="expected nil, but was not true"
  rescue Exception=>e
    assert("I expected that !a"== e.message) #better be ok
  else puts "exception expected but was not seen"
  end
  
  puts "all assertions passed"
end
{'fraction_non_alphanumeric': 0.17177097203728361, 'fraction_numerical': 0.005326231691078562, 'mean_word_length': 2.9683098591549295, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2593645', 'n_tokens_mistral': 806, 'n_tokens_neox': 779, 'n_words': 257}