added all past projects

This commit is contained in:
Hannes
2017-11-10 00:13:57 +01:00
parent 5f63f0c599
commit 8c94608805
1391 changed files with 109456 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package edu.kit.informatik;
/**
* The Class ExitException.
*
* @author Hannes Kuchelmeister
* @version 1.0
*/
public class ExitException extends SecurityException {
/** The status. */
private final int code;
/**
* Instantiates a new exit exception.
*
* @param code
* the status
*/
public ExitException(final int code) {
super("JVM exit is forbidden!");
this.code = code;
}
}

View File

@@ -0,0 +1,125 @@
package edu.kit.informatik;
import org.junit.Test;
public class MainTest {
@Test
public void testMainWrongFile() {
System.setSecurityManager(new NoExitSecurityManager());
// File not existent
try {
final String[] args = new String[1];
args[0] = "Z:\\";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// duplicated Edge
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\duplicateEdge.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// edgeWithoutVertex
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\edgeWithoutVertex.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// emptyFile
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\emptyFile.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// negativeNumber
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\negativeNumber.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// noDivider
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\noDivider.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// noFirstPart
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\noFirstPart.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// noFirstPart
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\noSecondPart.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// notContinous
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\notContinous.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// numberOverflow
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\numberOverflow.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
// numberZero
try {
final String[] args = new String[1];
args[0] = "C:\\Eclipse\\workspace\\Final01\\junit\\graphs\\numberZero.txt";
// this should throw an exception
Main.main(args);
assert false;
} catch (final ExitException e) {
// if no exception is thrown something went wrong
}
System.setSecurityManager(null);
}
}

View File

@@ -0,0 +1,33 @@
package edu.kit.informatik;
import java.security.Permission;
/**
* The Class NoExitSecurityManager.
*
* @author Hannes Kuchelmeister
* @version 1.0
*/
public class NoExitSecurityManager extends SecurityManager {
/**
* Instantiates a new no exit security manager.
*/
public NoExitSecurityManager() {
super();
}
@Override
public void checkPermission(final Permission perm) {
}
@Override
public void checkPermission(final Permission perm, final Object context) {
}
@Override
public void checkExit(final int status) {
super.checkExit(status);
throw new ExitException(status);
}
}

View File

@@ -0,0 +1,7 @@
Aa
bB
C
d
--
Aa;bB;1;3
Aa;bB;2;4

View File

@@ -0,0 +1,11 @@
Aa
aA
AA
aa
bB
--
aa;bB;1;3
Aa;C;2;4
Aa;d;11;20
bB;C;5;2
C;d;3;1

View File

@@ -0,0 +1,5 @@
bB
C
d
--
Aa;bB;1;3

View File

@@ -0,0 +1,4 @@
Aa
bB
--
Aa;bB;1;-3

View File

@@ -0,0 +1,9 @@
Aa
bB
C
d
Aa;bB;1;3
Aa;C;2;4
Aa;d;11;20
bB;C;5;2
C;d;3;1

View File

@@ -0,0 +1,6 @@
--
Aa;bB;1;3
Aa;C;2;4
Aa;d;11;20
bB;C;5;2
C;d;3;1

View File

@@ -0,0 +1,5 @@
Aa
bB
C
d
--

View File

@@ -0,0 +1,6 @@
Aa
bB
C
d
--
Aa;bB;1;3

View File

@@ -0,0 +1,10 @@
Aa
bB
C
d
--
Aa;bB;1;3
Aa;C;2;4
Aa;d;11;20
bB;C;5;2
C;d;3;30000000000

View File

@@ -0,0 +1,5 @@
C
d
--
bB;C;5;2
C;d;0;0