diff options
author | Phil Burk <[email protected]> | 2021-10-30 10:55:40 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2021-10-30 10:55:40 -0700 |
commit | e87459a16189a1935d6035a6a2ace0e615903352 (patch) | |
tree | af95ad56e6bfa7493b0b8c9d8245408032bcc4cc /src/test/java | |
parent | ff6a638feaaf2df38929e77c6a81975ba560282b (diff) |
Add getUnits() method to Circuit. (#104)
Add new TestCircuit unit test.
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/jsyn/unitgen/TestCircuit.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/test/java/com/jsyn/unitgen/TestCircuit.java b/src/test/java/com/jsyn/unitgen/TestCircuit.java new file mode 100644 index 0000000..c620abf --- /dev/null +++ b/src/test/java/com/jsyn/unitgen/TestCircuit.java @@ -0,0 +1,44 @@ +/* + * Copyright 2021 Phil Burk, Mobileer Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.jsyn.unitgen; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Test Circuit class + */ +public class TestCircuit { + + @Test + public void testAddGetUnits() { + Circuit circuit = new Circuit(); + SineOscillator sine = new SineOscillator(); + circuit.add(sine); + UnitGenerator units[] = circuit.getUnits(); + assertTrue(circuit != null, "null units array"); + assertEquals(sine, units[0], "sine"); + + SawtoothOscillator saw = new SawtoothOscillator(); + circuit.add(saw); + units = circuit.getUnits(); + assertTrue(circuit != null, "null units array"); + assertEquals(sine, units[0], "sine"); + assertEquals(saw, units[1], "saw"); + } +} |