<commit_before>package io.coral.actors.transform

import akka.actor.{ActorSystem, Props}
import akka.testkit.{ImplicitSender, TestActorRef, TestKit}
import akka.util.Timeout
import io.coral.lib.{NotSoRandom, Random}
import org.json4s._
import org.json4s.jackson.JsonMethods._
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}

import scala.concurrent.duration._
import scala.languageFeature.postfixOps

class SampleActorSpec(_system: ActorSystem)
  extends TestKit(_system)
  with ImplicitSender
  with WordSpecLike
  with Matchers
  with BeforeAndAfterAll
  with ScalaFutures {

  def this() = this(ActorSystem("SampleActorSpec"))

  override def afterAll() {
    TestKit.shutdownActorSystem(system)
  }

  def arbitrarySampleActor(): SampleActor = {
    val json = parse(
      """{ "type": "sample",
        |  "params": { "fraction": 0.707 } }
      """.stripMargin)
    val props = SampleActor(json).get
    TestActorRef[SampleActor](props).underlyingActor
  }

  def notSoRandomSampleActor(fraction: Double, randoms: Double*): SampleActor = {
    val json = parse(
      s"""{ "type": "sample",
         |"params": { "fraction": ${fraction} } }
      """.stripMargin)<commit_msg>corrected postfix import<commit_after>package io.coral.actors.transform

import akka.actor.{ActorSystem, Props}
import akka.testkit.{ImplicitSender, TestActorRef, TestKit}
import akka.util.Timeout
import io.coral.lib.{NotSoRandom, Random}
import org.json4s._
import org.json4s.jackson.JsonMethods._
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}

import scala.concurrent.duration._
import scala.language.postfixOps

class SampleActorSpec(_system: ActorSystem)
  extends TestKit(_system)
  with ImplicitSender
  with WordSpecLike
  with Matchers
  with BeforeAndAfterAll
  with ScalaFutures {

  def this() = this(ActorSystem("SampleActorSpec"))

  override def afterAll() {
    TestKit.shutdownActorSystem(system)
  }

  def arbitrarySampleActor(): SampleActor = {
    val json = parse(
      """{ "type": "sample",
        |  "params": { "fraction": 0.707 } }
      """.stripMargin)
    val props = SampleActor(json).get
    TestActorRef[SampleActor](props).underlyingActor
  }

  def notSoRandomSampleActor(fraction: Double, randoms: Double*): SampleActor = {
    val json = parse(
      s"""{ "type": "sample",
         |"params": { "fraction": ${fraction} } }
      """.stripMargin)
{'fraction_non_alphanumeric': 0.11948676824378508, 'fraction_numerical': 0.0048115477145148355, 'mean_word_length': 4.435729847494553, 'pattern_counts': {'":': 12, '<': 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': '18958', 'n_tokens_mistral': 807, 'n_tokens_neox': 781, 'n_words': 165}