<commit_before>package com.thetestpeople.trt.analysis

import org.junit.runner.RunWith
import org.scalatest._
import org.scalatest.junit.JUnitRunner
import com.thetestpeople.trt.model._
import com.thetestpeople.trt.model.impl.DummyData
import com.github.nscala_time.time.Imports._

object QuickTestAnalyserTest {

  val Tolerance = 0.001

}

@RunWith(classOf[JUnitRunner])
class QuickTestAnalyserTest extends FlatSpec with Matchers {

  import QuickTestAnalyserTest._

  "Quick Test Analyser" should "let you compute results over time" in {

    val testAnalyser =
      quickTestAnalyser(
        pass(2.days.ago),
        pass(4.days.ago),
        fail(6.days.ago))

    testAnalyser.ignoreExecutionsAfter(1.day.ago)

    val Some(block1) = testAnalyser.getMostRecentPassFailBlock
    block1.passed should be(true)
    block1.count should be(2)
    days(block1.duration) should be(2.0 +- Tolerance)

    testAnalyser.ignoreExecutionsAfter(3.days.ago)

    val Some(block2) = testAnalyser.getMostRecentPassFailBlock
    block2.passed should be(true)
    block2.count should be(1)
    block2.duration.getStandardDays should be(0)

    testAnalyser.ignoreExecutionsAfter(5.days.ago)

    val Some(block3) = testAnalyser.getMostRecentPassFailBlock
    block3.passed should be(false)
    block3.count should be(1)
    block3.duration.getStandardDays should be(0)

  }<commit_msg>fix test which breaks across DST shift boundaries<commit_after>package com.thetestpeople.trt.analysis

import org.junit.runner.RunWith
import org.scalatest._
import org.scalatest.junit.JUnitRunner
import com.thetestpeople.trt.model._
import com.thetestpeople.trt.model.impl.DummyData
import com.github.nscala_time.time.Imports._

object QuickTestAnalyserTest {

  val Tolerance = 0.001

}

@RunWith(classOf[JUnitRunner])
class QuickTestAnalyserTest extends FlatSpec with Matchers {

  import QuickTestAnalyserTest._

  "Quick Test Analyser" should "let you compute results over time" in {

    val testAnalyser =
      quickTestAnalyser(
        pass((2 * 24).hours.ago),
        pass((4 * 24).hours.ago),
        fail((6 * 24).hours.ago))

    testAnalyser.ignoreExecutionsAfter(1.day.ago)

    val Some(block1) = testAnalyser.getMostRecentPassFailBlock
    block1.passed should be(true)
    block1.count should be(2)
    days(block1.duration) should be(2.0 +- Tolerance)

    testAnalyser.ignoreExecutionsAfter(3.days.ago)

    val Some(block2) = testAnalyser.getMostRecentPassFailBlock
    block2.passed should be(true)
    block2.count should be(1)
    block2.duration.getStandardDays should be(0)

    testAnalyser.ignoreExecutionsAfter(5.days.ago)

    val Some(block3) = testAnalyser.getMostRecentPassFailBlock
    block3.passed should be(false)
    block3.count should be(1)
    block3.duration.getStandardDays should be(0)

  }
{'fraction_non_alphanumeric': 0.0906827880512091, 'fraction_numerical': 0.02275960170697013, 'mean_word_length': 4.077617328519856, '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': '5043527', 'n_tokens_mistral': 968, 'n_tokens_neox': 927, 'n_words': 180}