FileDocCategorySizeDatePackage
MorseCodeConverterTest.javaAPI DocAndroid 1.5 API2002Wed May 06 22:41:08 BST 2009com.example.android.apis.os

MorseCodeConverterTest

public class MorseCodeConverterTest extends TestCase
An example of a true unit test that tests the utility class {@link MorseCodeConverter}. Since this test doesn't need a {@link android.content.Context}, or any other dependencies injected, it simply extends the standard {@link TestCase}. See {@link com.example.android.apis.AllTests} for documentation on running all tests and individual tests in this application.

Fields Summary
Constructors Summary
Methods Summary
private voidassertArraysEqual(long[] expected, long[] actual)

        assertEquals("Unexpected array length.", expected.length, actual.length);
        for (int i = 0; i < expected.length; i++) {
            long expectedLong = expected[i];
            long actualLong = actual[i];
            assertEquals("Unexpected long at index: " + i, expectedLong, actualLong);
        }
    
public voidtestCharacterS()


        long[] expectedBeeps = {
                MorseCodeConverter.DOT,
                MorseCodeConverter.DOT,
                MorseCodeConverter.DOT,
                MorseCodeConverter.DOT,
                MorseCodeConverter.DOT};
        long[] beeps = MorseCodeConverter.pattern('s");

        assertArraysEqual(expectedBeeps, beeps);