aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-02-23 11:09:04 (EST)
committersefftinge2009-02-23 11:09:04 (EST)
commitc2e492fbabdb6bca9ab5c99e3c61a81f948907e5 (patch)
tree84ca69882c07d1033a8addfbb40b9dfecd51bae9
parent6ec5d412e55dac5a263d0415a17dc5a1043f2f05 (diff)
downloadorg.eclipse.xtext-c2e492fbabdb6bca9ab5c99e3c61a81f948907e5.zip
org.eclipse.xtext-c2e492fbabdb6bca9ab5c99e3c61a81f948907e5.tar.gz
org.eclipse.xtext-c2e492fbabdb6bca9ab5c99e3c61a81f948907e5.tar.bz2
Removed unused classes
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java101
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java177
2 files changed, 0 insertions, 278 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java
deleted file mode 100644
index f3dc76c..0000000
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.xtext.parser.packrat.consumers;
-
-import java.util.ArrayList;
-
-import org.eclipse.xtext.parser.packrat.consumers.RecoveryState;
-
-import junit.framework.TestCase;
-
-/**
- * @author Sebastian Zarnekow - Initial contribution and API
- */
-public class RecoveryStatePerformanceTest extends TestCase {
-
- private static int ITEMS = 75;
-
- private static int LOOPS = 10000;
-
- private static int COPY_LOOPS = LOOPS * 5;
-
- private static int STEPS = 5;
-
- private ArrayList<Integer> stack;
- private RecoveryState recoveryState;
-
- @Override
- protected void setUp() {
- recoveryState = new RecoveryState();
- stack = new ArrayList<Integer>();
- }
-
- public void testStack() {
- for (int l = 0; l < LOOPS; l++) {
- for (int i = 0; i < ITEMS; i++) {
- stack.add(-1);
- for (int s = 0; s < STEPS; s++) {
- stack.set(i, stack.get(i) + 1);
- }
- }
- for (int i = ITEMS - 1; i >= 0; i--) {
- for (int s = 0; s < STEPS; s++) {
- stack.set(i, stack.get(i) + 1);
- }
- stack.remove(stack.size() - 1);
- }
- }
- }
-
- public void testCopyStack() {
- for (int i = 0; i < ITEMS; i++) {
- stack.add(-1);
- }
- for (int l = 0; l < COPY_LOOPS; l++) {
- ArrayList<Integer> newStack = new ArrayList<Integer>(stack);
- for (int i = 0; i < ITEMS; i++) {
- newStack.add(-1);
- for (int s = 0; s < STEPS; s++) {
- newStack.set(i, newStack.get(i) + 1);
- }
- }
- }
- }
-
- public void testRecoveryState() {
- for (int l = 0; l < LOOPS; l++) {
- for (int i = 0; i < ITEMS; i++) {
- recoveryState.announceNextLevel();
- for (int s = 0; s < STEPS; s++) {
- recoveryState.announceNextPath();
- }
- }
- for (int i = 0; i < ITEMS; i++) {
- for (int s = 0; s < STEPS; s++) {
- recoveryState.announceNextStep();
- }
- recoveryState.announceLevelFinished();
- }
- }
- }
-
- public void testCopyRecoveryState() {
- for (int i = 0; i < ITEMS; i++) {
- recoveryState.announceNextLevel();
- }
- for (int l = 0; l < COPY_LOOPS; l++) {
- RecoveryState copy = recoveryState.copy();
- for (int i = 0; i < ITEMS; i++) {
- copy.announceNextLevel();
- for (int s = 0; s < STEPS; s++) {
- copy.announceNextPath();
- }
- }
- }
- }
-}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java
deleted file mode 100644
index 4d895d9..0000000
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.xtext.parser.packrat.consumers;
-
-import java.util.Iterator;
-
-import org.eclipse.xtext.parser.packrat.consumers.RecoveryState;
-
-import junit.framework.TestCase;
-
-/**
- * @author Sebastian Zarnekow - Initial contribution and API
- */
-public abstract class RecoveryStateTest extends TestCase {
-
- private RecoveryState recoveryState;
-
- @Override
- protected void setUp() {
- recoveryState = createRecoveryState();
- }
-
- protected abstract RecoveryState createRecoveryState();
-
- public void testSimple_01() {
- recoveryState.announceNextLevel();
- assertEquals(1, recoveryState.size());
- recoveryState.announceLevelFinished();
- assertEquals(0, recoveryState.size());
- // no exception
- recoveryState.assertLevelIsReset();
- }
-
- public void testSimple_02() {
- for (int i = 0; i < 100; i++) {
- recoveryState.announceNextLevel();
- assertEquals(-1, recoveryState.getCurrentValue());
- }
- assertEquals(100, recoveryState.size());
- for (int i = 0; i < 100; i++) {
- assertEquals(-1, recoveryState.getCurrentValue());
- recoveryState.announceLevelFinished();
- }
- assertEquals(0, recoveryState.size());
- // no exception
- recoveryState.assertLevelIsReset();
- }
-
- public void testAnnounceNextLevel() {
- recoveryState.announceNextLevel();
- assertEquals(-1, recoveryState.getCurrentValue());
- recoveryState.announceNextLevel();
- assertEquals(-1, recoveryState.getCurrentValue());
- }
-
- public void testAnnounceNextStep() {
- recoveryState.announceNextLevel();
- recoveryState.announceNextStep();
- assertEquals(0, recoveryState.getCurrentValue());
- recoveryState.announceNextStep();
- assertEquals(1, recoveryState.getCurrentValue());
- }
-
- public void testAnnounceNextPath() {
- recoveryState.announceNextLevel();
- recoveryState.announceNextPath();
- assertEquals(0, recoveryState.getCurrentValue());
- recoveryState.announceNextPath();
- assertEquals(1, recoveryState.getCurrentValue());
- }
-
- public void testAnnounceLevelFinished() {
- recoveryState.announceNextLevel();
- recoveryState.setCurrentValue(5);
- recoveryState.announceNextLevel();
- recoveryState.announceLevelFinished();
- assertEquals(5, recoveryState.getCurrentValue());
- }
-
- public void testOrder() {
- for (int i = 0; i < 100; i++) {
- recoveryState.announceNextLevel();
- recoveryState.setCurrentValue(i);
- }
- Iterator<Integer> iter = recoveryState.iterator();
- int i = 0;
- while(iter.hasNext()) {
- int val = iter.next();
- assertEquals(i, val);
- i++;
- }
- assertEquals(100, i);
- }
-
- public void testCopyAndOrder() {
- for (int i = 0; i < 100; i++) {
- recoveryState.announceNextLevel();
- recoveryState.setCurrentValue(i);
- }
- RecoveryState copy = recoveryState.copy();
- Iterator<Integer> iter = copy.iterator();
- int i = 0;
- while(iter.hasNext()) {
- int val = iter.next();
- assertEquals(i, val);
- i++;
- }
- assertEquals(100, i);
- }
-
- public void testCopyEmpty() {
- RecoveryState copy = recoveryState.copy();
- assertEquals(0, copy.size());
- }
-
- public void testException_01() {
- try {
- recoveryState.announceNextPath();
- fail("IndexOutOfBoundsException expected");
- } catch( IndexOutOfBoundsException e) {
- // nothing to do
- }
- }
-
- public void testException_02() {
- try {
- recoveryState.announceNextStep();
- fail("IndexOutOfBoundsException expected");
- } catch( IndexOutOfBoundsException e) {
- // nothing to do
- }
- }
-
- public static class Simple extends RecoveryStateTest {
- @Override
- protected RecoveryState createRecoveryState() {
- return new RecoveryState();
- }
- }
-
- public static class CopyEmpty extends RecoveryStateTest {
- @Override
- protected RecoveryState createRecoveryState() {
- return new RecoveryState().copy();
- }
- }
-
- public static class CopyFilled extends RecoveryStateTest {
- @Override
- protected RecoveryState createRecoveryState() {
- RecoveryState result = new RecoveryState();
- for (int i = 0; i < 100; i++) {
- result.announceNextLevel();
- }
- for (int i = 0; i < 100; i++) {
- result.announceLevelFinished();
- }
- return result.copy();
- }
- }
-
- public static class CopyFilledWithOne extends RecoveryStateTest {
- @Override
- protected RecoveryState createRecoveryState() {
- RecoveryState result = new RecoveryState();
- result.announceNextLevel();
- result.announceLevelFinished();
- return result.copy();
- }
- }
-
-}