diff options
Diffstat (limited to 'tests/src/com/cyngn/audiofx/eq/EqUtilTests.java')
-rw-r--r-- | tests/src/com/cyngn/audiofx/eq/EqUtilTests.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/src/com/cyngn/audiofx/eq/EqUtilTests.java b/tests/src/com/cyngn/audiofx/eq/EqUtilTests.java new file mode 100644 index 0000000..bca4b85 --- /dev/null +++ b/tests/src/com/cyngn/audiofx/eq/EqUtilTests.java @@ -0,0 +1,40 @@ +package com.cyngn.audiofx.eq; + +import android.test.suitebuilder.annotation.SmallTest; +import com.cyngn.audiofx.Preset; +import com.cyngn.audiofx.eq.EqUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Created by roman on 9/29/15. + */ +public class EqUtilTests { + + private Preset.PermCustomPreset permPreset; + private Preset.PermCustomPreset permPresetCopy; + private Preset.CustomPreset customPreset; + + @Before + public void setUp() throws Exception { + permPreset = new Preset.PermCustomPreset("test perm preset", new float[]{10, 50, 20, 30, 10000}); + permPresetCopy = new Preset.PermCustomPreset("test perm preset", new float[]{10, 50, 20, 30, 10000}); + customPreset = new Preset.CustomPreset("test custom preset", new float[]{10, 50, 20, 30, 10000}, false); + } + + @Test + public void testConvertDecibelsToMillibels() { + final float[] convertedMillibels = EqUtils.convertDecibelsToMillibels(permPreset.getLevels()); + + float[] manualMillibels = new float[permPreset.getLevels().length]; + for (int i = 0; i < manualMillibels.length; i++) { + manualMillibels[i] = permPreset.getLevels()[i] * 100; + } + + for (int i = 0; i < manualMillibels.length; i++) { + Assert.assertEquals(manualMillibels[i], convertedMillibels[i], 0); + } + } + +} |