Skip to content
Snippets Groups Projects
Commit 66041d3d authored by Sören Henning's avatar Sören Henning
Browse files

Merge branch 'fix-results' into 'theodolite-kotlin'

fix results

See merge request !132
parents 78490691 e3055634
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!132fix results,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Pipeline #2849 passed
......@@ -40,7 +40,8 @@ class Results {
* @param load the [LoadDimension]
*
* @return the smallest suitable number of resources. If the experiment was not executed yet,
* a @see Resource with the constant Int.MAX_VALUE as value is returned. If no experiments have been marked as either successful or unsuccessful
* a @see Resource with the constant Int.MAX_VALUE as value is returned.
* If no experiments have been marked as either successful or unsuccessful
* yet, a Resource with the constant value Int.MIN_VALUE is returned.
*/
fun getMinRequiredInstances(load: LoadDimension?): Resource? {
......@@ -72,13 +73,11 @@ class Results {
fun getMaxBenchmarkedLoad(load: LoadDimension): LoadDimension? {
var maxBenchmarkedLoad: LoadDimension? = null
for (experiment in results) {
if (experiment.value) {
if (experiment.key.first.get() <= load.get()) {
if (maxBenchmarkedLoad == null) {
maxBenchmarkedLoad = experiment.key.first
} else if (maxBenchmarkedLoad.get() < experiment.key.first.get()) {
maxBenchmarkedLoad = experiment.key.first
}
if (experiment.key.first.get() <= load.get()) {
if (maxBenchmarkedLoad == null) {
maxBenchmarkedLoad = experiment.key.first
} else if (maxBenchmarkedLoad.get() < experiment.key.first.get()) {
maxBenchmarkedLoad = experiment.key.first
}
}
}
......
package theodolite.util
import io.quarkus.test.junit.QuarkusTest
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
......@@ -44,7 +45,31 @@ internal class ResultsTest {
LoadDimension(load, emptyList()),
Resource(resources, emptyList())
),
successful)
successful
)
}
}
\ No newline at end of file
@Test
fun testGetMaxBenchmarkedLoadWhenAllSuccessful() {
val results = Results()
results.setResult(10000, 1, true)
results.setResult(10000, 2, true)
val test1 = results.getMaxBenchmarkedLoad(LoadDimension(100000, emptyList()))!!.get()
assertEquals(10000, test1)
}
@Test
fun testGetMaxBenchmarkedLoadWhenLargestNotSuccessful() {
val results = Results()
results.setResult(10000, 1, true)
results.setResult(10000, 2, true)
results.setResult(20000, 1, false)
val test2 = results.getMaxBenchmarkedLoad(LoadDimension(100000, emptyList()))!!.get()
assertEquals(20000, test2)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment