<commit_before>require 'test/unit'
$:.unshift File.join(File.dirname(__FILE__), "..", "main", "lib")

require 'expression.rb'

=begin rdoc
  This set of test cases will shake down the BooleanExpression class which can take expressions such as
  those defined in a rule set like:  (httpd AND htpasswd) OR (executables AND versionstring)
  and a hash of name/value pairs and evalue the rule.  These test cases check evaluation results as
  well as the translated ruby evaluation string after the value substitutions have been made by the 
  BooleanExpression class
=end

class TcExpressions < Test::Unit::TestCase
  
  def setup
    @booleval = BooleanExpression.new
  end
  
  def teardown
    
  end
  
=begin rdoc
  test to see if expression evaluation string is correct after the translation (evaluation) has occurred.
  The BooleanExpression class will take an expression and a hash of name/value pairs and turn it into
  a ruby expression that can be evaluated to true or false.  The ruby expression is really the intermediate
  value and typically isn't ever used by an application, but it does determine the outcome of the evaluation
  so it's critical to make sure the string substitutions were done correctly
=end
  def test_expression_translation
     name_value_pairs = { "httpd" => true, "htpasswd" => true, "executables" => true, "versionstring" => true }
     test_expression = "(httpd AND htpasswd) OR (executables AND versionstring)"
     
     @booleval.evaluate( test_expression, name_value_pairs )
     assert_equal(eval("(true && true) || (true && true)"), eval(@booleval.expression) )
#     assert_equal("(true && true) || (true && true)", eval(@booleval.expression) )
     
     name_value_pairs["httpd"] = false
     name_value_pairs["versionstring"] = false
     
     @booleval.evaluate( test_expression, name_value_pairs )
     assert_equal( eval("(false && true) || (true && false)"), eval(@booleval.expression) ) 
     
  end
<commit_msg>intentionally making the build fail to test CCrb<commit_after>require 'test/unit'
$:.unshift File.join(File.dirname(__FILE__), "..", "main", "lib")

require 'expression.rb'

=begin rdoc
  This set of test cases will shake down the BooleanExpression class which can take expressions such as
  those defined in a rule set like:  (httpd AND htpasswd) OR (executables AND versionstring)
  and a hash of name/value pairs and evalue the rule.  These test cases check evaluation results as
  well as the translated ruby evaluation string after the value substitutions have been made by the 
  BooleanExpression class
=end

class TcExpressions < Test::Unit::TestCase
  
  def setup
    @booleval = BooleanExpression.new
  end
  
  def teardown
    
  end
  
=begin rdoc
  test to see if expression evaluation string is correct after the translation (evaluation) has occurred.
  The BooleanExpression class will take an expression and a hash of name/value pairs and turn it into
  a ruby expression that can be evaluated to true or false.  The ruby expression is really the intermediate
  value and typically isn't ever used by an application, but it does determine the outcome of the evaluation
  so it's critical to make sure the string substitutions were done correctly
=end
  def test_expression_translation
assert false
     name_value_pairs = { "httpd" => true, "htpasswd" => true, "executables" => true, "versionstring" => true }
     test_expression = "(httpd AND htpasswd) OR (executables AND versionstring)"
     
     @booleval.evaluate( test_expression, name_value_pairs )
     assert_equal(eval("(true && true) || (true && true)"), eval(@booleval.expression) )
#     assert_equal("(true && true) || (true && true)", eval(@booleval.expression) )
     
     name_value_pairs["httpd"] = false
     name_value_pairs["versionstring"] = false
     
     @booleval.evaluate( test_expression, name_value_pairs )
     assert_equal( eval("(false && true) || (true && false)"), eval(@booleval.expression) ) 
     
  end

{'fraction_non_alphanumeric': 0.08396178984414278, 'fraction_numerical': 0.0, 'mean_word_length': 4.049492385786802, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '4905032', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1105, 'n_words': 443}