Skip to content

Commit

Permalink
len value must be larger that 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeho committed Mar 6, 2024
1 parent 4c69c6d commit fbc2bd4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/main/scala/fhetest/Command.scala
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ case object CmdTest extends BackendCommand("test") {
println("=" * 80)
if !config.silent then {
println("Program : " + program.content)
}
if config.debug then {
println("-" * 80)
println("LibConfig : " + program.libConfig.stringify())
println("-" * 80)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/fhetest/Generate/AbsProgram.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import fhetest.Utils.*

case class AbsProgram(
absStmts: List[AbsStmt],
libConfig: LibConfig = LibConfig(),
libConfig: LibConfig,
) {
val len = libConfig.len
val bound = libConfig.bound
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/fhetest/Generate/LibConfigGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def generateLibConfig(encType: ENC_TYPE): LibConfig = {
SecurityLevel.values(Random.nextInt(SecurityLevel.values.length))
val randomScalingTechnique =
ScalingTechnique.values(Random.nextInt(ScalingTechnique.values.length))
val randomLenOpt: Option[Int] = Some(Random.nextInt(100000))
// len must be larger than 0
val randomLenOpt: Option[Int] = Some(Random.between(1, 100000 + 1))
val randomBoundOpt: Option[Int | Double] = randomScheme match {
case Scheme.BFV | Scheme.BGV =>
Some(Random.nextInt(Int.MaxValue))
Expand Down
5 changes: 4 additions & 1 deletion src/main/scala/fhetest/Phase/Check.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,14 @@ case object Check {
)
if (toJson)
dumpResult(program, i, checkResult, sealVersion, openfheVersion)
if (debug) {
println(s"Program $i:")
}
Some(program, checkResult)
} else {
if (debug) {
println(
s"Program $i is skipped due to HE overflow check: $overflowBound",
s"Program $i is skipped due to HE overflow check: 2^$overflowBound",
)
}
None
Expand Down

0 comments on commit fbc2bd4

Please sign in to comment.