This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit migration.git.tu-berlin.de (internal network only) to import your old projects to the new GitLab platform 📥

Simulations.scala 1.49 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
package de.bbisping.coupledsim.algo

import utest._
import de.bbisping.coupledsim.algo.rt2010.SchematicSimilarity
import de.bbisping.coupledsim.tool.control.StructureOperation

/**
 * Tests that all simulation algorithms compute the same maximal simulations
 * like SchematicSimilarity for the whole TestSample set.
 */

object Simulations extends TestSuite{
  
  AlgorithmLogging.loggingActive = false
  
  val cannonicalSimulations = for {
    (slug, system) <- TestSamples.samples
    val rel = new SchematicSimilarity(system).compute()
  } yield (slug, system, rel)
  
  val simulationAlgos = List[StructureOperation.StructureRelationAnalyzer](
      new StructureOperation.RefinedSimilarityAnalyzer,
      new StructureOperation.BasicSASimilarityAnalyzer,
      new StructureOperation.RefinedSASimilarityAnalyzer,
      new StructureOperation.SASimilarityAnalyzer
  )
  
  def testSimulationAlgo()(implicit path: utest.framework.TestPath) = {
    val algoSlug = path.value.last
    for {
      algo <- simulationAlgos find (_.slug == algoSlug)
      (slug, system, cannonicalRel) <- cannonicalSimulations
    } {
      val (rel, _) = algo.analyze(system)
      println(slug)
      assert(rel == cannonicalRel)
    }
  }
  
  val tests = Tests{
    "refined-similarity" - testSimulationAlgo()
    //"hhk-similarity" - testSimulationAlgo() // broken :/
    "basic-sa-similarity" - testSimulationAlgo()
    "refined-sa-similarity" - testSimulationAlgo()
    //"sa-similarity" - testSimulationAlgo() // does not yet work
  }
}