<commit_before>package stats

import org.scalacheck.Gen
import org.scalacheck.Properties
import org.scalacheck.Prop.forAll
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

object StatsSpec extends Properties("Stats") with Cleanup {

  val stats = Stats()
  val reciepts = Reciepts(stats.address)

  def cleanup() {
    reciepts.close()
    stats.close()
  }

  property("incrs") = forAll(Gen.posNum[Int]) { (i: Int) =>
    val key = "test"
    Await.result(for {
      sent <- stats.counter(key).incr(i)
      str  <- reciepts()
    } yield {
      sent && str == s"$key:$i|c"
    }, 3.seconds)
  }
}<commit_msg>props for other ops<commit_after>package stats

import org.scalacheck.Gen
import org.scalacheck.Properties
import org.scalacheck.Prop.forAll
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

object StatsSpec extends Properties("Stats") with Cleanup {

  val stats = Stats()
  val reciepts = Reciepts(stats.address)

  def cleanup() {
    reciepts.close()
    stats.close()
  }

  property("counter#incrs") = forAll(Gen.posNum[Int]) { (i: Int) =>
    val key = "test"
    Await.result(for {
      sent <- stats.counter(key).incr(i)
      str  <- reciepts()
    } yield {
      sent && str == s"$key:$i|c"
    }, 1.second)
  }

  property("counter#decrs") = forAll(Gen.posNum[Int]) { (i: Int) =>
    val key = "test"
    Await.result(for {
      sent <- stats.counter(key).decr(i)
      str  <- reciepts()
    } yield {
      sent && str == s"$key:-$i|c"
    }, 1.second)
  }

  property("set#adds") = forAll(Gen.posNum[Int]) { (i: Int) =>
    val key = "test"
    Await.result(for {
      sent <- stats.set[Int](key).add(i)
      str  <- reciepts()
    } yield {
      sent && str == s"$key:$i|s"
    }, 1.second)
  }

  property("gauge#adds") = forAll(Gen.posNum[Int]) { (i: Int) =>
    val key = "test"
    Await.result(for {
      sent <- stats.gauge[Int](key).add(i)
      str  <- reciepts()
    } yield {
      sent && str == s"$key:$i|g"
    }, 1.second)
  }

  
}
{'fraction_non_alphanumeric': 0.16338028169014085, 'fraction_numerical': 0.002347417840375587, 'mean_word_length': 2.9317343173431736, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 8, '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': '643347', 'n_tokens_mistral': 801, 'n_tokens_neox': 765, 'n_words': 148}