Skip to content

Commit

Permalink
fix(tests): Lower tests size (#1018)
Browse files Browse the repository at this point in the history
* Lower tests size

* Remove prints
  • Loading branch information
InversionSpaces authored Dec 14, 2023
1 parent bb013d7 commit 6732f8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
16 changes: 10 additions & 6 deletions io/src/test/scala/aqua/ImportsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher

implicit override val generatorDrivenConfig =
// Tests here are lightweight, so we can afford to run more of them
PropertyCheckConfiguration(minSuccessful = 500)
PropertyCheckConfiguration(minSuccessful = 500, sizeRange = 64)

val shortAlphaNumStr = for {
length <- Gen.choose(1, 10)
chars <- Gen.listOfN(5, Gen.alphaNumChar)
chars <- Gen.listOfN(length, Gen.alphaNumChar)
} yield chars.mkString

val fileNameWithExt = Gen
Expand All @@ -29,7 +29,7 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
Gen.sized(size =>
for {
segments <- Gen.listOfN(
size / 5,
size,
Gen.oneOf(
shortAlphaNumStr,
Gen.oneOf(".", "..")
Expand All @@ -49,7 +49,7 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
val simplePath: Gen[Path] = Gen.sized(size =>
for {
segments <- Gen.listOfN(
size / 5,
size,
shortAlphaNumStr
)
suffix <- Gen.option(
Expand Down Expand Up @@ -88,8 +88,12 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
}.map(Imports.apply)
)

val nonEmptyAsciiPrintableStr: Gen[String] =
Gen.nonEmptyListOf(Gen.asciiPrintableChar).map(_.mkString)
val nonEmptyAsciiPrintableStr: Gen[String] = Gen.sized(size =>
for {
head <- Gen.asciiPrintableChar
tail <- Gen.listOfN(size, Gen.asciiPrintableChar)
} yield (head +: tail).mkString
)

"Imports" should "resolve relative import first" in {
forAll(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
res.checkTokenLoc(main, "fooResult", 0, ScalarType.string) shouldBe true
res.checkLocations("fooResult", 0, 1, main) shouldBe true

res.checkTokenLoc(main, "someVar", 0, LiteralType.string, None, true) shouldBe true
res.checkTokenLoc(main, "someVar", 0, LiteralType.string, None) shouldBe true
res.checkLocations("someVar", 0, 1, main) shouldBe true
res.checkTokenLoc(main, "someVar", 2, LiteralType.unsigned) shouldBe true
res.checkLocations("someVar", 2, 3, main) shouldBe true
Expand All @@ -221,8 +221,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
"someField",
0,
ScalarType.u32,
Some("Ab.someField"),
true
Some("Ab.someField")
) shouldBe true

// this is tokens from imports, if we will use `FileSpan.F` file names will be different
Expand All @@ -233,8 +232,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
"more_call",
0,
ArrowType(NilType, NilType),
Some("OneMore.more_call"),
true
Some("OneMore.more_call")
) shouldBe true
res.checkTokenLoc(
secondImport,
Expand All @@ -253,8 +251,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
ProductType.labelled(("someVar", ScalarType.string) :: Nil),
ProductType(ScalarType.string :: Nil)
),
None,
true
None
) shouldBe true
res.checkTokenLoc(firstImport, "someVar", 0, ScalarType.string) shouldBe true

Expand Down

0 comments on commit 6732f8f

Please sign in to comment.