<commit_before>require 'exempi/consts'

require 'minitest/autorun'

describe "DateTime struct wrapper" do
  it "should be able to construct an XmpDateTime struct manually" do
    date = Exempi::XmpDateTime.new
    date[:year]  = 2012
    date[:month] = 9
    date[:day]   = 7
  end

  it "should be able to create an XmpDateTime struct from a DateTime object" do
    today = DateTime.now
    date = Exempi::XmpDateTime.from_datetime today

    date[:year].must_equal today.year
  end

  it "should be able to create an XmpDateTime struct from a string" do
    today = '2012-09-07'
    date = Exempi::XmpDateTime.from_datetime today

    date[:year].must_equal 2012
  end

  it "should be able to translate XmpDateTime structs into DateTime objects" do
    today = DateTime.now
    date = Exempi::XmpDateTime.from_datetime today

    date.to_datetime.strftime('%I:%M:%S %p').must_equal today.strftime('%I:%M:%S %p')
  end
end<commit_msg>XmpDateTime test should compare actual objects<commit_after>require 'exempi/consts'

require 'minitest/autorun'

describe "DateTime struct wrapper" do
  it "should be able to construct an XmpDateTime struct manually" do
    date = Exempi::XmpDateTime.new
    date[:year]  = 2012
    date[:month] = 9
    date[:day]   = 7
  end

  it "should be able to create an XmpDateTime struct from a DateTime object" do
    today = DateTime.now
    date = Exempi::XmpDateTime.from_datetime today

    date[:year].must_equal today.year
  end

  it "should be able to create an XmpDateTime struct from a string" do
    today = '2012-09-07'
    date = Exempi::XmpDateTime.from_datetime today

    date[:year].must_equal 2012
    date[:month].must_equal 9
    date[:day].must_equal 7
  end

  it "should be able to translate XmpDateTime structs into DateTime objects" do
    today = DateTime.now
    date = Exempi::XmpDateTime.from_datetime today

    date.to_datetime.must_equal today
  end
end
{'fraction_non_alphanumeric': 0.08563968668407311, 'fraction_numerical': 0.019843342036553524, 'mean_word_length': 3.605769230769231, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2810984', 'n_tokens_mistral': 645, 'n_tokens_neox': 598, 'n_words': 196}