From 552ab70e50da5d92c23f370ca8ca6856d7c95606 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 23 Mar 2021 19:58:29 -0400 Subject: [PATCH] Removed unused Transition.isValid. --- .../src/xyz/colinholzman/makina/Transition.kt | 3 -- .../xyz/colinholzman/makina/TransitionTest.kt | 30 +++++++++---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/makina-compiler/src/xyz/colinholzman/makina/Transition.kt b/makina-compiler/src/xyz/colinholzman/makina/Transition.kt index 29119a9..bab382b 100644 --- a/makina-compiler/src/xyz/colinholzman/makina/Transition.kt +++ b/makina-compiler/src/xyz/colinholzman/makina/Transition.kt @@ -3,9 +3,6 @@ package xyz.colinholzman.makina import xyz.colinholzman.makina.State.Companion.getLCCA data class Transition(val source: State, val target: State) { - fun isValid(): Boolean { - return source.isLeafState() && target.isLeafState() - } fun getEntrySet(): List { return (listOf(target) + target.getProperAncestors(listOf(source, target).getLCCA())).reversed() } diff --git a/makina-compiler/test/xyz/colinholzman/makina/TransitionTest.kt b/makina-compiler/test/xyz/colinholzman/makina/TransitionTest.kt index 3aadb0b..947a97f 100644 --- a/makina-compiler/test/xyz/colinholzman/makina/TransitionTest.kt +++ b/makina-compiler/test/xyz/colinholzman/makina/TransitionTest.kt @@ -3,29 +3,29 @@ package xyz.colinholzman.makina import org.junit.jupiter.api.Test import org.junit.jupiter.api.Assertions.* +import xyz.colinholzman.makina.TestStates.Companion.s1 +import xyz.colinholzman.makina.TestStates.Companion.s11 +import xyz.colinholzman.makina.TestStates.Companion.s111 +import xyz.colinholzman.makina.TestStates.Companion.s12 +import xyz.colinholzman.makina.TestStates.Companion.s122 +import xyz.colinholzman.makina.TestStates.Companion.s2 +import xyz.colinholzman.makina.TestStates.Companion.s21 internal class TransitionTest { - @Test - fun isValid() { - assertFalse(Transition(TestStates.s111, TestStates.s2).isValid()) - assertFalse(Transition(TestStates.s11, TestStates.s21).isValid()) - assertTrue(Transition(TestStates.s111, TestStates.s21).isValid()) - } - @Test fun getEntrySet() { - var transition = Transition(TestStates.s111, TestStates.s122) - assertEquals(listOf(TestStates.s12, TestStates.s122), transition.getEntrySet()) - transition = Transition(TestStates.s111, TestStates.s21) - assertEquals(listOf(TestStates.s2, TestStates.s21), transition.getEntrySet()) + var transition = Transition(s111, s122) + assertEquals(listOf(s12, s122), transition.getEntrySet()) + transition = Transition(s111, s21) + assertEquals(listOf(s2, s21), transition.getEntrySet()) } @Test fun getExitSet() { - var transition = Transition(TestStates.s111, TestStates.s122) - assertEquals(listOf(TestStates.s111, TestStates.s11), transition.getExitSet()) - transition = Transition(TestStates.s111, TestStates.s21) - assertEquals(listOf(TestStates.s111, TestStates.s11, TestStates.s1), transition.getExitSet()) + var transition = Transition(s111, s122) + assertEquals(listOf(s111, s11), transition.getExitSet()) + transition = Transition(s111, s21) + assertEquals(listOf(s111, s11, s1), transition.getExitSet()) } } \ No newline at end of file