Git Product home page Git Product logo

pgdp2223-tests's Introduction

Hi there 👋

pgdp2223-tests's People

Contributors

0xyelshayeb avatar anatoly03 avatar benn1x avatar blubsbuar avatar cod-eric avatar darkbreakerde avatar faid0 avatar felixhauptmann avatar greenbowser avatar hendrikh01 avatar hendrikhuebner avatar johannesstoehr avatar jonasfeld avatar julian-hartl avatar leon-hk avatar magnussaurbier avatar mauri2070 avatar maximiliananzinger avatar mbmueller avatar moladen avatar navid-rji avatar nilsreichardt avatar nopjar avatar opisek avatar simonsmd avatar snpshtwrx avatar tdphucvn avatar thealewu avatar thomasw04 avatar yifanchen03 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pgdp2223-tests's Issues

[W09B01] Test 06 falsch

Der Test 06 erwartet, dass der zweite Spieler auf das Feld 2,1 einen beliebigen Stein platziert. Platziert er allerdings auf Feld 1,2 einen Stein mit Wert 6, so hat er direkt gewonnen.

[W12H03] ShuttleProcessorTests shutDownTest() should not add task silently

Hi,
in this test, after a thread ShuttleProcessor is started, a task is added into its task queue with help of Reflection. This action is completely silent.

@Test
@DisplayName("Should wait until current task has finished evaluating when shut down")
public void shutDownTest() throws InterruptedException, NoSuchFieldException, IllegalAccessException {
    var taskchecker = new TaskChecker(null, null);
    var sp = new ShuttleProcessor(taskchecker);
    var taskGen = new TestTaskGenerator(0, 5, 0);

    sp.start();
    getTaskQueue(sp).add(taskGen.generateSlowTask()); // slow task takes 50ms to evaluate

    Thread.sleep(10);
    sp.shutDown();

    Thread.sleep(10);

    assertEquals("ShuttleProcessor shutting down.\n", out.toString());
    assertTrue(sp.isAlive(), "Should have waited for slow task to finish evaluating.");

    Thread.sleep(35); //enough time to finish evaluating slow task

    assertFalse(sp.isAlive(), "Slow task finished, the thread should have shut down by now.");
}

In my opinion, one of the following three changes would make sence:

  1. add the task into taskQueue via Reflection before starting the thread, as following:

    getTaskQueue(sp).add(taskGen.generateSlowTask()); // slow task takes 50ms to evaluate
    sp.start();

    I noticed that in test testEvaluatePriority() it was done this way.

  2. call notify() after adding task into the taskQueue via Reflection, as following:

    sp.start();
    getTaskQueue(sp).add(taskGen.generateSlowTask()); // slow task takes 50ms to evaluate
    synchronized (sp) {
        sp.notify();
    }

    In testAddTaskWhileRunning() and waitNotifyTest() it is done this way.

  3. call ShuttleProcessor.addTask() instead of using Reflection, as following:

    sp.start();
    sp.addTask(taskGen.generateSlowTask()); // slow task takes 50ms to evaluate

    As same as that in interruptTest().


Please correct me if I'm misunderstanding this test. Thanks for viewing :D

W06H02 pop test

void popShouldReturnCorrectValues() {
      final var value = 10;
      final var value2 = 20;
      final var value3 = 30;
      final var value4 = 40;

      stack.push(value);
      assertEquals(value, stack.pop());

      stack.push(value2);
      stack.push(value3);
      assertEquals(value3, stack.pop());

      assertArrayEquals(array(value2), getMem(getHead()));

      stack.push(value4);
      stack.push(value3);
      assertEquals(value3, stack.pop());
      assertEquals(value4, stack.pop());
      assertEquals(value2, stack.pop());

      assertArrayEquals(array(0), getMem(getHead()));
}

Why do we need the last assertArrayEquals ?

[W07H03] herbivoreBehaviour x/y coordinates

According to my understanding the parameters x and y being passed to eat() are supposed to be the coordinates of the MovingCell eat() gets called on.

If I understand correctly the herbivoreBehaviour() test implementation does not adhere to this convention.

w13h03

Hello,
I belive that the tests of UnitTest of w13h03 expect the wrong order of inputs, e.g. for the code

