Skip to content

Commit

Permalink
[tests] add more
Browse files Browse the repository at this point in the history
  • Loading branch information
umjammer committed Mar 4, 2022
1 parent 8bf47df commit 5fdb0ba
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/test/java/vavi/sound/mfi/vavi/MfiConvertibleTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2022 by Naohide Sano, All rights reserved.
*
* Programmed by Naohide Sano
*/

package vavi.sound.mfi.vavi;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;


/**
* MfiConvertibleTest.
*
* @author <a href="mailto:[email protected]">Naohide Sano</a> (umjammer)
* @version 0.00 2022/02/16 umjammer initial version <br>
*/
class MfiConvertibleTest {

@Test
void test() {
// exists in /vavi/sound/mfi/vavi/vavi.properties
MfiConvertible converter = MfiConvertible.factory.get("short.144");
assertInstanceOf(VaviNoteMessage.class, converter);
// not exists
converter = MfiConvertible.factory.get("meta.144");
assertNull(converter);
}
}

/* */
18 changes: 18 additions & 0 deletions src/test/java/vavi/sound/mfi/vavi/sequencer/AudioEngineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@

import org.junit.jupiter.api.Test;

import vavi.sound.mobile.AudioEngine;
import vavi.sound.mobile.AudioEngine.Util;
import vavi.sound.mobile.FuetrekAudioEngine;
import vavi.sound.mobile.RohmAudioEngine;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;


/**
Expand All @@ -36,6 +41,19 @@ public void test2() {
byte[] stereo = Util.toStereo(monoL, monoR, 4, null);
assertArrayEquals(new byte[] { (byte) 0xa1, (byte) 0xb2, (byte) 0xc3, (byte) 0xd4 }, stereo);
}


@Test
public void test3() {
// exists in /vavi/sound/mfi/vavi/vavi.properties
AudioEngine audioEngine = AudioDataSequencer.Factory.getAudioEngine(0x80);
assertInstanceOf(RohmAudioEngine.class, audioEngine);
audioEngine = AudioDataSequencer.Factory.getAudioEngine(0x81);
assertInstanceOf(FuetrekAudioEngine.class, audioEngine);
// not exists
audioEngine = AudioDataSequencer.Factory.getAudioEngine(0x82);
assertNull(audioEngine);
}
}

/* */

0 comments on commit 5fdb0ba

Please sign in to comment.