-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33c1b10
commit e35d62e
Showing
13 changed files
with
419 additions
and
544 deletions.
There are no files selected for viewing
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
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
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,52 @@ | ||
package org.usvm | ||
|
||
import io.mockk.mockk | ||
import org.junit.jupiter.api.Assertions.assertSame | ||
import org.junit.jupiter.api.Test | ||
import org.usvm.statistics.RootNode | ||
import kotlin.test.assertTrue | ||
|
||
class PathTests { | ||
@Test | ||
fun smokeTest() { | ||
val initialState = mockk<TestState>() | ||
val fork = mockk<TestState>() | ||
|
||
val root = RootNode<TestState, Int>() | ||
|
||
val firstRealNode = root.propagateState(1, initialState) | ||
|
||
val updatedInitialState = firstRealNode.propagateState(statement = 2, initialState) | ||
val forkedState = firstRealNode.propagateState(statement = 3, fork) | ||
|
||
assertTrue { root.children.size == 1 } | ||
assertTrue { root.children.values.single() == firstRealNode } | ||
|
||
assertTrue { firstRealNode.states.isEmpty() } | ||
assertTrue { firstRealNode.children.size == 2 } | ||
|
||
assertTrue { updatedInitialState.states.single() == initialState } | ||
assertTrue { forkedState.states.single() == fork } | ||
|
||
assertTrue { updatedInitialState.children.isEmpty() } | ||
assertTrue { forkedState.children.isEmpty() } | ||
} | ||
|
||
@Test | ||
fun severalStatesInOneNode() { | ||
val firstState = mockk<TestState>() | ||
val secondState = mockk<TestState>() | ||
|
||
val root = RootNode<TestState, Int>() | ||
|
||
val firstRealNode = root.propagateState(1, firstState) | ||
|
||
val updatedFirstState = firstRealNode.propagateState(statement = 2, firstState) | ||
val updatedSecondState = firstRealNode.propagateState(statement = 2, secondState) | ||
|
||
assertSame(updatedFirstState, updatedSecondState) | ||
|
||
assertTrue { updatedFirstState.children.isEmpty() } | ||
assertTrue { updatedFirstState.states.size == 2 } | ||
} | ||
} |
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
Oops, something went wrong.