-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathTestBenchmarkClasses.kt
51 lines (44 loc) · 1.7 KB
/
TestBenchmarkClasses.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package org.utbot.examples.benchmark
import org.utbot.examples.samples.benchmark.Fibonacci
import org.utbot.instrumentation.ConcreteExecutor
import org.utbot.instrumentation.execute
import org.utbot.instrumentation.instrumentation.InvokeInstrumentation
import org.utbot.instrumentation.instrumentation.coverage.InstructionCoverageInstrumentation
import java.math.BigInteger
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.utbot.test.util.UtPair
class TestBenchmarkClasses {
lateinit var utContext: AutoCloseable
@Test
@Disabled("Ask Sergey to check")
fun testRepeater() {
ConcreteExecutor(
InstructionCoverageInstrumentation.Factory,
Repeater::class.java.protectionDomain.codeSource.location.path
).use {
val dc0 = Repeater(", ")
val res0 = it.execute(Repeater::concat, arrayOf(dc0, "flex", "mega-", 2))
assertEquals("mega-mega-flex", res0.getOrNull())
val dc1 = Unzipper()
val arr = arrayOf(UtPair(1, 'h'), UtPair(1, 'e'), UtPair(2, 'l'), UtPair(1, 'o'))
val res1 = it.execute(Unzipper::unzip, arrayOf(dc1, arr))
assertEquals("h-e-ll-o-", res1.getOrNull())
}
}
@Test
fun testFibonacci() {
ConcreteExecutor(
InvokeInstrumentation.Factory,
Fibonacci::class.java.protectionDomain.codeSource.location.path
).use {
val res =
it.execute(
Fibonacci::calc,
arrayOf(1, 1, 10)
)
assertEquals(Result.success(BigInteger.valueOf(89)), res)
}
}
}