forked from ftsrg/theta
-
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.
Added unittest to new xsts functionalities
- Loading branch information
Showing
4 changed files
with
66 additions
and
1 deletion.
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
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
...nalysis/src/test/kotlin/hu/bme/mit/theta/xsts/analysis/XstsCombineExtractUtilsUnitTest.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,35 @@ | ||
/* | ||
* Copyright 2024 Budapest University of Technology and Economics | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package hu.bme.mit.theta.xsts.analysis | ||
|
||
import hu.bme.mit.theta.analysis.pred.PredState | ||
import hu.bme.mit.theta.analysis.unit.UnitPrec | ||
import hu.bme.mit.theta.analysis.unit.UnitState | ||
import org.junit.jupiter.api.Test | ||
|
||
class XstsCombineExtractUtilsUnitTest { | ||
|
||
val dataState = PredState.of() | ||
val controlState = XstsState.of(UnitState.getInstance(), true, false) | ||
val xstsState = XstsState.of(dataState, true, false) | ||
|
||
@Test | ||
fun `Utils work as expected`() { | ||
assert(xstsCombineStates(controlState, dataState) == xstsState) | ||
assert(xstsExtractControlState(xstsState) == controlState) | ||
assert(xstsExtractDataState(xstsState) == dataState) | ||
assert(xstsExtractControlPrec(UnitPrec.getInstance()) == UnitPrec.getInstance()) | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ts-analysis/src/test/kotlin/hu/bme/mit/theta/xsts/analysis/XstsControlInitFuncUnitTest.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,30 @@ | ||
/* | ||
* Copyright 2024 Budapest University of Technology and Economics | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package hu.bme.mit.theta.xsts.analysis | ||
|
||
import hu.bme.mit.theta.analysis.expl.ExplPrec | ||
import hu.bme.mit.theta.analysis.unit.UnitState | ||
import org.junit.jupiter.api.Test | ||
|
||
class XstsControlInitFuncUnitTest { | ||
|
||
@Test | ||
fun `Returns single unitstate`() { | ||
val result = xstsControlInitFunc<ExplPrec>().getInitStates(ExplPrec.empty()) | ||
|
||
assert(result.size == 1) | ||
assert(result.single().state == UnitState.getInstance()) | ||
} | ||
} |