Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

8вариант / lab3 / LogicTest

.java
Скачиваний:
6
Добавлен:
08.06.2018
Размер:
1.39 Кб
Скачать
import org.junit.Assert;
import org.junit.Test;
import java.util.Stack;

public class LogicTest {
@Test
public void test1() throws Exception {
Stack<Double> input1 = new Stack<Double>();
input1.push(1.0);
input1.push(2.0);
input1.push(3.0);
Stack<Double> input2 = new Stack<Double>();
input2.push(4.0);
input2.push(5.0);
input2.push(6.0);
String output = "Stack1 output [4.0, 5.0, 6.0]\nStack2 output [1.0, 2.0, 3.0]";
Assert.assertEquals(Logic.swapStacks(input1, input2), output);
}
@Test
public void test2() throws Exception {
Stack<Double> input1 = new Stack<Double>();
input1.push(1.0);
input1.push(2.0);
input1.push(3.0);
Stack<Double> input2 = new Stack<Double>();
input2.push(4.0);
input2.push(5.0);
input2.push(5.0);
String output = "Stack1 output [4.0, 5.0, 5.0]\nStack2 output [1.0, 2.0, 3.0]";
Assert.assertEquals(Logic.swapStacks(input1, input2), output);
}
@Test
public void test3() throws Exception {
Stack<Double> input1 = new Stack<Double>();
input1.push(0.01);
input1.push(0.02);
input1.push(0.03);
Stack<Double> input2 = new Stack<Double>();
input2.push(123.0);
input2.push(222.0);
input2.push(123.0);
String output = "Stack1 output [123.0, 222.0, 123.0]\nStack2 output [0.01, 0.02, 0.03]";
Assert.assertEquals(Logic.swapStacks(input1, input2), output);
}

}
Соседние файлы в папке lab3