const 2
const 4
div
write
halt

They would expect 4/2=2 instead of 2/4=0 . However I may be mistaken. Thanks for writing the tests and have a good day.

[W04H03] Incorrect test for combineHulls

Im commit #55 wird ein Test hinzugefügt, der die combineHulls Methode auf folgende Inputs testet:
image
(Hab den code ein wenig formatiert, damit das Bild nicht zu groß wird)

Auf Artemis steht jedoch, dass "davon ausgegangen werden darf, dass der Endpunkt firstHull[firstHull.length - 1] der ersten gleich dem Startpunkt secondHull[0] der zweiten ist."
image

Tests auf Inputs wie firstHull = {}und secondHull = {{1, 2}, {2, 3}} sind daher denke nicht nötig.
Ich könnte es mit einer PR abändern, da ich sowieso noch Tests hinzufügen wollte.

w09b01

in this case, cant prevent second player win. show in figure below
3

[W06H03] - DenseGraphCapabilityTest and SparseGraphCapabilityTest checking for sorted array

DenseGraphCapabilityTest und SparseGraphCapabilityTest vergleichen den output von getAdj() mit eine sortierten Array, was aber laut Aufgabenstellung nicht verlangt ist. Man könnte daher den Output array vor dem Vergleichen sortieren.
z.B. anstatt von:
Assertions.assertArrayEquals(res, denseGraph.getAdj(1));
so:
int[] actRes = denseGraph.getAdj(1);
Arrays.sort(actRes);
Assertions.assertArrayEquals(res, actRes);

Typo in README.adoc - 1. Legal Status

Hey, I did not want to make an extra PR for this, just wanted to point out that there's a typo in the readme in this section

Furthermore, there is no guarantee of the correctness of the tests. Neither the Übungsleitung nor any of the other tutors will contribute own tests. We (Maximilian Anzinger, Johannes Stöhr, Georg Henning, Konrad Gößmann, Robin Marchart, Oliver Specht, and Anton Kluge) will just make shure that there are no tests that reveal the solution. It is your own responsibility to validate the correctness and if necessary report bugs or even provide/contribute a fix for your fellow student.

under 1. Legal Status

In the second sentence you say

We (...) will just make shure that..

https://dictionary.cambridge.org/de/worterbuch/englisch-deutsch/make-sure

As far as I am concerned there should be no h in the word sure.

w09h02

the first actual time is 6 not 7 right?
QQ截图20230105212918

[W09B01] tests not following guideline

Test are supposed to be structured like this:

./task
└───test
    └───some
        └───package
            ├───AbcTest.java
            ├───DefTest.java
            └───...

This is clearly stated under how to contribute and should get fixed since some automation scripts rely on this structure.

login - unsuccessful test incorrect

The test expects username and password fields to be null after failure to login despite the specification stating that these fields are supposed to get set as soon as the token request succeeds.

[W06H02] popShouldReturnCorrectValues tests irrelevant Stack contents

popShouldReturnCorrectValues() prüft den Stack auf Gleichheit mit dem Array int[]{0}, nachdem das letzte verbleibende Wert aus dem Stack gepop()ed wurde:

assertArrayEquals(array(0), getMem(getHead()));

Laut Tutoren ist der Inhalt der gepop()ed Zellen aber egal:
https://zulip.in.tum.de/PGdP-W06H02/pop
Stattdessen müsste geprüft werden, ob der top-Pointer gleich -1 ist (und evtl, dass nach dem Ersten Stack keine weiteren mehr sind):

