Skip to content

Commit

Permalink
Use class instead of object for Fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnaldo committed Sep 2, 2024
1 parent 0507f4c commit c09d6c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 34 deletions.
40 changes: 7 additions & 33 deletions src/main/scala/esmeta/es/util/fuzzer/Fuzzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,7 @@ import scala.collection.mutable.{ListBuffer, Map => MMap}
import scala.collection.parallel.CollectionConverters._
import scala.util.*

// TODO(@hyp3rflow): why object?
/** ECMAScript program fuzzer with ECMA-262 */
object Fuzzer {
def apply(
cfg: CFG,
logInterval: Option[Int] = Some(600), // default is 10 minutes.
debug: Int = NO_DEBUG, // 2: all, 1: partial, 0: no-debug
stdOut: Boolean = false,
timeLimit: Option[Int] = None, // time limitation for each evaluation
trial: Option[Int] = None, // `None` denotes no bound
duration: Option[Int] = None, // `None` denotes no bound
init: Option[String] = None, // initial pool directory path given by user
kFs: Int = 0,
cp: Boolean = false,
): Coverage = new Fuzzer(
cfg,
logInterval,
debug,
stdOut,
timeLimit,
trial,
duration,
init,
kFs,
cp,
).result

// debugging levels
val ALL = 2
val PARTIAL = 1
val NO_DEBUG = 0
}

/** extensible helper of ECMAScript program fuzzer with ECMA-262 */
class Fuzzer(
cfg: CFG,
logInterval: Option[Int] = Some(600), // default is 10 minutes.
Expand Down Expand Up @@ -405,3 +372,10 @@ class Fuzzer(
)

}

object Fuzzer {
// debugging levels
val ALL = 2
val PARTIAL = 1
val NO_DEBUG = 0
}
2 changes: 1 addition & 1 deletion src/main/scala/esmeta/phase/Fuzz.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ case object Fuzz extends Phase[CFG, Coverage] {
duration = config.duration,
kFs = config.kFs,
cp = config.cp,
)
).result

for (dirname <- config.out) cov.dumpToWithDetail(dirname)

Expand Down

0 comments on commit c09d6c7

Please sign in to comment.