import munit.FunSuite

object SharedTestData {
  @volatile private var currentPunctaj = 0

  def punctaj: Int = currentPunctaj

  def addPoints(points: Int): Unit = synchronized {
    currentPunctaj += points
  }

  def setPoints(value: Int): Unit = synchronized {
    currentPunctaj = value
  }

  def resetPoints(): Unit = synchronized {
    currentPunctaj = 0
  }
}

class AllPartsSuite extends munit.FunSuite {
  override def beforeAll(): Unit = {
    SharedTestData.resetPoints()
    println("Incepe testarea ...")
  }


  override def afterAll(): Unit = {
    val score = SharedTestData.punctaj
    println(s"\n===== SCOR FINAL: $score/100 =====\n")
    if (score == 100) println("Felicitari, ai rezolvat tot! Asteptam sa ne explici cum ai facut :)")
  }

    Part1Tests.register(this)
    Part2Tests.register(this)
    Part3Tests.register(this)

}