int getTopPointer(Stack s) {
    try {
        final var field = s.getClass().getDeclaredField("top");
        field.setAccessible(true);
        return (int) field.get(s);
    catch (IllegalAccessException | NoSuchFieldException e) {
        throw new RuntimeException(e);
    }
}

und in popShouldReturnCorrectValues():

assertEquals(-1, getTopPointer(getHead()));

Problem mit dem picture1 test in w05h02

Der Test picture1 geht davon aus, dass der zweidimensionale Array int[4][3] die Höhe 4 und die Länge drei hat.

Allerdings glaube ich, dass es umgekehrt ist. Der Array hat die Breite 4 und Höhe 3.

[W09H03] Test DG 26 Encode possible error

There might be an error in the test "Test DG 26 Encode neues BufferedImage 7x7 mit Buchstabe e".

In DGTest.java the line 2005 is:
Assertions.assertEquals(Color.YELLOW.getRGB(), output.getPixels().getRGB(i,output.getHeight()-1));

but should be:
Assertions.assertEquals(colorsE[i],output.getPixels().getRGB(i,output.getHeight()-1));

[W11B01] Falsch Negativer Test für findPath

Der Test findPath schlägt bei mir mit dem 5. Parameter fehl. Es kommt folgende Ausgabe:

digraph {
b -> t [label="0/1"];
b -> c [label="0/1"];
s -> a [label="0/1"];
a -> b [label="0/1"];
a -> t [label="0/1"];
c -> t [label="0/1"];
c -> a [label="0/1"];
}
Your path was: s -> a -> b -> t

Auf Artemis passen die Tests jedoch.

Readme update

My IDE did not include this in the build.gradle:
test {
java {
srcDirs = ['test']
}
}
and it took hours for me to find out how to get the tests to run. So maybe you could add an example screenshot in the Readme of a correct file structure and add, that this line has to be added to the build.gradle?

Expected und Actual vertauscht bei W04H02

Meine Tests bei der Aufgabe sind (zurecht) gefailt. Allerdings war bei der Konsolenausgabe Actual und Expected vertauscht.
Hat mich anfangs sehr verwirrt.
image
Der hier gefailte Test ist in Zeile 111, es gilt aber auch für andere Tests. Vermutlich wurde einfach die Reihenfolge der Parameter von AssertArrayEquals vertauscht.

[W09H03] `java.lang.NoClassDefFoundError: org/junit/platform/engine/ConfigurationParameters`

I'm getting the following error message when I'm executing one of the tests:

java.lang.NoClassDefFoundError: org/junit/platform/engine/ConfigurationParameters
	at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.<init>(JUnit5TestLoader.java:37)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
NativeConstructorAccessorImpl.java:77
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
DelegatingConstructorAccessorImpl.java:45
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
Constructor.java:499
	at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
ReflectAccess.java:128
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
ReflectionFactory.java:347
	at java.base/java.lang.Class.newInstance(Class.java:645)
Class.java:645
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:371)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:366)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:310)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:225)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.ConfigurationParameters
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
BuiltinClassLoader.java:641
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
ClassLoaders.java:188
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
ClassLoader.java:520
	... 13 more

w09b01 AITests falsch

Bei AITests erwarten tests 37 bis 66 alle, dass der gegnerische Gewinnzug mit den werten 7 oder 8 blockiert werden. Das muss allerdings nicht der Fall sein um den Sieg zu blockieren.

Die Tests 60, 56, 54 sind komplett falsch, da es bei ihnen keine Möglichkeit gibt den sieg des Gegners zu verhindern. Also ist der nächste zug undefiniert. Evtl. gibt es noch mehr problematische tests. Bitte noch einmal drüber gucken.

[W09B01] GameTests 30 & 31 not necessary

See this point in the description:

  • "Wenn alle Felder belegt sind, endet das Spiel nicht mehr automatisch in einem Unterschieden. Es gibt erst dann ein Unentschieden, wenn beide Spieler all ihre Spielsteine gelegt haben und es keinen Gewinner gibt."

But for these tests to pass, the game has to end when no one can make a move anymore and not when all players played all pieces.

w03h03 bad gradientMagnitude given in testing_build_seams_seamsArray

@felixhauptmann you are the first person I can tag, I can't tag yannic

In SeamCarvingTest.java, starting on line 163, the following is given as gradientMagnitude for the test.

new int[]{
        Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
        1, 1, 1, 1, 1, 1,
        69, 420, 42, 42, 42, 1337,
        100, 10, 666, 20, 3, 10,
        Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE
 }

why does this not have Integer.MAX_VALUE on the right and left sides as well?
This causes both testing_build_seams_seamWeights tests to fail for me.
I believe it should look like this:

new int[]{
        Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
        Integer.MAX_VALUE, 1, 1, 1, 1, Integer.MAX_VALUE,
        Integer.MAX_VALUE, 420, 42, 42, 42, Integer.MAX_VALUE,
        Integer.MAX_VALUE, 10, 666, 20, 3, Integer.MAX_VALUE,
        Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE
 }

