diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2024-03-05 13:23:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-05 13:23:57 +0100 |
| commit | 5864cbcbfe2eb8c36ca05c3a39c7e5916aeecaec (patch) | |
| tree | 5b2773b8dc21c2e1b526fb70f829c376dd80532a /opendc-simulator/opendc-simulator-flow/src/test/kotlin/org | |
| parent | d28002a3c151d198298574312f32f1cb43f3a660 (diff) | |
Updated package versions, updated web server tests. (#207)
* Updated all package versions including kotlin. Updated all web-server tests to run.
* Changed the java version of the tests. OpenDC now only supports java 19.
* small update
* test update
* new update
* updated docker version to 19
* updated docker version to 19
Diffstat (limited to 'opendc-simulator/opendc-simulator-flow/src/test/kotlin/org')
5 files changed, 227 insertions, 205 deletions
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/FlowEngineTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/FlowEngineTest.kt index 467bf334..413a5878 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/FlowEngineTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/FlowEngineTest.kt @@ -37,161 +37,174 @@ import org.opendc.simulator.kotlin.runSimulation */ class FlowEngineTest { @Test - fun testSmoke() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testSmoke() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val multiplexer = MaxMinFlowMultiplexer(graph) - val sink = SimpleFlowSink(graph, 2.0f) + val multiplexer = MaxMinFlowMultiplexer(graph) + val sink = SimpleFlowSink(graph, 2.0f) - graph.connect(multiplexer.newOutput(), sink.input) + graph.connect(multiplexer.newOutput(), sink.input) - val sourceA = SimpleFlowSource(graph, 2000.0f, 0.8f) - val sourceB = SimpleFlowSource(graph, 2000.0f, 0.8f) + val sourceA = SimpleFlowSource(graph, 2000.0f, 0.8f) + val sourceB = SimpleFlowSource(graph, 2000.0f, 0.8f) - graph.connect(sourceA.output, multiplexer.newInput()) - graph.connect(sourceB.output, multiplexer.newInput()) - } + graph.connect(sourceA.output, multiplexer.newInput()) + graph.connect(sourceB.output, multiplexer.newInput()) + } @Test - fun testConnectInvalidInlet() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testConnectInvalidInlet() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val inlet = mockk<Inlet>() - val source = SimpleFlowSource(graph, 2000.0f, 0.8f) - assertThrows<IllegalArgumentException> { graph.connect(source.output, inlet) } - } + val inlet = mockk<Inlet>() + val source = SimpleFlowSource(graph, 2000.0f, 0.8f) + assertThrows<IllegalArgumentException> { graph.connect(source.output, inlet) } + } @Test - fun testConnectInvalidOutlet() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testConnectInvalidOutlet() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val outlet = mockk<Outlet>() - val sink = SimpleFlowSink(graph, 2.0f) - assertThrows<IllegalArgumentException> { graph.connect(outlet, sink.input) } - } + val outlet = mockk<Outlet>() + val sink = SimpleFlowSink(graph, 2.0f) + assertThrows<IllegalArgumentException> { graph.connect(outlet, sink.input) } + } @Test - fun testConnectInletBelongsToDifferentGraph() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graphA = engine.newGraph() - val graphB = engine.newGraph() + fun testConnectInletBelongsToDifferentGraph() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graphA = engine.newGraph() + val graphB = engine.newGraph() - val sink = SimpleFlowSink(graphB, 2.0f) - val source = SimpleFlowSource(graphA, 2000.0f, 0.8f) + val sink = SimpleFlowSink(graphB, 2.0f) + val source = SimpleFlowSource(graphA, 2000.0f, 0.8f) - assertThrows<IllegalArgumentException> { graphA.connect(source.output, sink.input) } - } + assertThrows<IllegalArgumentException> { graphA.connect(source.output, sink.input) } + } @Test - fun testConnectOutletBelongsToDifferentGraph() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graphA = engine.newGraph() - val graphB = engine.newGraph() + fun testConnectOutletBelongsToDifferentGraph() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graphA = engine.newGraph() + val graphB = engine.newGraph() - val sink = SimpleFlowSink(graphA, 2.0f) - val source = SimpleFlowSource(graphB, 2000.0f, 0.8f) + val sink = SimpleFlowSink(graphA, 2.0f) + val source = SimpleFlowSource(graphB, 2000.0f, 0.8f) - assertThrows<IllegalArgumentException> { graphA.connect(source.output, sink.input) } - } + assertThrows<IllegalArgumentException> { graphA.connect(source.output, sink.input) } + } @Test - fun testConnectInletAlreadyConnected() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testConnectInletAlreadyConnected() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val sink = SimpleFlowSink(graph, 2.0f) - val sourceA = SimpleFlowSource(graph, 2000.0f, 0.8f) - val sourceB = SimpleFlowSource(graph, 2000.0f, 0.8f) + val sink = SimpleFlowSink(graph, 2.0f) + val sourceA = SimpleFlowSource(graph, 2000.0f, 0.8f) + val sourceB = SimpleFlowSource(graph, 2000.0f, 0.8f) - graph.connect(sourceA.output, sink.input) - assertThrows<IllegalStateException> { graph.connect(sourceB.output, sink.input) } - } + graph.connect(sourceA.output, sink.input) + assertThrows<IllegalStateException> { graph.connect(sourceB.output, sink.input) } + } @Test - fun testConnectOutletAlreadyConnected() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testConnectOutletAlreadyConnected() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val sinkA = SimpleFlowSink(graph, 2.0f) - val sinkB = SimpleFlowSink(graph, 2.0f) - val source = SimpleFlowSource(graph, 2000.0f, 0.8f) + val sinkA = SimpleFlowSink(graph, 2.0f) + val sinkB = SimpleFlowSink(graph, 2.0f) + val source = SimpleFlowSource(graph, 2000.0f, 0.8f) - graph.connect(source.output, sinkA.input) - assertThrows<IllegalStateException> { graph.connect(source.output, sinkB.input) } - } + graph.connect(source.output, sinkA.input) + assertThrows<IllegalStateException> { graph.connect(source.output, sinkB.input) } + } @Test - fun testDisconnectInletInvalid() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testDisconnectInletInvalid() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val inlet = mockk<Inlet>() - assertThrows<IllegalArgumentException> { graph.disconnect(inlet) } - } + val inlet = mockk<Inlet>() + assertThrows<IllegalArgumentException> { graph.disconnect(inlet) } + } @Test - fun testDisconnectOutletInvalid() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testDisconnectOutletInvalid() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val outlet = mockk<Outlet>() - assertThrows<IllegalArgumentException> { graph.disconnect(outlet) } - } + val outlet = mockk<Outlet>() + assertThrows<IllegalArgumentException> { graph.disconnect(outlet) } + } @Test - fun testDisconnectInletInvalidGraph() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graphA = engine.newGraph() - val graphB = engine.newGraph() + fun testDisconnectInletInvalidGraph() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graphA = engine.newGraph() + val graphB = engine.newGraph() - val sink = SimpleFlowSink(graphA, 2.0f) + val sink = SimpleFlowSink(graphA, 2.0f) - assertThrows<IllegalArgumentException> { graphB.disconnect(sink.input) } - } + assertThrows<IllegalArgumentException> { graphB.disconnect(sink.input) } + } @Test - fun testDisconnectOutletInvalidGraph() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graphA = engine.newGraph() - val graphB = engine.newGraph() + fun testDisconnectOutletInvalidGraph() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graphA = engine.newGraph() + val graphB = engine.newGraph() - val source = SimpleFlowSource(graphA, 2000.0f, 0.8f) + val source = SimpleFlowSource(graphA, 2000.0f, 0.8f) - assertThrows<IllegalArgumentException> { graphB.disconnect(source.output) } - } + assertThrows<IllegalArgumentException> { graphB.disconnect(source.output) } + } @Test - fun testInletEquality() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testInletEquality() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val sinkA = SimpleFlowSink(graph, 2.0f) - val sinkB = SimpleFlowSink(graph, 2.0f) + val sinkA = SimpleFlowSink(graph, 2.0f) + val sinkB = SimpleFlowSink(graph, 2.0f) - val multiplexer = MaxMinFlowMultiplexer(graph) + val multiplexer = MaxMinFlowMultiplexer(graph) - assertEquals(sinkA.input, sinkA.input) - assertNotEquals(sinkA.input, sinkB.input) + assertEquals(sinkA.input, sinkA.input) + assertNotEquals(sinkA.input, sinkB.input) - assertNotEquals(multiplexer.newInput(), multiplexer.newInput()) - } + assertNotEquals(multiplexer.newInput(), multiplexer.newInput()) + } @Test - fun testOutletEquality() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testOutletEquality() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val sourceA = SimpleFlowSource(graph, 2000.0f, 0.8f) - val sourceB = SimpleFlowSource(graph, 2000.0f, 0.8f) + val sourceA = SimpleFlowSource(graph, 2000.0f, 0.8f) + val sourceB = SimpleFlowSource(graph, 2000.0f, 0.8f) - val multiplexer = MaxMinFlowMultiplexer(graph) + val multiplexer = MaxMinFlowMultiplexer(graph) - assertEquals(sourceA.output, sourceA.output) - assertNotEquals(sourceA.output, sourceB.output) + assertEquals(sourceA.output, sourceA.output) + assertNotEquals(sourceA.output, sourceB.output) - assertNotEquals(multiplexer.newOutput(), multiplexer.newOutput()) - } + assertNotEquals(multiplexer.newOutput(), multiplexer.newOutput()) + } } diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/FlowTimerQueueTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/FlowTimerQueueTest.kt index 1824959c..059bd5f5 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/FlowTimerQueueTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/FlowTimerQueueTest.kt @@ -47,7 +47,7 @@ class FlowTimerQueueTest { fun testPollEmpty() { assertAll( { assertEquals(Long.MAX_VALUE, queue.peekDeadline()) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -66,7 +66,7 @@ class FlowTimerQueueTest { { assertEquals(100, queue.peekDeadline()) }, { assertNull(queue.poll(10L)) }, { assertEquals(entry, queue.poll(200L)) }, - { assertNull(queue.poll(200L)) } + { assertNull(queue.poll(200L)) }, ) } @@ -98,7 +98,7 @@ class FlowTimerQueueTest { { assertEquals(entryB, queue.poll(100L)) }, { assertEquals(entryC, queue.poll(100L)) }, { assertEquals(entryA, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -137,7 +137,7 @@ class FlowTimerQueueTest { { assertEquals(entryD, queue.poll(100L)) }, { assertEquals(entryC, queue.poll(100L)) }, { assertEquals(entryA, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -172,7 +172,7 @@ class FlowTimerQueueTest { { assertEquals(entryA, queue.poll(100L)) }, { assertEquals(entryB, queue.poll(100L)) }, { assertEquals(entryC, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -207,7 +207,7 @@ class FlowTimerQueueTest { { assertEquals(entryC, queue.poll(100L)) }, { assertEquals(entryB, queue.poll(100L)) }, { assertEquals(entryA, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -242,7 +242,7 @@ class FlowTimerQueueTest { { assertEquals(entryB, queue.poll(100L)) }, { assertEquals(entryC, queue.poll(100L)) }, { assertEquals(entryA, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -277,7 +277,7 @@ class FlowTimerQueueTest { { assertEquals(entryB, queue.poll(100L)) }, { assertEquals(entryC, queue.poll(100L)) }, { assertEquals(entryA, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -311,7 +311,7 @@ class FlowTimerQueueTest { { assertEquals(20, queue.peekDeadline()) }, { assertEquals(entryB, queue.poll(100L)) }, { assertEquals(entryA, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -345,7 +345,7 @@ class FlowTimerQueueTest { { assertEquals(58, queue.peekDeadline()) }, { assertEquals(entryC, queue.poll(100L)) }, { assertEquals(entryA, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } @@ -379,7 +379,7 @@ class FlowTimerQueueTest { { assertEquals(20, queue.peekDeadline()) }, { assertEquals(entryB, queue.poll(100L)) }, { assertEquals(entryA, queue.poll(100L)) }, - { assertNull(queue.poll(100L)) } + { assertNull(queue.poll(100L)) }, ) } } diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/mux/ForwardingFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/mux/ForwardingFlowMultiplexerTest.kt index d1795841..2aef5174 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/mux/ForwardingFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/mux/ForwardingFlowMultiplexerTest.kt @@ -39,33 +39,34 @@ class ForwardingFlowMultiplexerTest { * Test a trace workload. */ @Test - fun testTrace() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testTrace() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val switch = ForwardingFlowMultiplexer(graph) - val sink = SimpleFlowSink(graph, 3200.0f) - graph.connect(switch.newOutput(), sink.input) + val switch = ForwardingFlowMultiplexer(graph) + val sink = SimpleFlowSink(graph, 3200.0f) + graph.connect(switch.newOutput(), sink.input) - yield() + yield() - assertEquals(sink.capacity, switch.capacity) { "Capacity is not detected" } + assertEquals(sink.capacity, switch.capacity) { "Capacity is not detected" } - val workload = - TraceFlowSource( - graph, - TraceFlowSource.Trace( - longArrayOf(1000, 2000, 3000, 4000), - floatArrayOf(28.0f, 3500.0f, 0.0f, 183.0f), - 4 + val workload = + TraceFlowSource( + graph, + TraceFlowSource.Trace( + longArrayOf(1000, 2000, 3000, 4000), + floatArrayOf(28.0f, 3500.0f, 0.0f, 183.0f), + 4, + ), ) - ) - graph.connect(workload.output, switch.newInput()) + graph.connect(workload.output, switch.newInput()) - advanceUntilIdle() + advanceUntilIdle() - assertAll( - { assertEquals(4000, timeSource.millis()) { "Took enough time" } } - ) - } + assertAll( + { assertEquals(4000, timeSource.millis()) { "Took enough time" } }, + ) + } } diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/mux/MaxMinFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/mux/MaxMinFlowMultiplexerTest.kt index ebae2d4e..0bcf4a3f 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/mux/MaxMinFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/mux/MaxMinFlowMultiplexerTest.kt @@ -34,21 +34,22 @@ import org.opendc.simulator.kotlin.runSimulation */ class MaxMinFlowMultiplexerTest { @Test - fun testSmoke() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() - val switch = MaxMinFlowMultiplexer(graph) + fun testSmoke() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() + val switch = MaxMinFlowMultiplexer(graph) - val sinks = List(2) { SimpleFlowSink(graph, 2000.0f) } - for (source in sinks) { - graph.connect(switch.newOutput(), source.input) - } + val sinks = List(2) { SimpleFlowSink(graph, 2000.0f) } + for (source in sinks) { + graph.connect(switch.newOutput(), source.input) + } - val source = SimpleFlowSource(graph, 2000.0f, 1.0f) - graph.connect(source.output, switch.newInput()) + val source = SimpleFlowSource(graph, 2000.0f, 1.0f) + graph.connect(source.output, switch.newInput()) - advanceUntilIdle() + advanceUntilIdle() - assertEquals(500, timeSource.millis()) - } + assertEquals(500, timeSource.millis()) + } } diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/sink/FlowSinkTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/sink/FlowSinkTest.kt index ea516c63..7085a4b9 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/sink/FlowSinkTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow2/sink/FlowSinkTest.kt @@ -36,82 +36,89 @@ import java.util.concurrent.ThreadLocalRandom */ class FlowSinkTest { @Test - fun testSmoke() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testSmoke() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val sink = SimpleFlowSink(graph, 1.0f) - val source = SimpleFlowSource(graph, 2.0f, 1.0f) + val sink = SimpleFlowSink(graph, 1.0f) + val source = SimpleFlowSource(graph, 2.0f, 1.0f) - graph.connect(source.output, sink.input) - advanceUntilIdle() + graph.connect(source.output, sink.input) + advanceUntilIdle() - assertEquals(2000, timeSource.millis()) - } + assertEquals(2000, timeSource.millis()) + } @Test - fun testAdjustCapacity() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testAdjustCapacity() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val sink = SimpleFlowSink(graph, 1.0f) - val source = SimpleFlowSource(graph, 2.0f, 1.0f) + val sink = SimpleFlowSink(graph, 1.0f) + val source = SimpleFlowSource(graph, 2.0f, 1.0f) - graph.connect(source.output, sink.input) + graph.connect(source.output, sink.input) - delay(1000) - sink.capacity = 0.5f + delay(1000) + sink.capacity = 0.5f - advanceUntilIdle() + advanceUntilIdle() - assertEquals(3000, timeSource.millis()) - } + assertEquals(3000, timeSource.millis()) + } @Test - fun testUtilization() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() + fun testUtilization() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() - val sink = SimpleFlowSink(graph, 1.0f) - val source = SimpleFlowSource(graph, 2.0f, 0.5f) + val sink = SimpleFlowSink(graph, 1.0f) + val source = SimpleFlowSource(graph, 2.0f, 0.5f) - graph.connect(source.output, sink.input) - advanceUntilIdle() + graph.connect(source.output, sink.input) + advanceUntilIdle() - assertEquals(4000, timeSource.millis()) - } + assertEquals(4000, timeSource.millis()) + } @Test - fun testFragments() = runSimulation { - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() - - val sink = SimpleFlowSink(graph, 1.0f) - val trace = TraceFlowSource.Trace( - longArrayOf(1000, 2000, 3000, 4000), - floatArrayOf(1.0f, 0.5f, 2.0f, 1.0f), - 4 - ) - val source = TraceFlowSource( - graph, - trace - ) - - graph.connect(source.output, sink.input) - advanceUntilIdle() - - assertEquals(4000, timeSource.millis()) - } + fun testFragments() = + runSimulation { + val engine = FlowEngine.create(dispatcher) + val graph = engine.newGraph() + + val sink = SimpleFlowSink(graph, 1.0f) + val trace = + TraceFlowSource.Trace( + longArrayOf(1000, 2000, 3000, 4000), + floatArrayOf(1.0f, 0.5f, 2.0f, 1.0f), + 4, + ) + val source = + TraceFlowSource( + graph, + trace, + ) + + graph.connect(source.output, sink.input) + advanceUntilIdle() + + assertEquals(4000, timeSource.millis()) + } @Test fun benchmarkSink() { val random = ThreadLocalRandom.current() val traceSize = 10000000 - val trace = TraceFlowSource.Trace( - LongArray(traceSize) { it * 1000L }, - FloatArray(traceSize) { random.nextDouble(0.0, 4500.0).toFloat() }, - traceSize - ) + val trace = + TraceFlowSource.Trace( + LongArray(traceSize) { it * 1000L }, + FloatArray(traceSize) { random.nextDouble(0.0, 4500.0).toFloat() }, + traceSize, + ) return runSimulation { val engine = FlowEngine.create(dispatcher) |
