Package kalashnikov.dmitry.lab3

Examples of kalashnikov.dmitry.lab3.SortTask


* Created by Tronok on 29.04.14.
*/
public class DispatcherTest {
    @Test
    public void testDispatcherNormal2Threads() throws InterruptedException, ExecutionException, IOException {
        Dispatcher dispatcher = new Dispatcher("multicoreTest.txt", 2);
        Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 5, 6, 8, 9, 34}, dispatcher.sort());
        dispatcher = new Dispatcher("multicoreTest_1_by_1.txt", 2);
        Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 5, 6, 8, 9, 34}, dispatcher.sort());
    }
View Full Code Here


        Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 5, 6, 8, 9, 34}, dispatcher.sort());
    }

    @Test
    public void testDispatcherNormal3Threads() throws InterruptedException, ExecutionException, IOException {
        Dispatcher dispatcher = new Dispatcher("multicoreTest.txt", 3);
        Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 5, 6, 8, 9, 34}, dispatcher.sort());
        dispatcher = new Dispatcher("multicoreTest_1_by_1.txt", 3);
        Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 5, 6, 8, 9, 34}, dispatcher.sort());
    }
View Full Code Here

        Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 5, 6, 8, 9, 34}, dispatcher.sort());
    }

    @Test
    public void testDispatcherNormal4Threads() throws InterruptedException, ExecutionException, IOException {
        Dispatcher dispatcher = new Dispatcher("multicoreTest.txt", 4);
        Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 5, 6, 8, 9, 34}, dispatcher.sort());
        dispatcher = new Dispatcher("multicoreTest_1_by_1.txt", 4);
        Assert.assertArrayEquals(new int[]{1, 2, 2, 3, 5, 5, 6, 8, 9, 34}, dispatcher.sort());
    }
View Full Code Here

public class MergeTaskTest {
    @Test
    public void testNormalMerge() throws Exception {
        int[] first = new int[]{1, 5, 20, 40};
        int[] second = new int[]{0, 9, 20};
        MergeTask mt = new MergeTask(first, second);
        Assert.assertArrayEquals(new int[]{0, 1, 5, 9, 20, 20, 40}, mt.call());
    }
View Full Code Here

    }

    @Test(expected = NullPointerException.class)
    public void testMergeWithNull() {
        int[] second = new int[]{0, 9, 20};
        MergeTask mt = new MergeTask(null, second);
    }
View Full Code Here

    @Test
    public void testMergeWithEmpty() throws Exception {
        int[] first = new int[]{};
        int[] second = new int[]{0, 9, 20};
        MergeTask mt = new MergeTask(first, second);
        Assert.assertArrayEquals(new int[]{0, 9, 20}, mt.call());
        mt = new MergeTask(second, first);
        Assert.assertArrayEquals(new int[]{0, 9, 20}, mt.call());
    }
View Full Code Here

        String[] str = new String[4];
        str[0] = "4";
        str[1] = "1";
        str[2] = "3";
        str[3] = "2";
        SortTask st = new SortTask(str);
        int[] res = st.call();
        Assert.assertArrayEquals(new int[]{1, 2, 3, 4}, res);
    }
View Full Code Here

        String[] str = new String[4];
        str[0] = "4";
        str[1] = null;
        str[2] = "3";
        str[3] = "2";
        SortTask st = new SortTask(str);
        int[] res = st.call();
        Assert.assertArrayEquals(new int[]{1, 2, 3, 4}, res);
    }
View Full Code Here

    }

    @Test
    public void testSortTaskEmpty() throws Exception {
        String[] str = new String[0];
        SortTask st = new SortTask(str);
        int[] res = st.call();
        Assert.assertArrayEquals(new int[]{}, res);
    }
View Full Code Here

TOP

Related Classes of kalashnikov.dmitry.lab3.SortTask

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.