This commit is contained in:
navid.sassan 2020-09-21 19:53:10 +02:00
parent d7fd2e8bdd
commit a9e1eaa7f5
3 changed files with 105 additions and 105 deletions

View File

@ -1,29 +1,29 @@
package ch.zhaw.ads;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
public class BracketServerTest {
/* BracketServer bs;
@Before
public void setUp() throws Exception {
bs = new BracketServer();
}
private void test(String s, boolean b) {
assertEquals(s,bs.checkBrackets(s),b);
}
@Test
public void testBracket() {
test("()",true);
test("(()]",false);
test("((([([])])))",true);
test("[(])",false);
test("[(3 +3)* 35 +3]* {3 +2}",true);
test("[({3 +3)* 35} +3]* {3 +2}",false);
}
*/
}
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
public class BracketServerTest {
/* BracketServer bs;
@Before
public void setUp() throws Exception {
bs = new BracketServer();
}
private void test(String s, boolean b) {
assertEquals(s,bs.checkBrackets(s),b);
}
@Test
public void testBracket() {
test("()",true);
test("(()]",false);
test("((([([])])))",true);
test("[(])",false);
test("[(3 +3)* 35 +3]* {3 +2}",true);
test("[({3 +3)* 35} +3]* {3 +2}",false);
}
*/
}

View File

@ -1,23 +1,23 @@
package ch.zhaw.ads;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class KgvServerTest {
KGVServer server;
@Before
public void setUp() throws Exception {
server = new KGVServer();
}
@Test
public void testKgv() {
assertEquals(server.kgv(3,4),12);
assertEquals(server.kgv(2,4),4);
assertEquals(server.kgv(5,7),35);
assertEquals(server.kgv(4,6),12);
}
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class KgvServerTest {
KGVServer server;
@Before
public void setUp() throws Exception {
server = new KGVServer();
}
@Test
public void testKgv() {
assertEquals(server.kgv(3,4),12);
assertEquals(server.kgv(2,4),4);
assertEquals(server.kgv(5,7),35);
assertEquals(server.kgv(4,6),12);
}
}

View File

@ -1,58 +1,58 @@
/**
* @(#)StackTest.java
*
*
* @author
* @version 1.00 2017/8/30
*/
/**
* @(#)StackTest.java
*
*
* @author
* @version 1.00 2017/8/30
*/
package ch.zhaw.ads;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
public class StackTest {
ListStack stack;
@Before
public void setUp() throws Exception {
stack = new ListStack();
}
@Test
public void testPush1() {
stack.push("A");
Object o = stack.pop();
assertEquals(o, "A");
}
@Test
public void testPush2() {
stack.push("A");
stack.push("B");
assertEquals(stack.pop(), "B");
assertEquals(stack.pop(), "A");
}
@Test
public void testIsEmpty() {
assertTrue(stack.isEmpty());
stack.push("A");
assertFalse(stack.isEmpty());
stack.pop();
assertTrue(stack.isEmpty());
}
@Test
public void testIsFull() {
assertFalse(stack.isFull());
}
@Test
public void testEmptyPop() {
assertEquals(stack.pop(), null);
}
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
public class StackTest {
ListStack stack;
@Before
public void setUp() throws Exception {
stack = new ListStack();
}
@Test
public void testPush1() {
stack.push("A");
Object o = stack.pop();
assertEquals(o, "A");
}
@Test
public void testPush2() {
stack.push("A");
stack.push("B");
assertEquals(stack.pop(), "B");
assertEquals(stack.pop(), "A");
}
@Test
public void testIsEmpty() {
assertTrue(stack.isEmpty());
stack.push("A");
assertFalse(stack.isEmpty());
stack.pop();
assertTrue(stack.isEmpty());
}
@Test
public void testIsFull() {
assertFalse(stack.isFull());
}
@Test
public void testEmptyPop() {
assertEquals(stack.pop(), null);
}
}