Commit 3e2f1062 authored by jon fehling's avatar jon fehling

add more error cases

parent 90370ea4
......@@ -61,7 +61,7 @@ public class Assignment1TestBase extends TestBase {
DummyMain.main(args);
String output = Terminal.OUT_TEST.poll();
if (acceptable) {
if (output != null) {
if (output != null && !output.equals(">>")) {
failAndLog("test should have succeeded");
}
} else {
......
......@@ -14,10 +14,10 @@ public class CaseCreator {
private final Random random = new Random();
private long rgenseed = System.currentTimeMillis();
private final int nCountries = 200;
private final int nSports = 50;
private final int nAthletes = 800;
private final int nErrors = 10;
private final int nCountries = 20;
private final int nSports = 100;
private final int nAthletes = 700;
private final int nErrors = 4;
public static void main(String args[]) {
......@@ -73,18 +73,29 @@ public class CaseCreator {
Vector<Vector<String>> athletes = new Vector<>();
Vector<String> athleteNames = new Vector<>();
Vector<String> athleteCountries = new Vector<>();
idCounter = 0;
for (int a = 0; a < nAthletes; a++) {
String id = String.format("%04d", ++idCounter);
ids.add(id);
athleteNames.add(randomPicker.pickName() + ";" + randomPicker.pickName());
athleteCountries.add(countries.elementAt(2 * random.nextInt(nCountries)));
}
for (int s = 0; s < nSports; s++) {
athletes.add(new Vector<>());
for (int a = 0; a < nAthletes; a++) {
String id = String.format("%04d", ++idCounter);
ids.add(id);
String country = countries.elementAt(2 * random.nextInt(nCountries));
athletes.elementAt(s).add(id);
String country = athleteCountries.elementAt(a);
if (random.nextInt(nAthletes +nSports) == 1)
country = countries.elementAt(2 * random.nextInt(nCountries));
athletes.elementAt(s).add(ids.elementAt(a));
athletes.elementAt(s).add(country);
pairs.add(new TestPair("add-athlete "
+ id + ";" + randomPicker.pickName()
+ ";" + randomPicker.pickName() + ";" + country + ";"
+ ids.elementAt(a) + ";" + athleteNames.elementAt(a) + ";" + country + ";"
+ sports.elementAt(s) + ";" + sports.elementAt(s), "OK"));
}
}
......@@ -94,7 +105,7 @@ public class CaseCreator {
for (int y = 1926; y <= 2018; y += 4) {
int indexAthlete = 2 * c;
int medal = random.nextInt(3);
int medal = random.nextInt(4);
String medalString = "";
if (medal == 0) medalString = "0;1;0";
......@@ -112,7 +123,7 @@ public class CaseCreator {
for (int f = 0; f < nErrors; f++) {
int indexAthlete = 2 * random.nextInt(nAthletes);
int medal = random.nextInt(3);
int medal = random.nextInt(4);
String medalString = "";
if (medal == 0) medalString = "0;1;0";
......
This diff is collapsed.
......@@ -55,6 +55,12 @@ Error, ...
Error, ...
> add-athlete 0003;james;doe;deutschland;sdfsdf;sdfsdffff
Error, ...
> add-athlete 0001;max;mustermann;kanada;curling;curling
Error, ...
> add-athlete 0001;maxchen;mustermann;deutschland;curling;curling
Error, ...
> add-athlete 0001;max;muster;deutschland;curling;curling
Error, ...
> summary-athletes eislauf;eisschnelllauf
0001 max mustermann 0
0002 jane doe 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment