-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: π add and pass tests for real tree of chawathe generator
- Loading branch information
1 parent
5f2f34d
commit c07dd9b
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
core/src/test/kotlin/editscript/ChawatheScriptGeneratorTest2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package editscript | ||
|
||
import kotlinx.coroutines.runBlocking | ||
import org.junit.jupiter.api.parallel.Execution | ||
import org.junit.jupiter.api.parallel.ExecutionMode | ||
import shared.realTree1 | ||
import tw.xcc.gumtree.api.tree.TreeMappingStorage | ||
import tw.xcc.gumtree.editscript.ChawatheScriptGenerator | ||
import tw.xcc.gumtree.matchers.UniversalMatcher | ||
import tw.xcc.gumtree.model.GumTree | ||
import tw.xcc.gumtree.model.MappingStorage | ||
import kotlin.test.BeforeTest | ||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
@Execution(ExecutionMode.CONCURRENT) | ||
internal class ChawatheScriptGeneratorTest2 { | ||
private lateinit var generator: ChawatheScriptGenerator | ||
private lateinit var storage: TreeMappingStorage<GumTree> | ||
|
||
@BeforeTest | ||
fun setUp() { | ||
storage = MappingStorage() | ||
} | ||
|
||
@Test | ||
fun `test generate for sample tree 1`() { | ||
val (tree1, tree2) = realTree1 | ||
|
||
val matcher = UniversalMatcher() | ||
|
||
runBlocking { | ||
matcher.match(tree1, tree2, storage) | ||
generator = ChawatheScriptGenerator(tree1, tree2, storage) | ||
generator.generateActions() | ||
assertTrue(tree1 isIsomorphicTo tree2) | ||
} | ||
} | ||
} |