<commit_before>package org.apache.solr.common.util;

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.text.ParseException;
import java.util.Date;

import org.apache.lucene.util.LuceneTestCase;

public class TestDateUtil extends LuceneTestCase {

  public void testCurrentTime() throws ParseException {
    long now = System.currentTimeMillis();
    assertParsedDate(now, new Date(now).toString(), 1000L);
  }
  
  public void testParseDate() throws ParseException {
    assertParsedDate(1226583351000L, "Thu Nov 13 04:35:51 AKST 2008", 0L);
  }
    
  private static void assertParsedDate(long ts, String dateStr, long epsilon) throws ParseException {
    System.out.println(DateUtil.parseDate(dateStr).getTime());
    assertTrue("Incorrect parsed timestamp", Math.abs(ts - DateUtil.parseDate(dateStr).getTime()) <= epsilon);
  }

}<commit_msg>Fix broken test - sorry!<commit_after>package org.apache.solr.common.util;

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.text.ParseException;
import java.util.Date;
import java.util.Locale;

import org.apache.lucene.util.LuceneTestCase;

public class TestDateUtil extends LuceneTestCase {

  public void testDateToString() throws ParseException {
    long ts = 1226583351000L;
    assertParsedDate(ts, new Date(ts).toString());
  }
  
  public void testParseDate() throws ParseException {
    assertParsedDate(1226583351000L, "Thu Nov 13 04:35:51 AKST 2008");
  }
    
  private static void assertParsedDate(long ts, String dateStr) throws ParseException {
    long parsed = DateUtil.parseDate(dateStr).getTime();
    assertTrue(String.format(Locale.ENGLISH, "Incorrect parsed timestamp: %d != %d (%s)", ts, parsed, dateStr), Math.abs(ts - parsed) <= 1000L);
  }

}
{'fraction_non_alphanumeric': 0.08443759630200308, 'fraction_numerical': 0.02465331278890601, 'mean_word_length': 4.303921568627451, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5107159', 'n_tokens_mistral': 930, 'n_tokens_neox': 870, 'n_words': 346}