forked from AlchemistSimulator/Alchemist
-
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 regression test for detecting error in Constructor overloading
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
alchemist-loading/src/test/kotlin/it/unibo/alchemist/test/TestConstructorOverloading.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,17 @@ | ||
package it.unibo.alchemist.test | ||
|
||
import another.location.MyTestEnv | ||
import io.kotest.core.spec.style.StringSpec | ||
import io.kotest.matchers.nulls.beNull | ||
import io.kotest.matchers.shouldBe | ||
import io.kotest.matchers.shouldNot | ||
import io.kotest.matchers.types.instanceOf | ||
import it.unibo.alchemist.test.AlchemistTesting.loadAlchemistFromResource | ||
|
||
class TestConstructorOverloading : StringSpec({ | ||
"constructor overloading should not be ambiguous during loading" { | ||
val loader = loadAlchemistFromResource("regression/2024-depots-ambiguous-constructors.yml") | ||
loader shouldNot beNull() | ||
loader.getDefault<Nothing, Nothing>().environment shouldBe instanceOf(MyTestEnv::class) | ||
} | ||
}) |
18 changes: 18 additions & 0 deletions
18
alchemist-loading/src/test/resources/regression/2024-depots-ambiguous-constructors.yml
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,18 @@ | ||
incarnation: protelis | ||
|
||
deployments: | ||
agent1: | ||
type: Point | ||
parameters: [-7, -6] | ||
programs: | ||
- time-distribution: 3 | ||
type: Event | ||
actions: | ||
- type: EuclideanConfigurableMoveNode | ||
parameters: | ||
routing-strategy: | ||
type: StraightLine | ||
target-selection-strategy: | ||
type: GoTo | ||
parameters: [7, 6] | ||
speed: 0.005 |