Aufgabe 5.3 a Testfälle

Einige Selbstgeschriebene Testfälle für die a)

Disclaimer: Dieser Thread wurde aus dem alten Forum importiert. Daher werden eventuell nicht alle Formatierungen richtig angezeigt. Der ursprüngliche Thread beginnt im zweiten Post dieses Threads.

Aufgabe 5.3 a Testfälle
Heyhey,

hab mir mal die Zeit genommen und ein wenig an den Specs rumgespielt, um Fehler zu erzeugen. Wenn ihr den untenstehenden Code in die 3. Zeile der Examples kopiert (direkt erste Zeile MainMethode!), sollte euch ausgegeben werden, ob eure Implementierung korrekt ist.

Wichtig: Ich übernehme keine Garantie, dass die Testfälle korrekt sind, bei mir zumindest geben sie die gewünschten Ergebnisse aus!
Über Rückmeldung, ob sie funktionieren/Fehler bringen, würde ich mich natürlich freuen.

Mit Grüßen, Stefan K.

System.out.println("Testfaelle Aufgabe a: ");
int[][] gridTestSpec1 = {};
String[] wordsTestSpec1 = { “INGE”, “NOAH”, “ORBI”, “ROBE”, “ROLL”, “SEIL”, “STAR”, “DOLDE”, “HAUPT”, “INSEL”, “KOPIE”, “MASSE”, “MOEBEL”, “GASOLIN”, “INSULIN”, “PRIMAER”, “RAUCHER”, “SIGNATUR”, “EIFOERMIG”, “STAMMGAST”, “ARTILLERIE”, “ELEKTRISCH”, “GESPENSTER”, “SCHWIMMBAD” };
int checkRiddle1 = checkRiddle(gridTestSpec1, wordsTestSpec1);
if(checkRiddle1 == 1)
System.out.println(“Testfall 1 korrekt implementiert”);
else
System.out.println(“Testfall 1 fehlerhaft”);

	int[][] gridTestSpec2 = {{ 0, 0, 10, 1 }, { 0, 0, 8, 0 }, { 0, 4, 10, 1 }, { 0, 7, 4, 1 }, { 0, 9, 10, 1 }, { 0, 9, 9, 0 }, { 0, 12, 4, 1 }, { 0, 15, 6, 1 }, { 0, 17, 10, 1 }, { 2, 0, 5, 0 }, { 3, 6, 7, 1 }, { 3, 9, 5, 0 }, { 3, 11, 7, 1 }, { 4, 0, 5, 0 }, { 5, 6, 4, 0 }, { 5, 11, 7, 0 }, { 6, 0, 5, 0 }, { 6, 2, 4, 1 }, { 7, 4, 4, 0 }, { 7, 9, 9, 0 }, { 9, 0, 5, 0 }, { 9, 6, 4, 0 }, { 9, 11, 7, 0 }};
	String[] wordsTestSpec2 = { "INGE", "NOAH", "ORBI", "ROBE", "ROLL", "SEIL", "STAR", "DOLDE", "HAUPT", "INSEL", "KOPIE", "MASSE", "MOEBEL", "GASOLIN", "INSULIN", "PRIMAER", "RAUCHER", "SIGNATUR", "EIFOERMIG", "STAMMGAST", "ARTILLERIE", "ELEKTRISCH", "GESPENSTER", "SCHWIMMBAD" };
	int checkRiddle2 = checkRiddle(gridTestSpec2, wordsTestSpec2);
	if(checkRiddle2 == 2)
		System.out.println("Testfall 2 korrekt implementiert");
	else
		System.out.println("Testfall 2 fehlerhaft");

	

	int[][] gridTestSpec3 = {{-1, -1, 10, 0}, { 0, 0, 8, 0 }, { 0, 4, 10, 1 }, { 0, 7, 4, 1 }, { 0, 9, 10, 1 }, { 0, 9, 9, 0 }, { 0, 12, 4, 1 }, { 0, 15, 6, 1 }, { 0, 17, 10, 1 }, { 2, 0, 5, 0 }, { 3, 4, 4, 0 }, { 3, 6, 7, 1 }, { 3, 9, 5, 0 }, { 3, 11, 7, 1 }, { 4, 0, 5, 0 }, { 5, 6, 4, 0 }, { 5, 11, 7, 0 }, { 6, 0, 5, 0 }, { 6, 2, 4, 1 }, { 7, 4, 4, 0 }, { 7, 9, 9, 0 }, { 9, 0, 5, 0 }, { 9, 6, 4, 0 }, { 9, 11, 7, 0 }};
	String[] wordsTestSpec3 = wordsTestSpec2;
	int checkRiddle3 = checkRiddle(gridTestSpec3, wordsTestSpec3);
	if(checkRiddle3 == 3)
		System.out.println("Testfall 3 korrekt implementiert");
	else
		System.out.println("Testfall 3 fehlerhaft");

	int[][] gridTestSpec4 = {{ 0, 0, 10, 1 }, { 0, 0, 8, 0 }, { 0, 4, 0, 1 }, { 0, 7, 4, 1 }, { 0, 9, 10, 1 }, { 0, 9, 9, 0 }, { 0, 12, 4, 1 }, { 0, 15, 6, 1 }, { 0, 17, 10, 1 }, { 2, 0, 5, 0 }, { 3, 4, 4, 0 }, { 3, 6, 7, 1 }, { 3, 9, 5, 0 }, { 3, 11, 7, 1 }, { 4, 0, 5, 0 }, { 5, 6, 4, 0 }, { 5, 11, 7, 0 }, { 6, 0, 5, 0 }, { 6, 2, 4, 1 }, { 7, 4, 4, 0 }, { 7, 9, 9, 0 }, { 9, 0, 5, 0 }, { 9, 6, 4, 0 }, { 9, 11, 7, 0 }};
	String[] wordsTestSpec4 = wordsTestSpec2;
	int checkRiddle4 = checkRiddle(gridTestSpec4, wordsTestSpec4);
	if(checkRiddle4 == 4)
		System.out.println("Testfall 4 korrekt implementiert");
	else
		System.out.println("Testfall 4 fehlerhaft");

	int[][] gridTestSpec5 = {{ 0, 0, 10, 1 }, { 0, 0, 8, 0 }, { 0, 4, 10, 1 }, { 0, 7, 4, 1 }, { 0, 9, 10, 1 }, { 0, 9, 9, 0 }, { 0, 12, 4, 1 }, { 0, 15, 6, 1 }, { 0, 17, 10, 1 }, { 2, 0, 5, 0 }, { 3, 4, 4, 0 }, { 3, 6, 7, 1 }, { 3, 9, 5, 0 }, { 3, 11, 7, 1 }, { 4, 0, 5, 0 }, { 5, 6, 4, 0 }, { 5, 11, 7, 0 }, { 6, 0, 5, 0 }, { 6, 2, 4, 1 }, { 7, 4, 4, 0 }, {0, 0, 10, 2}, { 9, 0, 5, 0 }, { 9, 6, 4, 0 }, { 9, 11, 7, 0 }};
	String[] wordsTestSpec5 = wordsTestSpec2;
	int checkRiddle5 = checkRiddle(gridTestSpec5, wordsTestSpec5);
	if(checkRiddle5 == 5)
		System.out.println("Testfall 5 korrekt implementiert");
	else
		System.out.println("Testfall 5 fehlerhaft");

	int[][] gridTestSpec6 = {{ 0, 0, 10, 1 }, { 0, 0, 8, 0 }, { 0, 4, 10, 1 }, { 0, 7, 4, 1 }, { 0, 9, 10, 1 }, { 0, 9, 9, 0 }, { 0, 12, 4, 1 }, { 0, 15, 6, 1 }, { 0, 17, 10, 1 }, { 2, 0, 5, 0 }, { 3, 4, 4, 0 }, { 3, 6, 7, 1 }, { 3, 9, 5, 0 }, { 3, 11, 7, 1 }, { 4, 0, 5, 0 }, { 5, 6, 6, 0 }, { 5, 11, 7, 0 }, { 6, 0, 5, 0 }, { 6, 2, 4, 1 }, { 7, 4, 4, 0 }, { 7, 9, 9, 0 }, { 9, 0, 5, 0 }, { 9, 6, 4, 0 }, { 9, 11, 7, 0 }};
	String[] wordsTestSpec6 = wordsTestSpec2;
	int checkRiddle6 = checkRiddle(gridTestSpec6, wordsTestSpec6);
	if(checkRiddle6 == 6)
		System.out.println("Testfall 6 Horizontal korrekt implementiert");
	else
		System.out.println("Testfall 6 Horizontal fehlerhaft");

	int[][] gridTestSpec61 = {{ 0, 0, 10, 1 }, { 0, 0, 8, 0 }, { 0, 4, 10, 1 }, { 0, 7, 4, 1 }, { 0, 9, 10, 1 }, { 0, 9, 9, 0 }, { 0, 12, 4, 1 }, { 0, 15, 6, 1 }, { 0, 17, 10, 1 }, { 2, 0, 5, 0 }, { 3, 4, 4, 0 }, { 3, 12, 7, 1 }, { 3, 9, 5, 0 }, { 3, 11, 7, 1 }, { 4, 0, 5, 0 }, { 5, 6, 4, 0 }, { 5, 11, 7, 0 }, { 6, 0, 5, 0 }, { 6, 2, 4, 1 }, { 7, 4, 4, 0 }, { 7, 9, 9, 0 }, { 9, 0, 5, 0 }, { 9, 6, 4, 0 }, { 9, 11, 7, 0 }};
	String[] wordsTestSpec61 = wordsTestSpec2;
	int checkRiddle61 = checkRiddle(gridTestSpec61, wordsTestSpec61);
	if(checkRiddle61 == 6)
		System.out.println("Testfall 6 Vertikal korrekt implementiert");
	else
		System.out.println("Testfall 6 Vertikal fehlerhaft");

	int[][] gridTestSpec7 = {{ 0, 0, 10, 1 }, { 0, 0, 8, 0 }, { 0, 4, 10, 1 }, { 0, 7, 4, 1 }, { 0, 9, 10, 1 }, { 0, 9, 9, 0 }, { 0, 12, 4, 1 }, { 0, 15, 6, 1 }, { 0, 17, 10, 1 }, { 2, 0, 5, 0 }, { 3, 4, 4, 0 }, { 3, 6, 7, 1 }, { 3, 9, 5, 0 }, { 3, 11, 7, 1 }, { 4, 0, 5, 0 }, { 5, 6, 4, 0 }, { 5, 11, 7, 0 }, { 6, 0, 5, 0 }, { 6, 2, 4, 1 }, { 7, 4, 4, 0 }, { 7, 9, 9, 0 }, { 9, 0, 5, 0 }, { 9, 6, 4, 0 }, { 9, 11, 7, 0 }};
	String[] wordsTestSpec7 = { "INGE", "NOAH", "ORBI", "ROBE", "", "SEIL", "STAR", "DOLDE", "HAUPT", "INSEL", "KOPIE", "MASSE", "MOEBEL", "GASOLIN", "INSULIN", "PRIMAER", "RAUCHER", "SIGNATUR", "EIFOERMIG", "STAMMGAST", "ARTILLERIE", "ELEKTRISCH", "GESPENSTER", "SCHWIMMBAD" };
	int checkRiddle7 = checkRiddle(gridTestSpec7, wordsTestSpec7);
	if(checkRiddle7 == 7)
		System.out.println("Testfall 7 korrekt implementiert");
	else
		System.out.println("Testfall 7 fehlerhaft");

	int[][] gridTestSpec8 = {{ 0, 0, 10, 1 }, { 0, 0, 8, 0 }, { 0, 4, 10, 1 }, { 0, 7, 4, 1 }, { 0, 9, 10, 1 }, { 0, 9, 9, 0 }, { 0, 12, 4, 1 }, { 0, 15, 6, 1 }, { 0, 17, 10, 1 }, { 2, 0, 5, 0 }, { 3, 4, 4, 0 }, { 3, 6, 7, 1 }, { 3, 9, 5, 0 }, { 3, 11, 7, 1 }, { 4, 0, 5, 0 }, { 5, 6, 4, 0 }, { 5, 11, 7, 0 }, { 6, 0, 5, 0 }, { 6, 2, 4, 1 }, { 7, 4, 4, 0 }, { 7, 9, 9, 0 }, { 9, 0, 5, 0 }, { 9, 6, 4, 0 }, { 9, 11, 7, 0 }};
	String[] wordsTestSpec8 = { "INGE", "NOAH", "ORBI", "ROBE", "ROLL", "SEIL", "STAR", "DOLDE", "HAUPT", "INSEL", "KOPIE", "MASSE", "MOEBEL", "GASOLIN", "INSULIN", "PRIMAER", "RAUCHER", "SIGNATUR", "EIFOERMIG", "STAMMGAT", "ARTILLERIE", "ELEKTRISCH", "GESPENSTER", "SCHWIMMBAD" };
	int checkRiddle8 = checkRiddle(gridTestSpec8, wordsTestSpec8);
	if(checkRiddle8 == 8)
		System.out.println("Testfall 8 korrekt implementiert");
	else
		System.out.println("Testfall 8 fehlerhaft");
2 Likes