<commit_before># encoding: UTF-8
require 'test/unit'
require 'rubygems'
require 'bundler'
Bundler.setup
require 'shoulda'
require 'mocha'
require 'tiny_tds'

class DateTime
  def usec
    (sec_fraction * 60 * 60 * 24 * (10**6)).to_i
  end
end

TINYTDS_SCHEMAS = ['sqlserver_2000', 'sqlserver_2005', 'sqlserver_2008'].freeze

module TinyTds
  class TestCase < Test::Unit::TestCase
    
    class << self
      
      def current_schema
        ENV['TINYTDS_SCHEMA'] || 'sqlserver_2008'
      end
      
      TINYTDS_SCHEMAS.each do |schema|
        define_method "#{schema}?" do
          schema == self.current_schema
        end
      end
      
    end
    
    def test_base_tiny_tds_case ; assert(true) ; end
    
    
    protected
    
    TINYTDS_SCHEMAS.each do |schema|
      define_method "#{schema}?" do
        schema == self.class.current_schema<commit_msg>Fix the DateTime#usec helper for 1.9. I'm not sure why this needs to be different for 1.9, but I assume it's because the Rational library has been changed.<commit_after># encoding: UTF-8
require 'test/unit'
require 'rubygems'
require 'bundler'
Bundler.setup
require 'shoulda'
require 'mocha'
require 'tiny_tds'

class DateTime
  def usec
    if RUBY_VERSION >= '1.9'
      (sec_fraction * 1_000_000).to_i
    else
      (sec_fraction * 60 * 60 * 24 * (10**6)).to_i
    end
  end
end

TINYTDS_SCHEMAS = ['sqlserver_2000', 'sqlserver_2005', 'sqlserver_2008'].freeze

module TinyTds
  class TestCase < Test::Unit::TestCase
    
    class << self
      
      def current_schema
        ENV['TINYTDS_SCHEMA'] || 'sqlserver_2008'
      end
      
      TINYTDS_SCHEMAS.each do |schema|
        define_method "#{schema}?" do
          schema == self.current_schema
        end
      end
      
    end
    
    def test_base_tiny_tds_case ; assert(true) ; end
    
    
    protected
    
    TINYTDS_SCHEMAS.each do |schema|
      define_method "#{schema}?" do
        schema == self.class.current_schema
{'fraction_non_alphanumeric': 0.09695431472081219, 'fraction_numerical': 0.03299492385786802, 'mean_word_length': 2.6432532347504623, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 4, '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': '1506521', 'n_tokens_mistral': 746, 'n_tokens_neox': 686, 'n_words': 167}