Have I misunderstood something or shall I adjust the test?

[W09B01] Remove Test 53

@Test
    @DisplayName("DG Test 53 mehrere gewinne verhindern erster spieler spalte und zeile test 1")
    public void test53() {
        this.board = new Field[][]{
                {null, new Field(0, false), new Field(1, false)},
                {new Field(2, false), null, null},
                {new Field(3, false), null, null}};
        this.firstPlayedMoves = new boolean[]{
                false, false, false,
                false, false, false,
                false, false, false};
        this.secondPlayedMoves = new boolean[]{
                true, true, true,
                true, false, false,
                false, false, false};

        Move move = this.ai.makeMove(this.board, true, this.firstPlayedMoves, this.secondPlayedMoves);

        Assertions.assertEquals(0, move.x());
        Assertions.assertEquals(0, move.y());
        Assertions.assertEquals(8, move.value());

    }

Please correct me if I'm wrong, but this test doesn't make sense to me, and I think it should be removed. It's expected to place a piece in the upper left corner 0,0 but the opponent would still win if they place a piece in the center of the board at 1,1. There is no move to win in this scenario, so I don't think it makes sense to test for a specific move.
The same is true for test 57
https://github.com/MaximilianAnzinger/pgdp2223-tests/blob/main/w09b01/pgdp/AITests.java#L1383-L1404
and 61
https://github.com/MaximilianAnzinger/pgdp2223-tests/blob/main/w09b01/pgdp/AITests.java#L1455-L1476
and 63

W04H03: Alternatively correct answer not accepted by test

In "ClosedConvexHullExample" sind die ersten drei Punkte der expectedHull auf einer Geraden, damit ist es auch korrekt, den Punkt {-2, 1} weg zu lassen. Methoden, die die Hülle ohne diesen Punkt zurückgeben, werden als falsch markiert, obwohl sie auch den Anforderungen der Aufgabenstellung entsprechen.

Invalid Input for H04.1

The test "Eigenes Beispiel" for "Aufgabe 1 - Rekursive Pinguin Reihe" is testing for n=-122 and n is defined to be greater than that.

[W07H02] Fix linebreaks

@julian-hartl Mehrere Leute hatten jetzt Probleme mit den Line endings, weil Windows \r\n statt normalem \n nutzt.
Tools wie IntelliJ ersetzen das, auch auf Windows, dann failt aber System.lineSeparator(). Deswegen Vorschlag:
Im output alle \r\n durch \n ersetzen und expected mit \n schreiben.

Widersprüchliche Test in W05H03

Code

MessengerTests

@Test
@DisplayName("[OPTIONAL] UserArray.addUser")
public void testUserArrayAddUser1() {
    UserArray ua = new UserArray(3);
    User alice = new User(5, "Alice", null);
    ua.addUser(alice);
    ua.addUser(alice);
    Assertions.assertArrayEquals(new User[] {alice, alice, null}, getUsers(ua), "Wrong Users");
}

UserArrayBehaviourTest

@Test
@DisplayName("[OPTIONAL] Add two same users to the array")
void addSameUsers() {
    UserArray userArray = new UserArray(4);
    userArray.addUser(Mike);
    userArray.addUser(Emily);
    userArray.addUser(Mike);
    userArray.addUser(Susan);

    Assertions.assertEquals(3, userArray.size(), "Wrong number of the users in the UserArray. Expected 2, but got " + userArray.size() + " instead");
    Assertions.assertArrayEquals(new User[]{Mike, Emily, Susan, null}, userArray.getUsers(), "Wrong list of users in the UserArray");
}

Beschreibung

Entweder es können Personen doppelt eingefügt werden, oder eben nicht. Wobei es eher mehr Sinn ergibt, wenn ein Benutzer nur einmal eingefügt werden kann. Daher würde ich den Test aus UserArrayBehaviourTest bevorzugen. Allerdings ist dieser Testcase (wie ich es sehe) nicht in der Aufgabenstellung definiert. Daher wäre vielleicht der Test aus MessengerTests eher für die Aufgabenstellung geeignet. Sonst wäre es aber auch vielleicht möglich beide Tests zu entfernen.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.