Best Mockito-kotlin code snippet using test.Open.double
ADTestHelpers.kt
Source:ADTestHelpers.kt
...179 "is_anomaly": {180 "type": "boolean"181 },182 "anomaly_score": {183 "type": "double"184 },185 "anomaly_grade": {186 "type": "double"187 },188 "confidence": {189 "type": "double"190 },191 "feature_data": {192 "type": "nested",193 "properties": {194 "feature_id": {195 "type": "keyword"196 },197 "data": {198 "type": "double"199 }200 }201 },202 "data_start_time": {203 "type": "date",204 "format": "strict_date_time||epoch_millis"205 },206 "data_end_time": {207 "type": "date",208 "format": "strict_date_time||epoch_millis"209 },210 "execution_start_time": {211 "type": "date",212 "format": "strict_date_time||epoch_millis"...
BucketOpenListTest.kt
Source:BucketOpenListTest.kt
1package edu.unh.cs.searkt.util2import org.junit.Test3import java.util.*4import kotlin.test.assertEquals5import kotlin.test.assertNotEquals6import kotlin.test.assertTrue7class BucketOpenListTest {8 private data class Node(var f: Double, var g: Double, var h: Double, val state: Int) : BucketNode {9 override fun getFValue(): Double = f10 override fun getGValue(): Double = g11 override fun getHValue(): Double = h12 override fun isOpen(): Boolean {13 return index != -114 }15 override fun setOpenLocation(value: Int) {16 index = value17 }18 private var index = -119 }20 @Test21 fun insertSameElement() {22 val element = Node(5.0, 3.0, 2.0, 0)23 val bop = BucketOpenList<BucketOpenListTest.Node>(1.0)24 for (i in 1 until 15) {25 bop.add(element)26 }27 println(bop)28 assertTrue(bop.getBucket(element) != null)29 assertEquals(bop.getBucket(element)!!.g, element.g, "element.g ${element.g}")30 assertEquals(bop.getBucket(element)!!.h, element.h, "element.h ${element.h}")31 }32 @Test33 fun insertDifferentElements() {34 val bop = BucketOpenList<BucketOpenListTest.Node>(1.0)35 (1 until 15).forEach { i ->36 val element = Node(i + 1.0, i.toDouble(), 1.0, 0)37 bop.add(element)38 assertTrue(bop.getBucket(element) != null)39 assertEquals(i, bop.numberOfBuckets)40 assertEquals(i, bop.size)41 assertEquals(bop.getBucket(element)!!.g, element.g, "element.g ${element.g}")42 assertEquals(bop.getBucket(element)!!.h, element.h, "element.h ${element.h}")43 assertEquals(2.0, bop.minFValue)44 }45 }46 @Test47 fun insertOneRemoveOne() {48 val bop = BucketOpenList<BucketOpenListTest.Node>(1.0)49 val element = Node(5.0, 3.0, 2.0, 0)50 assertTrue { bop.minFValue == Double.MAX_VALUE }51 bop.add(element)52 assertTrue { bop.minFValue == 5.0 }53 val removedElement = bop.chooseNode()54 assertTrue { bop.minFValue == Double.MAX_VALUE }55 assertEquals(element, removedElement, "element $element | removedElement $removedElement")56 }57 @Test58 fun insertFiveDecreasingFMin() {59 var size = 160 val bop = BucketOpenList<BucketOpenListTest.Node>(1.0)61 intArrayOf(5, 4, 3, 2, 1).forEach { i ->62 val element = Node(i + 1.0, i.toDouble(), 1.0, 0)63 bop.add(element)64 assertEquals(size, bop.size)65 assertEquals(bop.minFValue, i.toDouble() + 1, "minFValue ${bop.minFValue} | i: ${i + 1}")66 size++67 }68 }69 @Test70 fun insertRemoveFiveDecreasing() {71 var size = 172 val bop = BucketOpenList<BucketOpenListTest.Node>(1.0)73 intArrayOf(5, 4, 3, 2, 1).forEach { i ->74 val element = Node(i + 1.0, i.toDouble(), 1.0, 0)75 bop.add(element)76 assertEquals(size, bop.size)77 assertEquals(bop.minFValue, i.toDouble() + 1, "minFValue ${bop.minFValue} | i: ${i + 1}")78 size++79 }80 println(bop)81 intArrayOf(5, 4, 3, 2, 1).forEach { _ ->82 val removedElement = bop.chooseNode()83 println(removedElement)84 assertNotEquals(removedElement!!.getFValue(), bop.minFValue)85 }86 }87 @Test88 fun addRemoveRandom() {89 val rng = Random(1L)90 val bop = BucketOpenList<BucketOpenListTest.Node>(1.0)91 (1 until 25).forEach {92 val randomDouble = (rng.nextDouble() * 100) % 2593 val anotherRandomDouble = (rng.nextDouble() * 100) % 1094 val element = Node(randomDouble, anotherRandomDouble, randomDouble - anotherRandomDouble, rng.nextInt())95 bop.add(element)96 }97 println(bop)98 (1 until 25).forEach {99 println(bop)100 println(bop.chooseNode())101 println("##$it##")102 }103 }104 @Test105 fun addRemoveSameNodes() {106 val bop = BucketOpenList<BucketOpenListTest.Node>(1.0)107 val element = Node(5.0, 4.0, 1.0, 0)108 val element2 = Node(4.0, 2.0, 2.0, 0)109 val element3 = Node(4.0, 3.0, 1.0, 1)110 val element4 = Node(3.0, 1.0, 2.0, 3)111 val element5 = Node(5.0, 3.0, 2.0, 1)112 (1 until 10).forEach {113 bop.add(element)114 bop.add(element2)115 bop.add(element3)116 bop.add(element4)117 bop.add(element5)118 }119 assertTrue { bop.minFValue == 3.0 }120 (1 until 10).forEach {121 assertEquals(bop.minFValue, 3.0)122 val removedElement = bop.chooseNode()123 assertTrue { removedElement!!.getFValue() == 3.0 }124 assertTrue { removedElement!!.getGValue() == 1.0 }125 assertTrue { removedElement!!.getHValue() == 2.0 }126 }127 assertEquals(4.0, bop.minFValue)128 (1 until 10).forEach {129 assertEquals(bop.minFValue, 4.0)130 val removedElement = bop.chooseNode()131 assertTrue { removedElement!!.getFValue() == 4.0 }132 assertTrue { removedElement!!.getGValue() == 2.0 }133 assertTrue { removedElement!!.getHValue() == 2.0 }134 }135 assertEquals(bop.minFValue, 4.0)136 (1 until 10).forEach {137 assertEquals(bop.minFValue, 4.0)138 val removedElement = bop.chooseNode()139 assertTrue { removedElement!!.getFValue() == 4.0 }140 assertTrue { removedElement!!.getGValue() == 3.0 }141 assertTrue { removedElement!!.getHValue() == 1.0 }142 }143 assertEquals(bop.minFValue, 5.0)144 (1 until 10).forEach {145 assertEquals(bop.minFValue, 5.0)146 val removedElement = bop.chooseNode()147 assertTrue { removedElement!!.getFValue() == 5.0 }148 assertTrue { removedElement!!.getGValue() == 3.0 }149 assertTrue { removedElement!!.getHValue() == 2.0 }150 }151 assertEquals(bop.minFValue, 5.0)152 (1 until 10).forEach {153 assertEquals(bop.minFValue, 5.0)154 val removedElement = bop.chooseNode()155 assertTrue { removedElement!!.getFValue() == 5.0 }156 assertTrue { removedElement!!.getGValue() == 4.0 }157 assertTrue { removedElement!!.getHValue() == 1.0 }158 }159 assertTrue { bop.minFValue == Double.MAX_VALUE }160 assertTrue { !bop.isNotEmpty() }161 (1 until 10).forEach {162 bop.add(element)163 bop.add(element2)164 bop.add(element3)165 bop.add(element4)166 bop.add(element5)167 }168 assertTrue { bop.minFValue == 3.0 }169 println(bop)170 }171 @Test172 fun replacementTest() {173 val bop = BucketOpenList<BucketOpenListTest.Node>(1.0)174 val element = Node(5.0, 4.0, 1.0, 0)175 val element2 = Node(4.0, 2.0, 2.0, 0)176 val element3 = Node(4.0, 3.0, 1.0, 1)177 val element4 = Node(3.0, 1.0, 2.0, 3)178 val element5 = Node(5.0, 3.0, 2.0, 1)179 bop.add(element)180 assertTrue { bop.getBucket(element)!!.nodes.first() == element }181 bop.add(element3)182 assertTrue { bop.getBucket(element3)!!.nodes.first() == element3 }183 bop.replace(element3, element2)184 assertTrue { bop.getBucket(element3)!!.nodes.size == 0 }185 assertTrue { bop.getBucket(element2)!!.nodes.first() == element2 }186 bop.add(element4)187 assertTrue { bop.getBucket(element4)!!.nodes.first() == element4 }188 bop.add(element5)189 assertTrue { bop.getBucket(element5)!!.nodes.first() == element5 }190 bop.replace(element5,element)191 println(bop)192 assertTrue { bop.getBucket(element5)!!.nodes.size == 0 }193 }194}...
LockFsmTests.kt
Source:LockFsmTests.kt
...61 fail("Expected an exception")62 } catch (x: Throwable) {63 println("Expected:$x")64 // then65 assertEquals("Already double locked", x.message)66 }67 assertTrue { lock.locked == 2 }68 }69 @Test70 fun testPlainCreationOfFsm() {71 // given72 val builder = AnyStateMachineBuilder<LockStates, LockEvents, Lock>(73 LockStates.values().toSet(),74 LockEvents.values().toSet()75 )76 builder.initialState {77 when (locked) {78 0 -> UNLOCKED79 1 -> LOCKED80 2 -> DOUBLE_LOCKED81 else -> error("Invalid state locked=$locked")82 }83 }84 builder.transition(LOCKED, UNLOCK, UNLOCKED) {85 unlock()86 }87 builder.transition(LOCKED, LOCK, DOUBLE_LOCKED) {88 doubleLock()89 }90 builder.transition(DOUBLE_LOCKED, UNLOCK, LOCKED) {91 doubleUnlock()92 }93 builder.transition(DOUBLE_LOCKED, LOCK) {94 error("Already double locked")95 }96 builder.transition(UNLOCKED, LOCK, LOCKED) {97 lock()98 }99 builder.transition(UNLOCKED, UNLOCK) {100 error("Already unlocked")101 }102 val definition = builder.complete()103 // when104 val lock = Lock()105 val fsm = definition.create(lock)106 // then107 verifyLockFSM(fsm, lock)108 }109 @Test110 fun testDslCreationOfFsm() {111 // given112 val definition = io.jumpco.open.kfsm.stateMachine(113 LockStates.values().toSet(),114 LockEvents.values().toSet(),115 Lock::class116 ) {117 initialState {118 when (locked) {119 0 -> UNLOCKED120 1 -> LOCKED121 2 -> DOUBLE_LOCKED122 else -> error("Invalid state locked=$locked")123 }124 }125 whenState(LOCKED) {126 onEvent(LOCK to DOUBLE_LOCKED) {127 doubleLock()128 }129 onEvent(UNLOCK to UNLOCKED) {130 unlock()131 }132 }133 whenState(DOUBLE_LOCKED) {134 onEvent(UNLOCK to LOCKED) {135 doubleUnlock()136 }137 onEvent(LOCK) {138 error("Already double locked")139 }140 }141 whenState(UNLOCKED) {142 onEvent(LOCK to LOCKED) {143 lock()144 }145 onEvent(UNLOCK) {146 error("Already unlocked")147 }148 }149 }.build()150 // when151 val lock = Lock()152 val fsm = definition.create(lock)...
EstatisticasSimplesTest.kt
Source:EstatisticasSimplesTest.kt
...3import junit.framework.TestCase4import std.compatibility.*5public open class EstatisticasSimplesTest() : TestCase("estName") {6 open public fun testDeveCalcularValorMinimoEntreDoisValores() : Unit {7 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl)8 var valorMinimoCalculado : Double = EstatisticasSimples.calculaValorMinimo(valoresDeEntrada)9 Assert.assertEquals(5.dbl, valorMinimoCalculado, 0.dbl)10 }11 open public fun testDeveCalcularValorMinimoEntreTresValores() : Unit {12 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 2.dbl)13 var valorMinimoCalculado : Double = EstatisticasSimples.calculaValorMinimo(valoresDeEntrada)14 Assert.assertEquals(2.dbl, valorMinimoCalculado, 0.dbl)15 }16 open public fun testdeveCalcularValorMinimoEntreQuatroValores() : Unit {17 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 2.dbl, 15.dbl)18 var valorMinimoCalculado : Double = EstatisticasSimples.calculaValorMinimo(valoresDeEntrada)19 Assert.assertEquals(2.dbl, valorMinimoCalculado, 0.dbl)20 }21 open public fun testdeveCalcularValorMinimoEntreCincoValores() : Unit {22 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 2.dbl, 15.dbl, 1.98)23 var valorMinimoCalculado : Double = EstatisticasSimples.calculaValorMinimo(valoresDeEntrada)24 Assert.assertEquals(1.98, valorMinimoCalculado, 0.dbl)25 }26 open public fun testdeveCalcularValorMaximoEntreDoisValores() : Unit {27 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl)28 var valorMaximoCalculado : Double = EstatisticasSimples.calculaValorMaximo(valoresDeEntrada)29 Assert.assertEquals(9.dbl, valorMaximoCalculado, 0.dbl)30 }31 open public fun testdeveCalcularValorMaximoEntreTresValores() : Unit {32 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 50.dbl, 2.dbl)33 var valorMaximoCalculado : Double = EstatisticasSimples.calculaValorMaximo(valoresDeEntrada)34 Assert.assertEquals(50.dbl, valorMaximoCalculado, 0.dbl)35 }36 open public fun testdeveCalcularValorMaximoEntreQuatroValores() : Unit {37 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 22.dbl, 15.dbl)38 var valorMaximoCalculado : Double = EstatisticasSimples.calculaValorMaximo(valoresDeEntrada)39 Assert.assertEquals(22.dbl, valorMaximoCalculado, 0.dbl)40 }41 open public fun testdeveCalcularValorMaximoEntreCincoValores() : Unit {42 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 2.dbl, 15.dbl, 15.01)43 var valorMaximoCalculado : Double = EstatisticasSimples.calculaValorMaximo(valoresDeEntrada)44 Assert.assertEquals(15.01, valorMaximoCalculado, 0.dbl)45 }46 open public fun testdeveCalcularQuantidadeDeValores() : Unit {47 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl)48 var quantidadeDeValores : Int = EstatisticasSimples.calculaQuantidade(valoresDeEntrada)49 Assert.assertEquals(2, quantidadeDeValores)50 }51 open public fun testdeveCalcularQuantidadeDeValoresTest2() : Unit {52 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 8.dbl)53 var quantidadeDeValores : Int = EstatisticasSimples.calculaQuantidade(valoresDeEntrada)54 Assert.assertEquals(3, quantidadeDeValores)55 }56 open public fun testdeveCalcularQuantidadeDeValoresTest3() : Unit {57 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 8.dbl, 9.dbl)58 var quantidadeDeValores : Int = EstatisticasSimples.calculaQuantidade(valoresDeEntrada)59 Assert.assertEquals(4, quantidadeDeValores)60 }61 open public fun testdeveCalcularQuantidadeDeValoresTest4() : Unit {62 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 8.dbl, 9.dbl, 7.dbl)63 var quantidadeDeValores : Int = EstatisticasSimples.calculaQuantidade(valoresDeEntrada)64 Assert.assertEquals(5, quantidadeDeValores)65 }66 open public fun testdeveCalcularMediaDeDoisValores() : Unit {67 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl)68 var mediaDeValores : Double = EstatisticasSimples.calculaMedia(valoresDeEntrada)69 Assert.assertEquals(7.dbl, mediaDeValores, 0.dbl)70 }71 open public fun testdeveCalcularMediaDeTresValores() : Unit {72 var valoresDeEntrada : DoubleArray? = doubleArray(9.dbl, 5.dbl, 4.dbl)73 var mediaDeValores : Double = EstatisticasSimples.calculaMedia(valoresDeEntrada)74 Assert.assertEquals(6.dbl, mediaDeValores, 0.dbl)75 }76 open public fun testdeveCalcularMediaDeQuatroValores() : Unit {77 var valoresDeEntrada : DoubleArray? = doubleArray(8.dbl, 4.dbl, 6.dbl, 6.dbl)78 var mediaDeValores : Double = EstatisticasSimples.calculaMedia(valoresDeEntrada)79 Assert.assertEquals(6.dbl, mediaDeValores, 0.dbl)80 }81 open public fun testdeveCalcularMediaDeCincoValores() : Unit {82 var valoresDeEntrada : DoubleArray? = doubleArray(10.dbl, 5.dbl, 5.dbl, 10.dbl, 0.dbl)83 var mediaDeValores : Double = EstatisticasSimples.calculaMedia(valoresDeEntrada)84 Assert.assertEquals(6.dbl, mediaDeValores, 0.dbl)85 }86}...
ModifierOrderRuleTest.kt
Source:ModifierOrderRuleTest.kt
1package com.github.shyiko.ktlint.ruleset.standard2import com.github.shyiko.ktlint.core.LintError3import com.github.shyiko.ktlint.test.format4import com.github.shyiko.ktlint.test.lint5import org.assertj.core.api.Assertions.assertThat6import org.testng.annotations.Test7class ModifierOrderRuleTest {8 @Test9 fun testLint() {10 // pretty much every line below should trip an error11 assertThat(ModifierOrderRule().lint(12 """13 abstract open class A { // open is here for test purposes only, otherwise it's redundant14 open protected val v = ""15 open suspend internal fun f(v: Any): Any = ""16 lateinit public var lv: String17 tailrec abstract fun findFixPoint(x: Double = 1.0): Double18 }19 class B : A() {20 override public val v = ""21 suspend override fun f(v: Any): Any = ""22 tailrec override fun findFixPoint(x: Double): Double23 = if (x == Math.cos(x)) x else findFixPoint(Math.cos(x))24 companion object {25 const internal val V = ""26 }27 }28 """.trimIndent()29 )).isEqualTo(listOf(30 LintError(1, 1, "modifier-order", "Incorrect modifier order (should be \"open abstract\")"),31 LintError(2, 5, "modifier-order", "Incorrect modifier order (should be \"protected open\")"),32 LintError(3, 5, "modifier-order", "Incorrect modifier order (should be \"internal open suspend\")"),33 LintError(4, 5, "modifier-order", "Incorrect modifier order (should be \"public lateinit\")"),34 LintError(5, 5, "modifier-order", "Incorrect modifier order (should be \"abstract tailrec\")"),35 LintError(9, 5, "modifier-order", "Incorrect modifier order (should be \"public override\")"),36 LintError(10, 5, "modifier-order", "Incorrect modifier order (should be \"override suspend\")"),37 LintError(11, 5, "modifier-order", "Incorrect modifier order (should be \"override tailrec\")"),38 LintError(15, 8, "modifier-order", "Incorrect modifier order (should be \"internal const\")")39 ))40 }41 @Test42 fun testFormat() {43 assertThat(ModifierOrderRule().format(44 """45 abstract open class A { // open is here for test purposes only, otherwise it's redundant46 open protected val v = ""47 open suspend internal fun f(v: Any): Any = ""48 lateinit public var lv: String49 tailrec abstract fun findFixPoint(x: Double = 1.0): Double50 }51 class B : A() {52 override public val v = ""53 suspend override fun f(v: Any): Any = ""54 tailrec override fun findFixPoint(x: Double): Double55 = if (x == Math.cos(x)) x else findFixPoint(Math.cos(x))56 companion object {57 const internal val V = ""58 }59 }60 """61 )).isEqualTo(62 """63 open abstract class A { // open is here for test purposes only, otherwise it's redundant64 protected open val v = ""65 internal open suspend fun f(v: Any): Any = ""66 public lateinit var lv: String67 abstract tailrec fun findFixPoint(x: Double = 1.0): Double68 }69 class B : A() {70 public override val v = ""71 override suspend fun f(v: Any): Any = ""72 override tailrec fun findFixPoint(x: Double): Double73 = if (x == Math.cos(x)) x else findFixPoint(Math.cos(x))74 companion object {75 internal const val V = ""76 }77 }78 """79 )80 }81}...
TestUnit.kt
Source:TestUnit.kt
1package com.github.se7_kn8.haa2import javafx.scene.canvas.GraphicsContext3import javafx.scene.input.KeyCode4abstract class TestUnit(private val maxRuns: Int) {5 enum class TestUnitState {6 INIT,7 UPDATE,8 FINISH9 }10 var startTime: Long = 011 var width = 012 var height = 013 var finishDuration = 300014 var saveData = true15 private var finishTime: Long = 016 private var currentRun: Int = 017 private val data = ArrayList<Int>()18 private var currentState = TestUnitState.INIT19 open fun init() {20 }21 open fun draw(gc: GraphicsContext) {22 }23 open fun drawUpdate(gc: GraphicsContext) {24 }25 open fun drawFinish(gc: GraphicsContext) {26 }27 open fun drawOverlay(gc: GraphicsContext) {28 }29 fun finish(result: Int) {30 data.add(result)31 currentState = TestUnitState.FINISH32 finishTime = getRuntime() + finishDuration33 }34 fun update(gc: GraphicsContext) {35 draw(gc)36 when (currentState) {37 TestUnitState.INIT -> {38 startTime = System.currentTimeMillis()39 init()40 currentState = TestUnitState.UPDATE41 }42 TestUnitState.UPDATE -> {43 drawUpdate(gc)44 }45 TestUnitState.FINISH -> {46 drawFinish(gc)47 if (getRuntime() >= finishTime) {48 currentRun++49 currentState = TestUnitState.INIT50 }51 }52 }53 drawOverlay(gc)54 }55 fun saveResults(dataUtil: DataUtil) {56 if (saveData) {57 dataUtil.saveTestResult(getName(), data)58 }59 }60 fun getLastValue(): Int = data.last()61 fun getDataAvg(): Double {62 var value: Long = 063 data.forEach { value += it }64 return value.toDouble() / data.size.toDouble()65 }66 fun getRuntime() = System.currentTimeMillis() - startTime67 fun isFinished() = currentRun == maxRuns68 abstract fun getName(): String69 abstract fun getDesc(): String70 fun onMove(x: Double, y: Double) {71 if (currentState == TestUnitState.UPDATE) {72 handleMove(x, y)73 }74 }75 fun onClick(x: Double, y: Double) {76 if (currentState == TestUnitState.UPDATE) {77 handleClick(x, y)78 }79 }80 fun onKey(e: KeyCode) {81 if (currentState == TestUnitState.UPDATE) {82 handleKey(e)83 }84 }85 open fun handleMove(x: Double, y: Double) {86 }87 open fun handleClick(x: Double, y: Double) {88 }89 open fun handleKey(e: KeyCode) {90 }91 fun hWidth() = width / 2.092 fun hHeight() = height / 2.093}...
KotlinTestingFmi2Slave.kt
Source:KotlinTestingFmi2Slave.kt
1package no.ntnu.ais.fmu4j.slaves2import no.ntnu.ais.fmu4j.export.fmi2.Fmi2Slave3import no.ntnu.ais.fmu4j.export.fmi2.ScalarVariable4import no.ntnu.ais.fmu4j.modeldescription.fmi2.Fmi2Causality5open class KotlinTestingFmi2Slave(6 args: Map<String, Any>7) : Fmi2Slave(args) {8 @ScalarVariable(causality = Fmi2Causality.local)9 var real = 123.010 @ScalarVariable(causality = Fmi2Causality.output)11 lateinit var str: String12 @ScalarVariable(causality = Fmi2Causality.input)13 var start: Double = 5.014 private val container = TestContainer()15 override fun registerVariables() {16 register(real("subModel.out") { 99.0 })17 register(real("container.value") { container.value })18 register(integer("container.container.value") { container.container.value })19 }20 override fun setupExperiment(startTime: Double, stopTime: Double, tolerance: Double) {21 str = startTime.toString()22 }23 override fun doStep(currentTime: Double, dt: Double) {}24}25open class KotlinTestingExtendingFmi2Slave(26 args: Map<String, Any>27) : KotlinTestingFmi2Slave(args) {28 override fun doStep(currentTime: Double, dt: Double) {}29}30class TestContainer {31 val value: Double = 5.032 val container = TestContainer2()33}34class TestContainer2 {35 val value: Int = 136}...
withManyDefaultParams.kt
Source:withManyDefaultParams.kt
1public open class Test(_myName : String?, _a : Boolean, _b : Double, _c : Float, _d : Long, _e : Int, _f : Short, _g : Char) {2private val myName : String?3private var a : Boolean = false4private var b : Double = 0.toDouble()5private var c : Float = 0.toFloat()6private var d : Long = 07private var e : Int = 08private var f : Short = 09private var g : Char = ' '10{11myName = _myName12a = _a13b = _b14c = _c15d = _d16e = _e17f = _f18g = _g19}20class object {21public open fun init() : Test {22val __ = Test(null, false, 0.toDouble(), 0.toFloat(), 0, 0, 0, ' ')23return __24}25public open fun init(name : String?) : Test {26val __ = Test(foo(name), false, 0.toDouble(), 0.toFloat(), 0, 0, 0, ' ')27return __28}29open fun foo(n : String?) : String? {30return ""31}32}33}34public open class User() {35class object {36public open fun main() : Unit {37var t : Test? = Test.init("name")38}39}...
double
Using AI Code Generation
1package com.kavitha.selenium;2import org.openqa.selenium.By;3import org.openqa.selenium.WebDriver;4import org.openqa.selenium.chrome.ChromeDriver;5import org.testng.annotations.Test;6public class DoubleClick {7public void testDoubleClick() throws InterruptedException {8System.setProperty("webdriver.chrome.driver", "D:\\chromedriver_win32\\chromedriver.exe");9WebDriver driver = new ChromeDriver();10driver.switchTo().frame(0);11driver.findElement(By.xpath("/html/body/div")).click();12Thread.sleep(3000);13driver.quit();14}15}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!